What Language Should You Learn?
So you’ve decided, for all the reasons given in my last post on this topic, that you want to learn to code. The next, obvious, question is: what language should you learn? Remember the goal isn’t just to learn to code, but to learn the mindset, tools, and structure of coding; to dog past the simple ability to kick off scripts, and actually pick up an overview of the ground level “stuff” necessary, the “stuff” that is going to transfer from being able to code to being a good engineer. You don’t want to waste your time just learning a new skill, you want to what you learn to intersect with what your main learning goals are in a way that ultimately supports them.
If you’re a bit confused by all this mumbo-jumbo, go back and take a look at one of the first posts on this blog: Jack of All Trades.
To answer the question—which languages should I learn—I need to look beyond what’s “easiest to learn,” or “most popular right now,” or any of the “standard” ways people make this sort of decision. To relate this back to network engineering terms, I want to learn routing, not how to configure it. If I had to choose two languages to learn today to learn, I’d learn C and Python. I’m not choosing those two randomly, or just because those are the two I happen to know pretty well (actually, I’ve coded in Smalltalk, xBase, BASIC, Java, VB, C, Python, and a few others through the years). I have a specific set of reasons for these two languages.
First, this is one compiled language, and on scripting language. The difference between these two is this: a compiled language must be compiled from the base language into assembly to be run. A scripting language, on the other hand (there are other terms here, I’m playing fast and loose with the meaning of the words just to make this simple), runs in a virtual machine, or a virtual environment. Scripting languages must have some sort of environment installed on the machine to run, while compiled languages, when compiled, generate a .exe (or similar) that you can execute from within the operating system.
Why would I choose one of each? Because coding is a different process, and at a different level, in compiled and scripting languages. To code effectively in a compiled language, you actually have to learn something about the way memory is structured in the operating system, how to do the compile, how to step through code that’s been compiled, etc. Scripting tends to hide most of these details from the user, and also works with a much tighter development process. Coding and testing can be less distinct, and the process of building something new is much faster.
Second these do happen to be very popular languages over time. There are a lot of compiled languages out there, but if you look at most of the routing code written and maintained today, you’re going to find most of the commercial, and efficient, code in this area is written in C. It’s invaluable to understand C well enough to be able to read this code base—I keep a copy of the Quagga routing suite on my laptop so I can quickly answer questions about protocol operation from at least one implementation. The scripting world is broad enough there’s much less of a consensus on a single scripting language. On the other hand, Python is a language that has stood the test of time, is useful in a wide variety of situations, and will serve as a solid introduction to other scripting languages. If you can read Python, and you have a fair understanding of C, you can probably make out what a script written in just about any other scripting language is doing.
You should feel free to choose some other set of languages, or perhaps only one. Remember, though, the point here is not to be a great coder, but to simply learn enough to be able to interact with coders, to gain tools you can use in network engineering for automation and other immediate needs, and to gain background knowledge and mental discipline that is going to make you a better network engineer. Given these constraints, you can take your time with learning to code. It might take months or years, or you might just tinker with coding from time to time. You should be perfectly comfortable just learning the tools enough to read through some interesting piece of code, and never even bothering to write anything until something crops up that makes writing new stuff worthwhile.
Coding, as a skill adjacent to network engineering, is worth learning to at least some level.