The true cost of knowledge

A while ago I was pulled into a discussion about the speed and magic optimizations of a particular container within the standard library of a coworker’s programming language of choice. They were claiming how there is a special container that somehow magically performs better than a normal array when it’s used for adding a number to every element within that container.

For some reason in a corporate world you will always find such pieces of wisdom floating around. The standard library is treated as some kind of a magic box that performs an order of magnitude better than whatever you could ever program yourself.

I don’t believe in witchcraft though. A memory access is a memory access and unless you figure out a more efficient algorithm for performing your operation, this magic container is not going to perform any faster. So I convinced this person to write an actual program that will compare their magic container with an every day array. Lo’ and behold my favorite optimization technique that could be summed as “when in doubt use a for loop and iterate over array” proved to be right. The thing compiled into more or less the same thing, while an array solution performed slightly better on average.

It just goes to show how the software industry excels at regurgitating myths instead of sitting down and thinking really hard about the problem at hand. I partially blame this culture on the pervasive money making industry, which likes to spoon feed scholars with random bits of trivia instead of actually making them think. You also know it under the name of higher education.

When you know nothing at all, being spoon fed the knowledge is a great way to become aware of the vast field around you. As soon as you gather enough knowledge to be dangerous, you start to realize how Gell-Mann amnesia effect is a real thing and most of the world is broken [1].

Since young people are being spoon fed knowledge for a tremendously large chunk of their life, they are prone to simply accept random pieces of “knowledge” that they found on some random blog as facts and rules to live by. These bits of knowledge are then accumulated and moving forward through osmosis, until it gets to the point where people believe into voodoo computer operations that are somehow inaccessible to the mere mortals.

How expensive is knowledge?

If you live in a relatively well organized society, then the knowledge is actually free or at least priced at the point which you could consider as free.

Formal education in my country is “free”. It’s not quite free as we pay for it with a relatively high taxes, but it’s free in a way where anyone could be attending any school regardless of their income or social status. All of the university lectures are also public and free to attend by anyone from the streets. That usually doesn’t happen, but it’s still an option for someone that is willing to listen and learn something new.

Despite spending more than 15 years in school, I didn’t really learn much there. It’s one thing learning about the internals of this specific thing that you are interested in, whereas abstract learning about general stuff was not that interesting for me. I was introduced to a few new concepts and I learned a great deal of math which I never used later on, but that was pretty much it [2]. It was as if my brain was made out of Teflon and whatever they threw at it didn’t stick.

The main problem that I see with the modern formal education is in that they are trying to compact the ever growing knowledge into chunks that you should memorize and repeat when asked, which keeps you busy so your parents are able to work. They treat your brain as a hard drive for dumping facts, while in reality it is a self-programmable high performance CPU with infinite potential that is preserving data rather poorly. In case you are wondering, this wordy description means that your brain is far far away from the dumping ground of facts, but it excels at making abstract connections and general never seen before type of problem solving.

As Richard Hamming put it in his excellent You and Your Research talk:

But I am inclined to believe that, in the long-haul, books which leave out what’s not essential are more important than books which tell you everything because you don’t want to know everything. I don’t want to know that much about penguins is the usual reply. You just want to know the essence.

Richard Hamming

Learning facts and dates when somebody discovered something is not that useful in a world where all this knowledge is 1 click away. It’s good for those occasions when you have to mingle and impress the audience at your gala table, but other than that it’s mostly taking away your brain space that could be used for solving more important problems than mere memorization. The amount of knowledge absolutely exploded in the past 100 years and you cannot possibly cram all that junk into that tiny brain compartment.

Of course, this statement will enrage the people from the land of the free who spent thousands on their education, while at the same time most of the things are better explained elsewhere. I had a pretty good math teacher, but you can find thousand times better lectures on the internet made by strangers who are educating others from the goodness of their heart, such as 3blue1brown. And best of all, they are free.

Where does the knowledge come from?

Most of the things that I’ve accumulated over the years came from this mildly amusing idea that we call the internet. I had English classes in school, but I actually learned English while playing online games and mindlessly browsing internet. Nowadays I am mostly communicating in English, despite not being a native speaker. Who knew that wasting time on the internet would be so useful one day? I most certainly did not.

But, where did you learn about computer stuff?

  • I learned how to program via shitty online tutorials and building useless websites. Building a crappy website with just your mind and a text editor was a mind blowing experience.

  • I learned how to manage Linux servers by tinkering with an old crappy laptop and endlessly broken Linux system. Also I pushed those useless websites there and played with the system until the website appeared in the browser.

  • I learned the rest by reading books on a particular topic that interested me and later on talking to my coworkers.

The actual knowledge came from spending thousands of hours in front of a computer just trying things out and playing with already discovered concepts. I may as well formulate this insight as:

great work = spoon fed knowledge + experience + magic sauce

The parameters of this equation are also listed in a chronological order, as they appear throughout the life:

  1. Spoon fed knowledge: obtained through formal education, reading books, online tutorials and picking brains of experienced people.

  2. Experience: given enough spoon fed knowledge and plenty of hours, that knowledge is turned into experience. Suddenly you are mildly aware of what works and what doesn’t based on the past scars.

  3. Magic sauce: a mix that consists of your own thoughts, experience and inspiration that brewed over the years. You might as well fit this into the realm of creativity.

You are free to throw some insanity into the mix to make it pop.

Writing this question into your search engine of choice will provide hundreds of thousands results for the list of top 10 books on “X” that will help your career and change your perspective forever. All of those lists are accompanied with a tiny note telling you that the author is associated with a “$LARGE_BOOK_STORE” and buying them through their links will somehow help them run their blog in order to publish more of those useful lists.

I checked my library of dead tree items and found 15 technical books which I bought and read multiple times over the past few years. Most of them were pretty good and they were extremely valuable for my career. Reading a deep dive into the topic you are interested in is a great investment and you should definitely read as much as possible.

Still, I can’t really suggest you to read any of those books that I bought. They were all a great investment up to some point. Then one day you reach the level when you realize that the knowledge from those books only apply up to a certain point, and sticking to whatever the book authors have to say is actually a bad idea for your specific case.

Sometimes you even realize that what the book authors are preaching is actually harmful and is in fact hurting the entire industry by poisoning the bright minds with false ideas. Like the advice from a well known person B. “Sell Books” M. that is preaching how the comments are harmful and a big code smell.

The advice is totally fine and yes, you should most definitely structure your program in a way where the code is self explanatory. Then one day you happen to work on one of those multi million lines long codebases where people kept this advice close to their hearts. After a few years the original developers are long gone and nobody knows how the damn thing works and why a certain architectural decisions were made. Nothing makes sense and the documentation does not reflect the current state, but the code sure is clean with none of those smelly little comments.

The zealots will argue how people misunderstood the book and that it only pushed people towards improving the structure of the program as opposed to writing lengthy comments. The result was naturally the exact opposite. People are hesitant to write comments because writing comments has become this big bad wolf and you should be afraid of the big bad wolf.

The best code that I have ever written to this date contains a lot of comments. In fact ~30% of that particular codebase consists of comments. The feedback that I got from the current maintainers was mostly on how easy it is to jump into it and update the business logic, because all the unknowns and possible future pitfalls are explained right there. So there is that [3].

In comparison to math, the software world is not a really well defined thing. In math you have these long equations full of weird hieroglyphs and as long as you put the right stuff in, you get the right stuff out. Everything is exactly defined and proven and there is no misconception on how the things should behave (unless you are trying to divide by zero, then all bets are off).

The software world feels closer to creative writing. Sure there are rules and best practices in regards to how the hardware behaves, but when it comes to actually defining the structure of your program, it’s no longer a well defined thing. Maybe we should write it like this or maybe we shouldn’t - who knows? In the end it all boils down to experience and personal preferences of the author, which is why we still have these decades long debates about comments, tabs vs spaces and other nonsense.

Do I consider that particular book a bad book? Yes and no. It was definitely helpful for me when I’ve read it for the first time, as it made me think about the structure of my programs and how that structure affects other people in the team. Still, I don’t consider it as the holy bible of programming type of book that everyone should read and stick to whatever is written in there. There is a lot of fluff and bad advice that conflicts with the examples that are presented there. As long as you treat it as just another opinion piece or tool in your toolbox, you will be just fine [4].

But if you truly care about your craft, then I do have a special book for you in mind. It’s called The world through the eyes of a sloth that I just happen to be selling right here and you can buy it for a mere $39.26. You can’t really call yourself a professional without reading this one, that’s for sure.

Ok, let’s not get derailed with bashing the book sellers here. Now where was I? Ah yes, the cost of knowledge. How much do you think those 15 books actually cost me?

Given the average book about programming costs ~$32 that would be:

$32 * 15 = $480

Even if you don’t live in a country with inflated engineering salaries, this is a great bargain. Gaining this amount of experience on your own would cost you 10-20 years of full time programming. On the other hand you can gain it in a couple of years that reading this amount of books will take you, together with practicing the things that you have read.

In reality the actual cost of those books is even lower. Some of the best books out there could be read for free on the author’s website. Libraries are still a thing. If you pull out your pirate hat from the closet then you can actually get all of them for free. Either way, if you have the funds please compensate the authors for their hard work. Writing lengthy books or articles like this one is hard and time consuming.

In essence of this section, even if you don’t have the “right” formal education and all odds are against you, you can make it just fine in the modern world as the knowledge is essentially free and just waiting to be picked, but you do pay for it with years of study [5]. Ignorance is more expensive than a book.

Mastery

If the knowledge is free, then why do we have these weird office debates all the time? Why do educated people believe in the magic of the libraries for their programming language of choice?

Why rarely anybody goes from the first principles and really thinks about the stuff that happens under the hood when your for loop iterates over an array? What happens if your for loop iterates over a linked list? What if it iterates over a magic array like container?

I don’t know. I guess passing the knowledge from the teacher to scholar is hard and despite all the technological advances we didn’t quite figure it out yet. And it’s not only that passing this knowledge is hard. Some teachers are just poor at their job and some scholars are not willing to listen and prefer to live in the world of magic libraries. Transforming this ever growing knowledge into the actual understanding is a tremendous amount of hard work. It usually takes years before you really get it and master the subject [6].

On top of all that, the software industry is riddled with used ol’ vacuum cleaner salesmen that are trying to get their part of the pie. They keep making these beginner friendly Javascript courses that are promising to turn you into a master craftsman in a matter of hours.

It’s a crowded bar where everybody is yelling, but nobody has anything of value to say. Filtering out that noise is hard and it again takes years before you are able to recognize signal from the noise.

So how does one become the master of their field?

All I want to do is make a better sushi. I do the same thing over and over, improving bit by bit. There is always a yearning to achieve more. I’ll continue to climb, trying to reach the top, but nobody knows where the top is.

Even at my age, after decades of work I don’t think I have achieved perfection.

Jiro the sushi master (at the age of 86)

You live and you learn.

Notes

[1] Gell-Mann amnesia - a phenomenon of experts believing news articles on topics outside of their fields of expertise, even after acknowledging that articles written in the same publication that are within expert’s field of expertise are error-ridden and full of misunderstanding.

A younger me had a programming problem and so I searched around for the solution. The first link was this great site called StackOverflow that was filled with great solutions to my problem. Amazing.

One day I woke up and realized that most of the answers on that site were actually just plain wrong. While the answers posted there did solve the problem that the asker was having, most of them were never stating the pitfalls of their approach. If you don’t know a lot about that particular topic, you don’t even realize that you are copying a flawed approach into your production code.

Until one day your program is crashing, due to running out of memory. Oops you are copying a 4Gb chunk of memory multiple times, because that was the solution that someone provided on StackOverflow and you didn’t know any better at the time. The accepted solution worked for the asker’s tiny problem, but it bit you in the ass for your slightly larger one.


[2] But then again I didn’t study computer science, so maybe that’s why most of it was not that much useful for me.

[3] You might want to read a more in depth blog post on Writing system software: code comments from the creator of Redis.

[4] For a more thorough review of this book, you might want to check It’s probably time to stop recommending Clean Code article.

[5] I am talking here about the actual knowledge and not about on paper knowledge that you get after finishing a certain course or degree. While there are professions in which you simply cannot work without finishing such course and obtaining that paper, the software industry is not one of those.

[6] Some say it takes 10 years or 10’000 hours to become proficient in the subject, see https://www.norvig.com/21-days.html.