2021-02-07 Update

I completed an introductory Kotlin tutorial on Pluralsight.

Kotlin seems like an okay language. The one tutorial I went through did not touch on Kotlin Native, or Android, or web programming. I get the impression that Kotlin is mostly used for Android. I have little interest in mobile apps. And from what I read from a reliable source, Android apps are getting more complex (see here and here).

So I might put off learning more Kotlin for a while. Kotlin Native looks very interesting, but it is not covered at Pluralsight. Kotlin Native might be a less-painful way to do embedded programming. It would be really interesting if it could be used in robotics. I think that would open up robotics programming to a lot of developers.

WRT the language itself, I am kind of neutral. Every time the instructor said, “Here is something you can do in Kotlin that you cannot do in Java”, it was always something you could do in Groovy that you could not do in Java. Java is adding more features all the time.

I have started going through some of the “What’s new in Java X”, since honestly my Java skills are out of date.

There was a conference at CME about JVM languages about 10 years ago. One Groovy programmer said that as Java got more features, Groovy might become superfluous. To a certain degree, that seems to be happening.

Granted, it might appear that way to me since the Austin Groovy/Grails Meetup stopped meeting long before everything else stopped. And Ken Kousen does not mention Groovy a lot in his newsletter, and there has not been a new episode of the Groovy Podcast since 2020-08. I like Groovy, but why fight the tide? If Ken Kousen is spending time on other things, perhaps that is a sign of the times. I am already shaking one fist at the clouds by looking into Lisp.

One thing that I think held Groovy back is that you really have to know Java in order to use it. Knowing some C will probably help you with Ruby, but I think Ruby shields newbies from C better than Groovy does with Java. I think this is also true of Kotlin, but not as much.

Granted, from what I heard about the origins of Groovy, making Java easier without necessarily replacing seems like it was the point. But for someone who is new to JVM languages (or programming altogther), they kind of have to learn two languages at once. Plus when a lot of people get tired of Java, they tend to stay away from JVM languages altogether.

Maybe I should have found a way to keep the Austin Groovy group going.

I was hoping to get through as much Kotlin and Java on Pluralsight as I could before my subscription expires. But I might just renew it for a year so I do not put as much pressure on myself, and I can also spend time on other things.

Like Clojure. I got a few feelers about Clojure jobs, so I think I will get back to going through the functions in the core Clojure API. I made a list of functions that seem to take functions as arguments or return functions, or take predicates. I think I will look at some of those, since those are the functional parts of Clojure.

I found a tutorial on Clojure Spec (article here, Hacker News comments here), and some of it was new to me. It looks like Clojure is starting to encourage keywords to have namespaces.

You’re welcome.

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/

 

2020-12-28 Update

There was another Emacs meetup in early December. The turnout was pretty good. I think there were six or seven people online.

One of the presentations was about building regular expressions in Emacs. A few people were frustrated that Emacs reg-exes are not compatible with Perl or Java reg-exes. I don’t remember too much about the other presentation topic. I am not really interested in dealing with package managers right now.

I pointed out after the presentations that the 2020 EmacsConf had just happened the week before. I asked if anyone knew about it, but nobody did. I only knew about it because I had looked at Sacha Chua’s website a couple of days before the meetup. At some point I will go through some of the videos that look interesting to me. Many of them are 10 minutes long. There are quite a few on org-mode.

On the front page there are links to EmacsConfs for prior years.

One of the 2020 talks was a guy who used Emacs to write a novel. I wonder if it has or will get published. I have never written or published a book; I thought that the publishing industry revolves around MS Word (which I hate). Norman Richards was at the meetup, and he has published a few books (a page about him on O’Reilly’s site, and a couple of books at Manning that he contributed to here and here). He said that not all human editors require MS Word.

Afterwards, I ordered the org-mode course from Udemy. It was on sale and they said it never expires, so why not?

You’re welcome.

2020-11-29 Update

I attended the local Emacs meetup a few weeks ago.

I mentioned I am getting into Org mode. Someone said I should look at Org-Agenda. There is also Org-roam which attempts to replace Roam in Org-mode. It looks interesting. I will put it on my ever-expanding to-do list.

We also talked about how there are a lot of emacs start kits out there, like Prelude, Doom Emacs and Spacemacs. I think there are a few others. I noticed that a high percentage are based on evil-mode. The appropriately named Evil mode is a vi emulator running in Emacs. I wonder if there was a push a few years ago to get vi people to move to Emacs, or if something happened in the vi world to make some people look for an alternative.

I first got into Emacs about 20 years ago at my first programming job. All the developers had Sun workstations. Someone showed me vi, and it was (and still is) bizarre. I think the idea of modes is stupid (at least the way vi implements them; “modes” in Emacs are more like add-ons or plug-ins for other apps, and you can run several at once). Someone showed me Emacs. I said “What happens in Emacs when you press the ‘a’ key?” The guy said: “The letter ‘a’ is added to the file whereever the cursor is. Just like almost ever other text editor on the planet.” I told him to show me more Emacs.

If you had to toggle a database between read-mode and write-mode, you would quickly find another database. Vi is like the Unix version of the Microsoft paper clip: “I see you are editing text. Do you want the text to actually appear in this file?” Yes, that would be great. And to all the people who say they use vi because it is on all Unix systems, that is not too different than people using Windows because that’s what the computer came with, or using Office because everybody else does. That’s not better, that’s just inertia.

WRT which is better: Emacs can do vi, but vi cannot do Emacs. I think that settles it.

I did start making a few tables in org-mode. My tire pressure sensor kept going off, but it does not tell me which tire. So every time I filled my tires up, I would fill up a tire, turn my car back on, and see if the sensor was still flashing. I would repeat that for each tire until I was clear. It only took a couple of times to figure out it was the same tire. But I made a list with the date and which tire. I realized one way to learn org-mode is that every time you have a problem, ask yourself if org-mode can help. So now I know a little about tables in org-mode.

I still have an org-file that I am using as a to-do list. I think that every month I will update it by getting rid of all the tasks that are done, and archive it.

There is another Emacs meetup this week. Perhaps knowing more Emacs users will help me in my goal of finding a job where I do not have to use any Microsoft software every. Keep in mind I am not an Apple person; I have realized that when I tell people I do not want to deal with MS, they just assume that I am an Apple fanboy.

I am almost done with the Go tutorials on Pluralsight. I have one more to go through, then it is back to Spring and on to Kotlin. But I might take a detour into the one Elixir course. I am still tired of typing “if err != nil”, but I found my chi-balls, so typing does not hurt as much.

One of them took me a while. The instructor was using MySql, and I decided to use Postgres. I went to the list of Go SQL drivers and I used pq for a while, but since it is deprecated I switched to pgx. I had to upgrade my version of Go, and I had to change some of the code for the driver. With pq I could just use the standard Go libraries, but with pgx your code has to become pgx-specific.

At some point, I plan on writing more about why I am interested in Lisp, and also thoughts on my ideal job. Before I got the job I am at now, I interviewed with National Instruments. I thought it went well, up until the final question. He asked me to describe what I thought would be an ideal job within the company. How can you get that wrong? Maybe I was supposed to say that I would have to work there and see what they have to offer and what it is like before I could answer that question. Or maybe I did, and for some reason that was the wrong answer. Or maybe I said something that made him think I was crazy. But lately I have been thinking about that question, and I will start writing down some answers.

You’re welcome.

2020-10-06 Update

Time for another update.

I have not spent any time at all on the Go tutorials in the past few weeks.

One reason is that I am finally reading the Dune books. I tried to read it years ago, but did not get very far; I probably got a copy from the library and put off reading it.

I saw the David Lynch film, which I still think is bizarre. Patrick Stewart leading men into battle with a pug? Sting in a metal diaper? I did not see this; I was not here. The 2001 and 2003 adaptations were pretty good. At some point I want to watch Jodorowsky’s Dune.

Just to pick a few nits: The pug shows up several times with multiple members of House Atreides before Patrick Stewart carries it to Sardaukar oblivion. There is no mention of said dog in the book. And “weirding” in the book has NOTHING to do with sound. When David Lynch tries to blame the studio for meddling, he is full of it.

I was on IMDB after binge-watching Friends for the 5 millionth time, and I saw a preview for a new adaptation of Dune. I know the whole point of previews is to make you say, “This will be amazing”, but I think this will be amazing. Ronan Dex as Duncan Idaho; who could ask for more? Taking¬† two films to cover the first novel is a wise decision.

So I got all six of the original novels and started going through them. I am done with Dune, and have started Dune Messiah. I am honestly surprised that the Dune series became as popular as they have. I know that any franchise just sticks you in the middle of its world/universe, but that is REALLY true of Dune. The glossary at the end really helped. I am reading these near my laptop so I can look up terms I do not know on the Dune Wiki.

Back to Go:

One thing that was bugging me about going through the Go tutorials is that my hand started hurting from all the typing. Then my keyboard started dying; unlike most emacs users, it was not my wrist that gave out, it was my left control key. So I got a new Insignia keyboard. These things are like butter. I went to Best Buy and got three more.

Plus, maybe I just don’t like Go. I can see why functional programmers say they are sick of writing for loops. While it’s great that Go functions can return two values so you can catch potential problems, I am also getting sick of writing “if err != nil”. And I do not like that Pluralsight instructors do not spend more time including automated tests. I am not a unit testing fundamentalist, but tests are always good.

Granted, one of the creators of Go is Ken Thompson. Along with Dennis Ritchie¬† and Brian Kernighan he invented Unix and C at Bell Labs in the late 1960s-early 1970s. Another creator is Rob Pike who came to Bell Labs later. (Go has a third creator: Robert Griesemer; I never heard of him, but he has KT’s stamp of approval; who am I to argue?) I don’t know if you could write an OS in C, but it seems like Go is C 2.0. Given who created it, this is not a surprise.

I am also seeing the appeal of Lisp a bit more now. Lisp is more uniform. In a language with functions and primitives, things happen in different orders, particularly math. “2.add( 2 )” is more typing than “2 + 2”, but “2.add( 2 )” is closer to how most functions are written in Go. (“add( 2, 2 )” is another way to do it.) Maybe that is why Lisp is so jarring at first; it’s not just the parentheses, it’s that everything is different. This is not specific to Go.

There are a lot of things that I like. For example, the “defer” keyword is a great idea. If you open a file, database, or some other resource, you put a statement or block starting with the word “defer” right after it to close the resource.

The defer statements/blocks are not executed when the function is executed; all the defer blocks will be executed when the function they are in is done executing. I think the defer statements/blocks get put into small functions and are put on the stack at run-time. This backwards post-function execution happens even if the function has an error. It looks like a more elegant way to do try/catch/finally, and since you put the “defer” to close right after the open, you could potentially prevent all resource-related memory issues. Not closing database connections and file handles seems to be one of the major sources of memory issues in Java, although try-with-resources does help.

When I was at Bank Of America, there was a C/C++ programmer who gave a tip on memory management: Allocate everything you need at the beginning of a function, and de-allocate it all at the end. For a while his main responsibility was re-factoring in-house apps that crashed a lot because a lot of devs were bad at managing memory.

Also, the idea of making fast apps with low memory usage is very appealing. I will get back to Go soon.

You’re welcome.

Starting Org Mode

I have started trying out Org mode.

Granted, this is not the first time. But this time I am going to go slowly. I keep reading posts from people that Org changed their life, and my life certainly needs changing. My ideal job would involve no Microsoft products at all (do not assume I am an Apple user when I say that). I need to learn more about the useful tools if I want that to happen.

So far there is not much to report. I am making a text file with commands and keybindings as I learn them. I will eventually put it on my site for my own reference. If other people find it useful, that’s great. At every job I have ever had, there are always a lot of people who want to keep everything in their heads. It’s like there is some contest to see who can keep the most mental plates spinning. I really hate playing that game. Hopefully, Org mode can reduce my cognitive burden.

You’re welcome.

Emacs Tricks With Go

I am still going through some Go tutorials. I am using Emacs as my editor.

There are some things that the go mode does not handle well; I don’t know if this is a shortcoming in the mode, or if I am using an old version, or if there is some conflict with another mode I am using. It’s actually a minor point.

It does not indent switch statements the way I want. All the “case” statements and everything inside them is indented as far as the “switch”. Hitting tab does not work. I have to hit “space” for every line. It gets pretty tedious.

But I found a way to do it:

  • set-mark-command (C-@) and highlight the region
  • indent-rigidly (C-x TAB)
  • hit the arrow key as many times as I need. This will indent all the lines the same amount.

 

I also learned something about opening files. I had a directory with a file called “time.go” and “showtime.go”. When I tried find-file (C-x C-f), or switch-to-buffer (C-x b), it kept picking up “showtime.go”, even though I wanted “time.go”. I was able to open “time.go” with find-alternate-file (C-x C-v). Then I had to re-open “showtime.go”. It’s not a perfect solution, but it worked for me.

These commands are not unique to the Go mode.

You’re welcome.

August 2020 Update

This month I have been going through some Go tutorials on Pluralsight.

Actually, just one, but it has been taking a while. The instructor has this (IMHO) bad habit of wiping out the contents of the file he is working on and replacing them with new content without warning. And sometimes he does not go over helper functions that he writes and are called from his main functions. It makes it frustrating.

I think I will keep an eye on Go. I bookmarked an “awesome-go” repo (note to “awesome” repo maintainers: These are a lot easier to follow when the libraries are categorized, and the lists and sub-lists are alphabetized). I started looking at a web framework called Buffalo, but to install it you have to install npm and other Javascript garbage. I hate Javascript and would like to keep it out of my life as much as possible.

(Before anyone goes on and one about how I should just accept that you have to deal with Javascript to do web development: I use Office and Sharepoint every damn day at my job. And not by choice. I am getting tired of doing things because I have to. I want to start doing things because I want to.)

I was thinking of ignoring Go, but I found a post on the Java subreddit about the latest Jetbrains State of the Developer Ecosystem survey. Granted, the respondents are users of Jetbrains products, so it is not representative of all developers. But I decided to take a look. There is a section about Go. Buffalo is not the most common web framework. The winner is one called Gin (here are links to the website and github repo). I might look into this later. The github repo and the website both state that Gin has a “martini-like API”, which on the surface is a meaningless statement. I googled “golang martini”, and apparently there was a Go web framework called Martini. The repo page says it is deprecated, and the last commit was in 2016. Note to whoever is doing the marketing for Gin: Comparing your project to a dead project is not the best selling point.

There is a rules engine written in Go called Grule. The main reason to build a web app is to work with a rules engine. My day job involves a proprietary rules engine that I am kind of sick of dealing with. (Thanks for the opportunity, multi-national corporation, but at some point I will probably move on to something different.) There is also Drools (written in Java) and Clara (written in Clojure).

One issue I have at the moment is that the Grule page has this tidbit: “Business Analysts can easily read and verify a set of rules.” Just about every technology that pitches itself as something that “the business people can use so you don’t have to be a developer” never lives up to that promise. Score one for Clara.

You’re welcome.

July 2020 Update

This past month, I spent more time going through tutorials on Pluralsight. At least, when I have time. There was a release for the app I work on at my job, and there were a lot of defects.

Some of the tutorials take a while. I like to type in the code as they do them. But I might still be going too fast for the material to sink in. Right now I am going for breadth rather than depth. I don’t think I want to do Java forever.

Right now I am going through some Spring Boot tutorials. So far it looks interesting. I am a bit leery of doing anything Spring related because of the database abstractions. Sometimes it can be hard to find the SQL that populates a list. There are all the implementations that call controllers that call DAOs, some of which call other DAOs, and then the SQL is being pulled out of some XML file. I get tired of the whole “the toe bone is connected to the foot bone is connected to the ankle bone is connected to the shin bone” routine. I just want the SQL that populates some list.

Frankly, the app I work with is not using the most current practices. I am grateful to have a job, but I feel like the world is passing me by. But sometimes I wonder if the app I work with can use a lot of the new Java features. You can’t use the Functional Big Three (map, filter, reduce) while reading or writing from a database, because that is a side effect. And with the application I work with, there are a lot of loops within loops. And then sometimes even more loops inside those. Can the big three handle nested data structures? I haven’t done as much Clojure as I would like, but in the twitter-retriever app I did some calls to doseq and a LOT of loop-recur.

On the other hand, putting logic in the views has been a bad idea for a while, and does not require anything from Java 8 to change.

Other languages I am thinking about looking into are Go, Elixir and Kotlin.