💾 Archived View for yujiri.xyz › software › guide › language.gmi captured on 2023-06-16 at 16:56:27. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-05-24)
-=-=-=-=-=-=-
Learn programming for good instead of profit
So you've decided to learn to code. It's time to choose a language to learn. The language you choose matters a lot because - especially as your first language - it will heavily influence the way you think, just like a human language. But it doesn't matter *too* much because you'll end up learning many languages eventually which will enable you to see past the biases learned from your first.
I'm not going to tell you exactly which to pick; I want this to be a moment of agency for you. Below I rate several programming languages I've used according to a few metrics, along with an explanation of what each metric means. The scale is 0-6. After this I'll describe each language.
How efficient will your code be with the machine's resources (CPU and memory)?
Zig: 6
C: 6
Rust: 5
Go: 4
Crystal: 4
Python: 0
How many mistakes can the language help you avoid?
Rust: 6
Crystal: 5
Zig: 4
Go: 4
Python: 1
C: 1
When you know what you want to do, how easy is it to just write code that does it?
Python: 6
Crystal: 6
Rust: 5
Zig: 4
Go: 3
C: 0
How easy is it to learn?
Go: 6
Python: 5
Crystal: 4
C: 3
Zig: 2
Rust: 1
Do note that there are important metrics other than these. For example, the quality of the toolchain (compiler/interpreter), how long compiling takes, how helpful the error messages are, how good the ecosystem of third-party libraries is.
C is the old standard. It was made in 1972, and the Linux kernel, and the vast majority of infrastructural software (most package managers, widget toolkits, and widely-used libraries*), are all written in C. Because of that, you should learn C eventually, but not necessarily first.
Zig is a low-level language that first appeared in 2016, aiming to replace C. It has a lot of cool ideas and I like it a lot. However, Zig is still in an early stage of development. There are often bugs in the compiler and backward-incompatible changes with each new release.
Go is a language made by Google in 2009. It's often used for programming network servers, since it has good features for working with concurrency. It isn't exactly a low-level language, but it does compile to real machine code.
Rust is a language made by Mozilla in 2010. It has a lot of fancy features that are typical of high-level languages, including automatic memory management, but its automatic memory management is unique and doesn't come with the overhead that it does in most high-level languages, so Rust can also be used for low-level programming. As of 2022/10, the Linux kernel even includes a little bit of Rust code.
However, Rust has some ideological issues: it has its own centralized package repository that its compiler downloads dependencies from. And there's a licensing problem: it's trademarked in a way that prohibits forking it without changing its name (Mozilla has done this with other projects: see how Debian, a Linux distribution, had to change the name and logo of Firefox to Ice Weasel to be allowed to distribute their modified version). If you're like me, these facts are extremely distasteful to you.
Crystal is a language that first appeared in 2014. Its goal is to be like Ruby (an interpreted language, which would rank the same as Python in the above metrics) in every way except that it is statically typed and compiles to machine code. It (and Ruby) doesn't suit my personal tastes, but I've written one project in it, and must admit it's a good, pragmatic language.
Python is an interpreted language made in 1991 by a single person. It's very popular and often used for web development (on the server side). This is where I myself started. I discourage using interpreted languages for serious programming because they exacerbate the problems I discussed in the manifesto of this guide, but they tend to be easier to learn and good for throwaway code, and Python is no exception.
---
Now, I encourage you to make your choice without any canonical recommendation from me.