I have written computer programs for more than 20 years. When I started programming, I had this idea that programs were written for other people. They were to make a product you could either sell or that would be useful for a lot of people, making you slightly famous in a particular crowd. I was young too so I had some very funny beliefs about exactly which crowd would be excited about what I was writing. Often, the truly fantastic belief that the story would end with: and Kaitlyn will kiss me. It turns out the secret on the Kaitlyn front was just asking her if she wanted to make out at some party. That worked, but it was anti-climactic.
I’ve done enough programming that I am a bit set-in-my-ways and am entering my I-don’t-like-new-things era. So nowadays, I find myself writing lots of what I’ll call “personal programs”. Programs that I have no intention of ever releasing that I use just for doing my computing in a way that I think makes sense. I’ve found writing these programs liberating.
Usually, when you write a program for a general audience, you have to be concerned with things like how general the program is: will it work in these common scenarios? What about on data that looks like this? If a user does something unexpected will something, well, unexpected happen? Most of your programming time is really dealing with all these edge cases. The last 10% takes 90% of the effort.
When you write a program for yourself, you are free from such constraints and it is marvelous. I’ve found that these personal programs are far more useful and they take far less time to develop than even searching for and trying out products that have already been created.
The code ends up cleaner too because it is perfectly permissible to cut out any complexity that makes things more “usable”.
I can give an example from this week. I went looking for a text editor, a simple no-frills needed editor, that would let me - get this - edit plain text in a browser from anywhere and save progress remotely. I had just been using Github, but I found it annoying to have to click the commit button to save at which point, I would be sent away from the editor.
I searched far and wide for such a thing. And, while I am sure it exists, I could not find just a simple text editor that functioned more or less like a Google Doc. I didn’t want to use Google Docs because the word processor distracts me when I’m writing, and there’s no need for Google to know all my secrets. I didn’t need collaboration or anything like that. I just wanted to be able to easily edit the same text file whether at work or home.
So in approximately 4 hours I wrote one, and it’s great. Probably one of my favorite applications I interact with now on a daily basis. My daily word count is up massively since I started using it. It does what I want and nothing else. Because I don’t have to deal with unexpected use cases, etc, the code is small so it is easy to change things if I don’t like something or want to add something new.
Here’s my “stack”:
An Angular frontend which is a <table> with a <td> marked as contenteditable. It can search the document for parts formatted as headers (it’s an org-mode document so it is lines that start with an asterisk) and generates a list of buttons I can use to jump to different headers. It also has Save and Load buttons which call the “backend” to save and load the file. There is also a word counter that it can send to the backend to track progress.
The “backend” is a single Python script that uses Falcon to take Save and Load requests for a single file. The file path is hard-coded into the script because why not? If I ever want to load a different file, I can just change the script. Easy! There’s no database or anything. The backend also takes requests to save the current days word count and outputs to a JSON file a dictionary that looks like YYYY-MM-DD => WORDCOUNT.
The server is Apache. It serves the Angular site and proxies the backend (running under Gunicorn) on a separate port. Both are on the same AWS Lightsail instance (lowest possible specs).
That’s it. I had fun working on it and it has greatly improved my productivity. It’s useful to work through the things I didn’t have to worry about because I didn’t care about anyone using it.
Security. There is no Database. The hashed password to access the file is just hard-coded into the script itself. No need for multiple users so I don’t have to think about real authentication. It’s just a matter of: “do you know the secret?”
Boilerplate. Nothing refreshes automatically because I can click a button. This sounds dumb, but it actually cuts down on a lot of Angular boilerplate.
The text editor is stupid simple because I don’t need to let anyone customize anything. If I want a different font, I can just change it in the code.
If I was to use another online text editor, to be able to jump to headers (my favorite feature of the text editor) I would need to hope it had some sort of org-mode support or maybe re-do the document in Markdown or whatever it supports. I knew I was never going to use asterisks in the main body of the text so I just found the headers using a simple regular expression. No need to have an escape syntax, etc.
Anyway, I greatly enjoyed the experience of having a problem and fixing it myself despite someone else having developed a more general solution. Specialization has obvious rewards for economies, but there is something deeply satisfying about avoiding it.
A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyse a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects.
Robert Heinlein