With new technologies, new frameworks, and new management fads coming and going every year, I feel pretty badly for beginners. Here you are, just trying to learn to code, and you’re getting overwhelmed with all of these different learning paths.
On top of that, you’re being hit on both sides from people promoting various programming ideologies. Is object oriented programming The One True Way? Shall we renounce it and embrace functional programming as the path to enlightenment?
All of these seem like important decisions you need to make. If you’re a mobile app developer, do you get onboard and embrace SwiftUI, or do you stay steadfast and staunch about the great old ways of Objective-C?
Which is right? Which is the path to darkness and despair?
It would be easy to get lost in a maze, but there’s actually a problem with this way of thinking. We tried it for tens of thousands of years, and it basically got us nowhere.
I like to call it thinking by ideology or “pure reason.” Some in philosophy have called it “rationalism.”
Rationalism is the idea that you can figure out what is true by starting with a simple set of premises and then working through them logically.
Your reasoning doesn’t need to be informed by data or evidence from the external world. You just need to stay in the realm of ideas.
Framed this way, “debates” over the one true way to make computer programs become one programming methodology pitted against the other, and the way you figure out if your favorite ideology is right is to make the proper arguments in favor of it.
Of course, if you do so, the other person will always listen and come to the exact same conclusions you’ve reached 😉. You’ll all pick functional programming, go home, and then everyone will use functional programming because that is the right way to make programs, as has been logically demonstrated through mathematical proof.
Programming is problem solving
But in practice, real world programming is quite different. It isn’t a debate between two mutually opposed ideologies. It is about solving some very specific problems in the real world, the one we inhabit day to day and experience (whether we like it or not).
If you are making a video game, you need to solve a laundry list of specific problems, and you use code to get this physical machine, a computer, to solve them.
How do I make it so my player character is drawn with the correct width and height?
How do I make it so she collides with a tile map?
How do I make this game character respond to physics?
How do I draw the player character as a series of animated pixel art frames while keeping the animation smooth and preventing the pixel art from getting distorted while I scale it by a non-integer multiplier?
All of these are practical problems that you need to solve.
What is computer science at is core?
Computer science teaches us some algorithms and tools we can apply to solve problems like the ones I have just listed. The important things it teaches us are the timeless solutions to these kinds of problems: algorithms, data structures, memory arenas, vertex and fragment shaders, and so on.
When you are thinking of what to learn or what to pursue in computer science, I want you to do a little thought experiment.
Ask yourself, “If the Earth were nuked to dust and there were a few human survivors, would the survivors eventually rediscover this thing I am learning?”
If the answer is “yes,” then it is something worth learning.
If the answer is “no,” then it is ideology or dogma and therefore not worth paying attention to.
Would we rediscover physical computer memory?
Let’s take a very basic example. If the Earth were destroyed, would we rediscover computer memory? Almost certainly yes because if you don’t have some physical place to store data, then you are severely limited in terms of the kinds of problems you can solve on a computer.
Without memory, you lose the ability to cache things, which means you can’t use clever things like hash tables to get through problems like computing factorials. You also can’t use the program stack to do recursion. The whole of computing slows down to a grinding halt.
Most of computing simply isn’t possible without some notion of memory.
The first person to “discover” computer memory, therefore, stands to improve computing to such a massive extent that it will get invented over and over again, no matter how many times you burn civilization to the ground.
Object oriented programming, a counterexample
This is not true of, say, object oriented programming.
You can solve any programming problem without object oriented programming.
That’s because, at the core of it, computers aren’t object oriented. There is no such thing as an object or a class physically in the hardware. No problem you solve requires you to use objects or classes to solve it.
Object oriented programming is just an extra layer we’ve invented, a cultural custom , a way of trying to make it easier to organize code. But we could just as well do without it, and without object oriented programming, we could solve all of the problems we’ve already solved.
Object oriented programming, therefore, is not necessary.
It is not neccessarily something we will discover again and again because it isn’t absolutely required to solve the kinds of problems we need to solve.
You can solve the same problems with object oriented programming or without it. It really doesn’t matter (unless you’re going for performance, then you definitely do not want to be object oriented).
You should learn the algorithms and techniques we cannot do without
If you are starting out in computer science, you should learn the sorts of things we cannot do without.
Ask yourself this question. Would it be possible to solve the problem I am solving without having to know or care about this thing?
Can you run a physics simulation on a game character without needing to know a thing about monads and functors or “pure” functional programming?
Yes. That’s because your program runs on physical hardware. It is comprised of a sequence of hardwired instructions which themselves are not highly abstract. These instructions are quite concrete. They cause the computer to physically change the state of transistors which contain representations of the data your program maninpulates.
I’m not saying mathematics isn’t important or fundamental to computing. I am saying some notions and constraints, like those which functional programming purists advocate, simply aren’t needed to solve the vast majority of practical problems we use computers to solve.
You don’t need to understand highly abstract mathematics to use the hardwired instruction set on your CPU for simulating physics. You would need to know math and physics, but you can still reason about physics without any fancy abstract things like monads.
The idea of a monad adds nothing to the conversation. It does not solve the problem. It is purely abstract. You can choose to use them or not. You can solve the problem in a purely functional way or not. Pure functional programming is a soft choice, not a hard a constraint for solving the problem. You don’t need to know it.
If the Earth were nuked to the ground, would we rediscover physical computers with hardwired instruction sets?
I would have to think the answer is yes. Where else would the data live? What else could we use but electrons and wires, given our technological starting point?
Are there other physical materials which have the same properties and relative abundance as silicon? I’m not a material scientist, but as I understand it we’ve chosen silicon for its physical properties and relative abundance.
After the apocalypse, we would probably end up creating computers just as they are today. There might be slight deviations, but the overall theme would be the same.
We would have CPUs, memory, GPUs, L1, L2, and L3 caches, hardware dedicated to solving specific problems, multithreading for parallelism. We would push physics as much as we can to get the greatest possible performance out of the machines we have built, just as we do today.
It all goes back to math and physics, hard empirical science informed by theory
Can you spot the theme here? All of the things we will discover again and again, in one way or another, go back to the hardware. They ultimately go back to math and physics.
Physics goes back to empiricism, or getting knowledge about the world by observing it, recording data, and allowing the data to guide our understanding.
Math is about taking the things we observe, noticing the patterns, formalising them, and using them to build theories.
When we put theory and evidence gathering together, we get this beautiful thing we call the scientific method.
The scientific method is how we got out from underneath medieval kings. It’s how we cured diseases, built airplanes that cross the planet several times a day. Science is the reason you can open the fridge and grab a snack instead of spending all day tending to the herd animals and crops.
If the world ends tomorrow, the things we will not necessarily discover are what you might call “soft.” Soft things are human cultural inventions which are arbitrary and not in any way related to the way the Universe physically works.
We won’t necessarily discover soft things again and again because they depend on random events like a certain person being born at a certain time, that person having an idea, other people finding that person’s idea compelling and spreading it, and so on.
The world of the soft is the world of programming ideologies and methodologies.
It’s scrum. It’s agile. It’s TDD, pair programming, kanban boards, waterfall, “clean coding.” It’s tabs vs. spaces, curly braces at the end of the line or curly braces under the name of the function.
The soft is the realm of petty disagreements, popular discourse, a place where the false prophets of computer science make their livings off of people who can’t separate truth from falsehood.
But in reality, computer science is informed by math and physics, which are the laws of the Universe that remain unchanged whether we are here to experience them or not.
Therefore, if you want to learn computer science, you should start with problem solving rooted in math and empirical science. You should learn the algorithms and techniques which make it possible to solve the kinds of problems we use computers to solve.
If you can solve the problem just as effectively without knowing a popular thing like node.js, then node.js is irrelevant and you don’t need to care about it. It’s just a cultural invention, and like all soft things, it will go out of fashion and get replaced by something else.
Stay out of the realm of the soft.
Pay attention to people who solve hard problems with timeless algorithms and techniques.
Ignore people who only talk about soft things like culture and convention. They have nothing to teach you.