Skip to content

Instantly share code, notes, and snippets.

@vu3rdd
Last active August 29, 2015 14:07
Show Gist options
  • Save vu3rdd/a884d4164bd39b94fd5d to your computer and use it in GitHub Desktop.
Save vu3rdd/a884d4164bd39b94fd5d to your computer and use it in GitHub Desktop.
less magic

Arthur C. Clarke said "Any sufficiently advanced technology is indistinguishable from magic".

As a programmer my job is to make my own use of computers seem less of a magic. Let me explain.

Note that I didn't say, I am here to make the use of computers by "everyone" appear less of a magic. I said about /my/ use of computers. That is, as a programmer/engineer, I want to know what is going on in my computer (or data center or whatever is the current definition of a computer) when I run a program. I also want to be in a position to explain what is happening to someone else, say another fellow programmer.

But modern programming (especially programming with the web) seem to make it appear as if it is magic. Let us say, I am a new programmer in a brand new project and we decide to use a particular programming language to implement a web service. The programming language itself is not new to me, but I am new to web programming. So I go about searching the web for blog posts explaining what the other fellow programmers use. A bunch of blog posts appear, old and new. I execute some commands like this:

$ lein new compojure addressbook
Retrieving compojure/lein-template/0.3.8/lein-template-0.3.8.pom from clojars
Retrieving leinjacker/leinjacker/0.4.1/leinjacker-0.4.1.pom from clojars
Retrieving org/clojure/core.contracts/0.0.1/core.contracts-0.0.1.pom from central
Retrieving org/clojure/core.unify/0.5.3/core.unify-0.5.3.pom from central
Retrieving compojure/lein-template/0.3.8/lein-template-0.3.8.jar from clojars
Retrieving org/clojure/core.unify/0.5.3/core.unify-0.5.3.jar from central
Retrieving org/clojure/core.contracts/0.0.1/core.contracts-0.0.1.jar from central
Retrieving org/clojure/clojure/1.4.0/clojure-1.4.0.jar from central
Retrieving leinjacker/leinjacker/0.4.1/leinjacker-0.4.1.jar from clojars 
$

What is going on here? The command I executed, creates a template for a web application using the compojure library in Clojure. To do that it fetched some other libraries from a central repository of jars (jar or the Java Archive is the way Java and Clojure libraries are distributed). What are those jars being pulled in? I have no idea and hence I cannot reason about it and hence it is magic to me (when it work).

Before I did this sort of a thing, I was a C programmer, I still am and reach out to my trusty old gcc. I was working with linux kernel and C and shell and Makefiles. Life was simple. C was completely described by one book -- The famous K&R C Book. After working through the language a bit, you get the hang of it. Yes, there are undefined things in C, but you get used the warts of the language. Tons of software has been written in C and it works just fine. One can keep the whole thing in one's head. I never refer to K&R while writing C. All the other libraries I need can be easily installed by the OS package manager or from the source. Most libraries come with a manpage (yeah, not those incomplete markdowns that you see on github these days). I also have a good mental model of the computation and the machine.

What we call programming /today/ is not programming. It is about calling one API or the other. How many of us thought about a way to do something or looked up and coded an algorithm in recent times? Abstractions are good. But abstractions can also be misleading (and can make things look like magic, the thing I don't want), especially if it is not well documented. I also like it when my application is self contained in one small binary. It is easier to have less parts than more, especially if everything is a moving part. Take any modern language run time and throw dynamic linking at it and one has hundreds of libraries (all hail libraries and dynamic linking in the name of "code reuse").

A lot of programmers advocate that we learn typing. Yes, touch typing is good and essential. I spent some time in ~2011 learning touch typing and it is well worth it. But typing speed has rarely been my bottleneck. Ability to think and come up with elegant solutions have always been my bottleneck.

Good abstractions /and/ less magical software is possible. There are some great examples. Any /type checker/ of a strongly typed language compiler is a good example. The type checker can be explained in a few beautiful sentences or equations. Yet, what it does is close to magic, if you see it do its job. Unix is another great example. Plan9 is another. Simple beautiful ideas.

I believe there is good correlation betewen the developer hygiene and the quality of the software produced. Or in other words, if the development setup and practices are clean, then the chanced of we creating better software is high (IMHO).

Java and Python packaging systems seem as if they have been designed by and for masochists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment