Two Main Principles
Two main principles of the Unix Philosophy [1] (a set of guideposts for ‘Unix programmers’ that started in the late 70’s and carries on today) are, ‘programs should...'
It’s the "anti pocket knife” approach to programming. It means that what makes a steak knife great is how well it cuts steak, not if it has a cork screw and baby scissors attached to it.
It also means that the knife should work well in all of the scenarios where you need to cut steak. A katana can probably cut steak better than most steak knives, but it doesn’t work well in situations other than “cut steak, without regard to eating it afterwards, on a flat, unbreakable surface in an empty room with plenty of space.”
This Unix philosophy was built with the performance of programmers in mind. How to make it easy...
A great (and controversial[2]) programming example of a tool and the implementation of the Unix Philosophy is a program called “left-pad”. It is a very small program (only 11 lines long) , and it can only do one thing: add stuff to the beginning of a word or number. As an example, if you wanted your computer program to make sure all your numbers were the same length, it could change the numbers 1, 23, 456, 7890, to 0001, 0023, 0456, 7890.
VERY simple, but because left-pad…
…it became a perfect example of a tool that follows the ‘Unix Philosophy’. As a result, this tool, created by a random programmer in Berlin, is used by millions of projects and websites, including Facebook.
I believe that the engine behind the Unix Philosophy’s drive for programmer performance is tool predictability. ‘Work well with others’ could also be described as ‘do what you always do, wherever you do it, and don’t surprise me’.
In fact, I think sometimes the predictability of a system can supersede the performance of that system. Imagine if a magical genie said in 6 months, he would give you the the choice of a 99% chance at winning $1 million, vs a 9% chance of winning $15 million.
In a logical vacuum, the correct choice is 9% of 15 million (since the ‘expected payout is $15mil * 9% = $1,350,000, vs $1mil * 99% = $990,000.)
But we don't in a logical vacuum, we have bills, rent, and mortgages, and we don’t get multiple chances with the genie. So, most of us would optimize for predictability rather than theoretical, amortized returns.
Choosing the $1 million gives us flexibility in other parts of our lives (we can immediately start to look for a new house, we can adjust retirement plans, we have buffer room if we’d like to change careers or want volunteer more, etc.), vs the rigid limbo we would find ourselves trapped inside as we waited for our roll of the dice in 6 months. Approaching the genie like a math problem only sees the ‘amortized expected payout’ as the benefit to optimize for, not realizing that the predictability is a psychological, human benefit all its own.
This is where it is important to note another principle of Unix Philosophy - the "Rule of Economy", which emphasizes the statement from the beginning of this post, “Unix was built for the performance of programmers”.
The “Rule of Economy” states, “Developers should value developer time over machine time”. This small statement is actually one of the most influential. It means the goal of Unix Philosophy isn’t making great programs, it’s making great programmers. It means the purpose behind the Unix Philosophy is changing/improving programmer psychology.
As humans we crave predictability from the moment we are born. Whole branches of child development psychology study short term and long term child well being in response to consistent and inconsistent stimuli from family members and environment. They all lead to a predictable observation: healthy growth as a child can be stunted by inconsistent treatment from abusive or negligent adults or environments. I think healthy mental growth as an adult is dependent on the same. This is particularly important in a field like programming with built-in emotional highs and lows.[3]
[1] Unix is part of the software that runs your Mac.
[2] Controversial because when he removed the tool, it broke the internet
[3]