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 Steward 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. 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.

May 2020 Update

I got a Pluralsight membership for a year. It was 30% off.

Right now I am going through some Java 8, Spring and microservices tutorials. My Java skills are out of date. After that, I think I will look at some Go again. There is one on microservices in Go that looks interesting.

I still would like to get through all the books in “The Little Schemer” series and then go through SICP. But sometimes I wonder if spending all that time on Scheme may have been a mistake. Perhaps I should have just been building some web apps in Clojure. Maybe going for “enlightenment” was not the best idea.

I have also been struggling with updating my laptop to the latest version of Ubuntu. I think the issue might be that I have snap disabled. There were a few stories on Hacker News that convinced me to disable snap (see here and here), and now I cannot upgrade.

For my next laptop, I plan on buying one with Linux pre-installed. I might get a Dell, but since they only offer Ubuntu I might go with another vendor. I am looking at System76 (submissions to Hacker News at this page) or Purism (Hacker News submissions at this page). They both offer systems with either Ubuntu or their own Linux. I think in both cases their OSes are derived from Ubuntu. Purism’s is PureOS, and System76’s is PopOS.

One thing I would really like is to be able to disable the mousepad. If I don’t attach a USB keyboard, I always hit the mousepad with my thumb. In all seriousness, who came up with that gesture anyway? It’s not like anyone ever lifts up their mouse and puts it down.

You’re welcome.

April 2020 Update

I spent time in April learning Go using the Go courses on Pluralsight. Pluralsight was free for April, so I decided to learn something new.

Starting function names with capital letters feels weird. It seems verbose. And using mutexes for concurrency feels like a step backwards. I don’t know if I will drop Clojure or the JVM for Go, but I will keep an open mind.

The Go tooling seems really nice. You can find race conditions before deploying. It has testing out of the box. It has a framework for robotics called Gobot. I do not know much about robotics, so I have no idea how Gobot ranks compared to ROS, which does have client libraries for Go (this is hosted on github, and does not appear to be part of the official ROS distribution) and Common Lisp (GitHub repo here).

It is something I will keep an eye on.

You’re welcome.

March 2020 Update

I have not made any more progress on “The Seasoned Schemer”.

My employer has offered some training in Java 8 and Spring Boot microservices, so I will spend time on that.

I may also start looking into building a web app with Grails. I would like to maintain my Groovy/Grails knowledge. I will probably build a quick app in Grails and then redo it in Clojure/Luminus. I will also look into making some rules with the Clara rules engine. One reason I want to make a web app is that I think it would be a good way to enter data for use by a rules engine.

You’re welcome.

2019-06-30 Update

I am up to chapter 19 in Simply Scheme. This chapter is higher-order functions.

I looked into a couple of other Clojure web frameworks this month. Someone did a presentation on Duct at the Austin Clojure meetup a while back. I might have to look at James Reeves’ presentation on Integrant at Skills Matter, since Duct is built on Integrant. (That presentation is hard to search for; if you search for “Integrant”, you get anything to do with “integration”.)

There is a tutorial on Duct by someone at Circle Ci that I was kind of able to follow. Until I saw this code:

I am not too clear what that does. Perhaps knowing more about Integrant will help. (There are also other presentations on Duct at Skills Matter here and here.)

There is also Clojure on Coast (Github repo here, website here). I think the aim is to be Rails for Clojure. I might try this out too. I would really like to work with Clara Rules, and I think a web app might be the best way to enter data.

Or I might just stick with Luminus.

You’re welcome.