2021-01-10 Update

I finished the Pluralsight tutorial on Elixir.

I know it was just one tutorial, but I do not think I am sold on Elixir yet. Granted, I know the Erlang VM is good for multi-threading, and it is better to use abstractions for that then dealing with threads directly, like Java does. One count count against Go is that it seems like the multi-threading support is at a lower level. Then again, I think Go in general is lower level.

One thing I find interesting is that Elixir allows you to overload a function with the same number and type of arguments as an alternative to convoluted cond statements (Elixir has “if” and “else”, but you cannot have more than two choices; for “if..else if…else” you use “cond”.)

The example in the tutorial was printing out the song “100 bottles of beer on the wall.” You can use the same code to handle 100 down to 3, but you need to handle 2 and 1 slightly differently. So you could do this:

I do not know if any other language allows that. Maybe Ruby does and I don’t remember or never encountered it.

Another feature that I like is doctests. You can put iex commands in your documentation (“iex” is the interactive Elixir shell), and you need to start them with the “iex>” prompt. When you run your automated tests, Elixir will also run the iex commands in your documentation, so your docs will always have up-to-date examples.

It was just one tutorial, so there was not much about actors or processes. My subscription is up in a few months, and while I am satisified, I do not think I will renew because I plan on getting up to speed on Java and Kotlin by then.

One thing I do not like is the inconsistency. You can put parentheses around a functions arguments. Or not. And like Go and the C family, if you use operators then the arguments are placed differently than they are for functions. An example is “2 + 3” as opposed to “2.add(3)” or “add(2, 3)”. I know the latter two are more typing, but I prefer consistency and clarity over conciseness.

I think I prefer braces over “do…end”.

And I do have a few concerns about the community of Elixir. Back in 2015, there were a lot of articles from mostly Ruby/Rails people who were gushing about how they loved Elixir. Some of their arguments were technical. But a lot of them said that Elixir is new and it all feels the way Ruby and Rails felt a decade before. Do you want to chase the new car smell, or do you want to solve problems?

A few people even pointed out that just as Dave Thomas wrote one of the first books on Ruby, he wrote one on Elixir. Would a guy who started a publishing company want you to learn a new language? Why wouldn’t he?

And speaking of problems: While not everyone has the same path, a lot of people went from Java/Spring/Hibernate to Ruby/Rails and now to Elixir/Phoenix. They have abandoned hard-to-maintain apps for the new hotness twice in a decade. And when they want to Ruby/Rails, some of the criticisms were that it was slow, did not handle multi-threading (I do not know if Ruby still has the global interpreter lock issue) and a lot of critics said that the magic of metaprogramming would cause problems in the long run.

The Ruby/Rails crowd said that developer speed is more important than runtime speed, that they could just send requests to a message broker, and the magic helped them get solutions out faster.

Now they are going to Elixir because it’s faster than Ruby, Elixir can handle multi-threading, and they are tired of dealing with logic spread out across an unmaintainable monolith. In other words, Elixir solves problems that they kept telling the Java crowd were not problems. From “U mad, bro?” to “Eff this” without even acknowledging the critics were right.

I am not against learning new things. But do we need to learn new things just to say we are learning new things? Maybe we need to do some of the old things better. I think a lot of Java apps would be easier to deal with if (like the one I work with) they were upgraded and refactored to use newer versions of Java/Spring/Hibernate. It would be painful, but not changing these apps is painful, and porting to a new language would be painful. And leaving a language for the newest, hottest thing just leaves a problem for someone else. I keep running into old Lispers and Smalltalkers talk about all the things they could do 20, 30 years ago, and I keep wishing there was a way to break the cycle.

Maybe Rails apps will always be impossible monoliths (I am out of the Rails scene, so I don’t know). Sometimes you are better off walking away, especially if the suits won’t allow refactoring for “business” reasons. (It seems like “business” is always used as a reason to say “No” to things that will make my life easier.)

There are some interesting things in Elixir/Erlang land. Is it possible to implement the “Let it crash” philosophy in other languages? A lot of people seem to chase the “new tech sugar high”, and it seems like Lispers had answers all along.

Plus, when I look at companies that use Elixir, it seems like a lot of social media/web 2.0/gig economy companies, or “$BLAH_BLAH for X” companies copying the latest money-losing unicorn out of “the Valley”. Not a lot of large corporations. I am not exactly Mr Corporate, but when I look at some of the lists of clients of Rails/Elixir consulting firms, I think to myself, “If all of these companies went under, I wouldn’t care and it would have no effect on my life.” A lot of hipsters may hate the idea of working for a bank, or an insurance company or a utility, and while trying to survive the yearly purge is draining, people actually the services those companies provide. At least some of them in the case of banks.

If you are an Erlang/Elixir person reading this, you might be thinking “You got A wrong”, or “You should read B” or “You should talk to C”. Maybe. I have limited time. For now, if I pick a new direction, I would try Go before Elixir.

You’re welcome.


Here are some notes from 2015 or so that I looked at to write this, with comments and more recent links:

https://www.monterail.com/blog/2015/the-elixir-world
Has a link to a tweet that says:
#ElixirConf has a similar vibe to Ruby confs of ~10yrs ago. Excitement. Cool stuff being hacked on. Very thought provoking and energising.
Great
http://solnic.eu/2015/06/06/cutting-corners-or-why-rails-may-kill-ruby.html

Cutting Corners or Why Rails May Kill Ruby


Says monkey patching is killing Ruby

https://teamgaslight.com/blog/4-reasons-were-having-fun-programming-elixir
“What’s more, it’s just a blast in the same way that I felt when I first started playing with Ruby.”

http://www.creativedeletion.com/2015/04/19/elixir_next_language.html
“Like with Ruby 12 years ago, once again I feel that this new platform is so much better than the other solutions. And it is not just a gut feeling, there are rational arguments to back it up.”
What would be more rational is to not change languages every stinking decade.
“Another similarity is that Dave Thomas is also excited about Elixir and has written a book about the language.”
Are you being played here?

https://medium.com/@kenmazaika/why-im-betting-on-elixir-7c8f847b58#.d5skiqwyy

http://www.littlelines.com/blog/2014/07/08/elixir-vs-ruby-showdown-phoenix-vs-rails/
tl;dr Phoenix showed 10.63x more throughput over Rails when performing the same task, with a fraction of CPU load
Hmmm. When it was Ruby vs Java 10 years ago, performance was not that important. Now it is.

Blog post on Let It Crash: https://www.amberbit.com/blog/2019/7/26/the-misunderstanding-of-let-it-crash/

Another one, stating that a lot of Erlang/Elixir people do not understand “Let It Crash”: http://stratus3d.com/blog/2020/01/20/applying-the-let-it-crash-philosophy-outside-erlang/

 

2019-05-31 Update: Passwords

I have written about websites with passphrase generators and generating passwords and passphrases locally (particularly on this page and this post). I have decided to just use KeePassXC for password management.

I started using it on my personal laptop, and I really like it. I back the file up onto a thumb drive on a regular basis, or at least when I make changes. I have a few entries for other information, like my car’s license plate and VIN number in case I ever need them. I also have an entry for my shoe size, since I don’t buy shoes too often, but it is nice to have the info readily available when I need it.

The hard drive on my work laptop crashed, and I had to request access to everything again. I downloaded KeePassXC on my work laptop, and I use that and it has made everything easier. I also back it up to the company’s OneDrive, so I will not be locked out of anything again.

I know everybody wants to do everything online all the time, but I really like having my password database in a local file that I can control.

You’re welcome.

 

2019-01-09 Update

I recently attended the first meeting of the Austin Kotlin Meetup. I might keep going in the future. I am kind of on the fence about Kotlin. It is nicer than Java, at least Java as most companies use it today.

I get the impression there are a lot of teams using old versions of Java, and old versions of Spring. They might solve a lot of their pain by upgrading and not really have any need to go to a new language. I wish I knew a way to get teams to upgrade. When Java came out, it was the sleek language (vis a vis C++); now it is the old chestnut. Rails has gone through the same cycle. If companies have fallen behind on Java, and fallen behind on Rails, will going to Kotlin really make things better? Maybe Kotlin teams will get bogged down by legacy Kotlin in ten years. Do we need more languages? Why can’t we just be more intelligent about the languages we use? (And since languages seem to becoming more like Lisp, perhaps we should just go to some dialect of Lisp.)

At one point in the meeting, someone asked what makes a language a “functional language”. I thought a language is considered “functional” when a function can be sent as an argument to another function, or a function can return a new function. One person mentioned immutability. Another mentioned tail-call optimization.

I have been working a bit more on Simply Scheme. Chapters 9 and 10 dealt with lambdas and higher-order functions. I think I am understanding functional programming, but I do not feel like I am getting the enlightenment that people keep talking about. Perhaps this is because I have been exposed to these concepts for a while now.

One reason I doubt I am becoming enlightened is sometimes my answers are larger than other people’s. I can make something that works, but it is not always elegant and minimal.

Another reason I doubt my potential enlightenment is that I am not sure it is making me a better programmer at my job. We are running JDK 6, we are using XML to configure Spring, and there is logic in the views. I am not sure how understanding higher-order functions will help me improve things. There are a lot of things I cannot change. I think it should be re-written from the ground up. Perhaps I will get more insights when I finish Simply Scheme.

Frankly, I think a lot of people where I work do not understand a lot of this stuff and have not been exposed to a lot of these concepts. (Most people I talk to have never even heard of Lisp, or Smalltalk, or Erlang or Scala, or Ruby.) I was not exposed to it for a long time, and I did not understand it at first either. When you are surrounded by people who think that the Gang Of Four patterns are the height of technological sophistication, it is easy to think that is the way things should be done. Part of the issue is that the functional programming community does not explain a lot of this stuff very well. I do not think that state is bad, or that changing state is bad. And side effects are hard to avoid if you want a program to be useful. I/O is a side effect, and it is important. I think the real issue is that state changes and side effects can cause problems if they happen when you do not intend for them to happen, and it is better to explicitly control them.

I am considering taking another break from Simply Scheme and making some web apps in Clojure. Perhaps I should work on getting better in the technologies I want to work in, and go for enlightenment later.

The viability of web apps showed up on Hacker News a few times the past few weeks: “Start with a Website, Not a Mobile App” and “Ask HN: Is web development still a viable career choice?” I will look at these a bit and comment more later.

Going back to chapters 9 and 10 of Simply Scheme.: They showed a neat trick to use lambda to wrap a higher-order function that only takes one argument (like every, keep and accumulate, which are their versions of Clojure’s map, filter and reduce) and put it in an anonymous function so it can take two or more arguments. Pretty slick.

Note: To search the c2.com wiki, try the search page.

Thoughts On Apps And Devices

In my last post, I wrote about the future of devices and web apps versus AI. These topics have since come up again in conversation and during my web browsing.

A guy named David A. Wheeler wrote a post titled “Do not install or develop mobile apps unless you have to“.

He mentioned that a phone app can get a lot of info about you from your phone, and there are more privacy concerns than with a web app. Also, Apple and Google will take a cut of your revenue. Apple can remove apps from the app store.

If you make a web app, you have more control. And you have reduced costs. With mobile apps, you have to make one for IOS and one for Android. Since most companies make web and mobile apps, that is usually three apps. You have to make sure your app works with different versions of the OSes. When I was in Chicago, I knew a mobile developer who had a few dozen phones. Granted, there are some ways to make one app that can work on IOS and Android (Appcelerator Titanium, RhoMobile Suite, React_Native, Apache_Cordova, Xamarin). All you got to do is pick one. And hope it does not get discontinued. Or beholden to some company run by a guy who looks like a robot.

But if you go with a web app, you just have to make one. According to Dave Wheeler, the UK government has dropped mobile development. And they are soooo much happier. Less cost, more control.

At the Emacs meetup, someone mentioned that we might stop using laptops and desktops, and go with phones. One person said we might just plug our phones (or some future version of them) into terminals. I have heard this before, but I don’t know how it would work.

Would we run apps installed on our phones? As I wrote before, laptops have more memory and hard drive space. On a phone, the memory does double duty. I don’t think that the phones will ever be as powerful as laptops and desktops. Or would our phones authenticate us to our apps on the cloud, and load them onto the terminal? Or would we run them on the cloud?

And what OS would we use? Would we be limited to IOS and Android? Or whatever the cloud provider gives us? I like being able to run Linux on my local machine.

One problem with these scenarios is I have multiple laptops, but only one phone. How would I use more than one if I have to?

I do not like the idea of my phone being my primary device. I know banks, brokerages and insurance firms offer mobile apps. I know phones and apps have security, but I am amazed at how often I hear about people losing their phones, or dropping them in the toilet. (Seriously? Why do people bring their phones into the bathroom?) I have seen quite a few phones lying around where I work. I generally do not lose my phone, but I do not like to use it to manage my money. That just seems like a bad idea.

Maybe we would have small, portable hard drives we would plug into terminals instead of plugging in phones. Granted, I just mentioned that portability can be bad. But maybe that would make it easier to get a better CPU, more memory, or a better monitor.

One device type that has become popular is the “all-in-one”, where the memory and hard drive are part of the monitor. I do not think you can add memory to these things. But I see them a lot. I had to upgrade my phone, and the store had these.

I still do not think the death of desktops is upon us. Gamers and artists love desktops. (They are called “desktops”, but a lot of people put theirs on the floor.) Laptops are still pretty common. I think these “all-in-one” computers are a new type of desktop. If you have a job that can be done at a desk, you will probably be using a laptop, desktop machine, or an all-in-one for a while.

I cannot remember who said this, but someone older than me pointed out that using a web browser to do everything on the cloud was similar to a dumb terminal connecting to a mainframe. We had come full circle. Perhaps at some point, the client-server model will come back.

2018-08-29 Update: Anonymous Functions and Kafka

I am still going through the tutorials on Purely Functional. It is taking longer than I thought. I might start going through Luminus at the same time as well. I think that building something while going through the lessons are a better way to learn.

In one of the lessons on Purely Functional, there is an interesting use of anonymous functions.

In version 3.17 of core.clj, we saw this in the function add:

We see a call to “cond”. It uses the type of the ingredient to decide which function to call.

In version 3.18 of core.clj, he adds a map with anonymous functions:

In version 3.19 of core.clj, he gets the functions out of the map and sets them equal to a symbol, replacing the cond:

I will also look into Apache Kafka. I went to the Apache Kafka meetup recently. I think it will be important going forward.

You’re welcome.

Thoughts On WordPress

A week or so ago I went to the Austin WordPress Meetup which featured a presentation about Gutenberg.

Gutenberg is the upcoming editor for WordPress. I admit I did not quite understand everything that was said. But it means there are some big changes coming up. It will allow WordPress to interface with many different types of systems that it cannot talk to today. At one point, the presenter theorized that in a few years WordPress may not use themes as we understand them today. This could put some people out of work; I think there are several companies that sell WordPress themes.

Gutenberg will be written with React. I do not like JS and try to avoid it as much as I can (too much churn and reinvention of wheels), but this might help solidify React’s ranking. As WP people love to point out, WP powers 20-25% of all web sites. The presenter said that Drupal will be moving to Gutenberg as well (although I later found out this is not a sure thing).

I have toyed with the idea of porting WP to another language, even though it would be a massive undertaking. A lot of developers do not like PHP. When I was getting into Ruby and Rails, I joined the mailing lists for local Ruby/Rails groups in about a dozen cities. About once a month, someone in one of the cities would ask about any blog or CMS frameworks written in Ruby. They had made a Rails app for a client, and now the client wanted a blog or CMS. A few replies would mention Radiant or Refinery, but it seems like most of the time the original poster would just go with WordPress. Once someone just posted the Most Interesting Man In the World meme. I did have a go at porting WordPress to Rails.

Eric Normand posted a video titled What Clojure needs to grow – a boring web framework and boring data science.  He said Clojure needs a default web framework. At one point he talks about WordPress. It made me think again about porting WordPress to another language. I have not had problems with WordPress, but some sites have, including Naked Capitalism.

It would also be nice to port the WordPress database from MySQL to Postgres. There is pgloader (written in Common Lisp). There is also pg_chameleon, which is written in Python. But the issue is that some people might not like a new system if it does not look and work just like WordPress, kind of like people do not like other office suites. Plus things might change a lot with Gutenberg.

That said, I think if “ClojurePress” becomes a thing, there are a few things it should do out of the box. There are some things that are pretty common that are handled by plugins. Sometimes multiple plugins, sometimes plugins that have not been updated in a while. Maybe some of these are things that only I want, but here is my list:

  • HTML Tables
  • Static HTML Export
  • Contact Page
  • Twitter intregration (posting AND archiving)
  • Facebook (Granted, Facebook could block this; see here and here)
  • Deleting Revisions
  • Move Comments

 

Reasons I Do Not Like Sharepoint

Here are some reasons I do not like Sharepoint.

First off, I think the underlying concept is wrong. Putting office files in on the web is just stupid.
The web started out at HTML files; even dynamic sites make HTML files. Trying to make the web into a viewer for Office files adds a layer of friction. It is also vendor lock-in. The web was intended to be open. And again, MS is trying to close it.

Speaking of files adding friction to the web: I also do not like PDFs on the web, especially multi-column PDFs.

Second: A lot of the files on Sharepoint are Word files, and a lot of the things in Word files do not need to be in Word files. HTML would work just as well. Why are people putting stuff in Word files anyway? (Spreadsheets are another story.) Why not just use some kind of wiki? Or Atlassian Confluence? Or Drupal? Or Intranet DASHBOARD? Or Jive? Or MindTouch? Or anything on this list? (I think this list is a bit more up to date, but unordered.) WYSIWYG editors are not that hard to learn. Why pay for MS Word when you are not using all of its features? And yes, I know SP has a wiki. I have never tried it, and I have no desire to. It is probably terrible. SP is about trying to make proprietary Office files relevant in an open web-centered world. Making a decent wiki with SP would expose the absurdity of SP’s existence. Making proprietary Office files relevant in an open web-centered world is Microsoft’s problem. Not mine, and not yours either.

If you really need to print, I am sure there are other systems that can convert content to PDFs. There are systems that have single sign-on capabilities.

If you use files, why are you using an online system? The impedance mismatch causes problems. People still download the files and email them to each other and get out sync. And even though there is versioning, people will manually add different versions of files. I have seen files in folders like this: fileX.doc, fileX_002.doc, fileX_DECEMBER.doc. If you are going to put stuff in Sharepoint, I want to look at a folder and just see the files I need to see. Don’t make me figure out whether I should look at fileX, or fileX_002, or fileX_DECEMBER.
I think this is because SP tries to do so many things.

Another reason is almost everyone hates it. At least, almost everyone I have asked about it at companies where I have worked that have used SP have hated it. Maybe everybody tells the big shots they love it and everybody is lying to me, but I really do not have any decision-making authority. Why would people lie to me?

There are many developers who take a course that uses Lisp or Scheme, or get a job using Lisp, and they will rave about it years or even decades later. They will say that Lisp/Scheme changed their perception unlike anything else. That they learned more by using Lisp than they learned using anything else. Nobody really holds MS technologies in the same esteem. Does anyone ever look back years later, and say, “God, what a great piece of engineering ${SOME_MS_PRODUCT} was. I learned so much using ${SOME_MS_PRODUCT}”. A lot of non-technical people love MS products because they are generally unaware of any alternative. We should use technologies that we admire, not use technologies simply due to inertia or ignorance.

We are always told on the technology side that we have to “learn to understand the needs of the business.” Why don’t they have to learn anything about technology? Or what is good technology?

The only people who seem to like SP are managers and SP consultants. I asked someone at my current employer why we used SP, and he told me that we got a good deal from our cloud provider. Not that we need it. Or that it is good at its intended purpose (whatever that is).

I have found that many things that are justified based on cost and not quality are usually not very good. When I was at BofA, we had to use some computer-based training. Everybody hated it, except our finance guy. When he was asked to justify it at a meeting, he said it was “cost-effective.” If the users hate it and nobody learns anything from it, how is it effective?

Another reason is that it is from MS. It’s the same old bait and switch. They sell it as something easy, and you don’t need an admin. But when you hit a wall, or want to do something advanced, then MS says you need an admin.

Some people have this weird blindness about MS. If you present them with another spreadsheet or word processor, they will reject it because it is not exactly like MS Office. But if MS changes the interface (like from a toolbar to a ribbon), people just go along with it.

Another reason is that the search capabilities in SP are terrible. This is important for something used to store documents. I have always gotten better search results on blogs and wikis. Content on wikis can be versioned, so why put stuff into SP? I think most businesses could replace SP with a wiki. I think a lot of wikis can do single-sign on, permissions, whatever. Bookmarks would not change. A lot of people love to move SP folders.

SP is a complex product sold as a simple product. It is a desert topping and a floor wax. If SP does not fit your business, you have two choices: change your life to fit SP, or replace SP. Desktop PCs, laptops, cel phones induced people to change their behavior and workflow. SP is not amazing enough for people to want to change for it.

At my current employer, search is so bad that a committee was started to come up with solutions. I went to one meeting, and I realized it was a waste of time. Someone suggested a SP site with links to all the other SP sites. For some reason, dropping SP was not considered. I do not get the hold SP has on some people. Yes, migrating would be expensive. But using it is expensive. And painful.

complex product sold as a simple product
impedance mismatch
vendor lock-in
bad search

You’re welcome.

2018-06-17 Update

I am still going through the tutorials on Purely Functional. There is nothing new to me in the intro videos, but I am getting practice with the REPL and emacs.

The project that I am on is downsizing. I might leave my employer and try my luck in the big, bad world. At one point I told my manager that I was interested in Lisp and Clojure. I probably mentioned that Lisp is one of the oldest languages and also not widely used. At a recent meeting, he said that I was interested in “legacy” technology. I plan on writing a post about why I am interested in Lisp and Clojure. While Lisp is one of the first programming languages invented, I don’t think it is appropriate to call it “legacy”. Lisp can adapt to any paradigm. “Legacy” has a negative connotation.

Part of the appeal of Lisp is that it seems like languages in the C family are becoming more like Lisp and Smalltalk over time. I have written this on this blog a few times. I mentioned it to some people once in Chicago, and they thought it was an interesting insight.

You’re welcome.

Command Line Passphrase Generation

I figured out another way to calculate passphrases, this time using the command line.

To cut to the chase, here is the command:

I found out about a command called “shuf” which according to its man page can “generate random permutations”. You can run this against a word list. Many Unix-based systems have a word list.

On my system, the word list is at /usr/share/dict/words, which is a link to /etc/dictionaries-common/words, which itself is a link to /usr/share/dict/american-english. You can also find one online here.

After you run the list against “shuf”, you need to put them all on one line. You can do this with the “tr” command (see man page here). You can use it to “translate or delete characters”. I want to replace the carriage return-new line combination with a space. In the command, we can represent that combination with either ‘\r\n’ or [:cntrl:]. I prefer [:cntrl:] because the only way to represent the space is with a space between single quotes, and I think using one less pair cuts down on ambiguity (“tr [:cntrl:] ‘ ‘” as opposed to “tr ‘\r\n’ ‘ ‘”).

Even though the word list is “american-english”, it still has some characters that we do not use, like vowels with umlauts or the letter “A” with a circle over it (I guess that is a “super-umlaut”). There are also a lot of words in there with an apostrophe followed by an “s”, words with upper-case letters and words with less than 4 characters. Taking out all of that takes us from a file with 100K words to one with about 26K words.

Here is the full grep sequence I used:

You’re welcome.