Programming through the lense of phenomenology. Can you guess what a compiler is? Programs all the way down.
Before we attempt to define what programming is, let us take a little detour and look at what a program is, to put you into the correct state of mind. We’re going to mostly re-use the definition of a program from what is a build system, the previous instalment of the What is series.
What Is A Program?
For our purposes today, a program is something that runs on a computer. You may also call it executable or binary. It does not really matter what it is, as long as it conforms to this simple definition:
- Read some input.
- Produce some output.
Again, we don’t really care how. Graphically, this gives:
It is pretty common for programs to have a distinct category for their inputs1 which is called configuration. This distinction does not matter much to the program itself, but it is an important one for us:
So, a program is something that takes some configuration, inputs of some kind and usually produces some output.
Composing Programs
It must be noted that programs can call other programs. This is nothing exceptional, it is even very common, and is called composing programs together. It looks like this:
A program is free to provide any required input to other programs it calls, too! From an external point of view, the result is still a program. You provide some inputs and the composed program gives some output back:
Squint a little bit, and it starts looking exactly as our initial definition for what a program is2:
Special Programs
Now that we’ve covered the very basics, let us look at a particularly special subset of the universe of all possible programs: namely, those that output other programs, and particularly those for which these produced programs have a behavior that depends on the input of the special program:
If this sounds a bit convoluted, don’t worry: the good news is that you probably already know these programs under their common name: they are usually called compilers!
They are programs like any other: they just have yet another category of input called code, which they know how to turn into programs, binaries or executables.
Compilers & how to please them
Thus, if programs are what we decribed above, my phenomenologicaly tongue-in-cheek definition for what programming is becomes:
Programming is about fiddling with the inputs of a special program until it outputs a program that behaves as you want it to.
Voilà, that’s it for today’s foray in over-thinking. (Or was it under-thinking?)
A fresh look at build systems
What we learned above lets us look at what a build system is with fresh eyes. Build systems are a program composition that does everything that is required to turn your code into a useable output:
You might ask what are dependencies and what is a dependency manager?! This, among other topics such as dependency trees, dependency conflicts and resolutions is a subject for another day.
Enjoy your programming today!
-
This is how the field of category theory was born. No. Sorry. Just kidding. ↩︎
-
Remember, I’m obsessed with the shape of things. ↩︎