Beyond Javascript: 5 Programming Languages That Will Rewire Your Brain (Part 1/5: C)
Tags: javascript, programming, computerscience, beginners
Published: 2022-04-27 13:00:42

So you know Javascript, and maybe Typescript, and you wonder what's next.  You might ask yourself: how can people write these elegant frameworks, how do they come up with the idea to build Node, how can they understand networks and distributed systems so well? Often, it comes from knowing many different paradigms and fundamental concepts of computer science, and combining them in new ways to make them work for the web.

There is no better way to learn new paradigms than being fully immersed in them because they are at the core of the language you express yourself in. There is a lot of speculation that language shapes the way you think. While it might be true for human languages, it *definitely* is true for programming languages.

Here is a list of the languages that I have learned over the years. Some I have used extensively, some are things I picked up but never used professionally, but they all significantly changed the way I think about programming.

Please note that each of these languages takes a long time to really be proficient with. Don't just do 2-3 tutorials and think that that was enough to rewire your brain. You need to dive into the unknown, do a chunky project without guidance, hit your head against the wall a few times in order to really make those new neuron connections. For each language, I will give a short list of project ideas that I think are both fun and instructive.

## C

C is getting a lot of flack about being insecure, but it is a marvelous language to learn. 


![CPU - courtesy wikimedia](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0ho2iw3k06w57upz7vmv.jpeg)

### Learn C, it's great!

Why do I think that C is a great language to learn next:

* it is close in syntax to Javascript
* it is available on literally every platform, from a 1 kB of memory microcontroller to the biggest supercomputer
* it teaches you a very useful abstraction of the hardware
* it is the glue of every operating system and shared library. 
* it is small and fast. Often, it is the benchmark every other language runs up against
* you will understand how many exploits and security bugs work
* you can use it to program microcontrollers and build physical devices

### Get close to the CPU and the operating system

In C, you have full control of the memory, and a fairly close mapping of the code you write to what the CPU is actually going to execute. Furthermore, the way you call functions in C is the way any programming language has to call functions that are not written in the language itself, like operating system functions. For example, node's magic comes from how it binds javascript to operating system functionality, in C. Similarly, the linux kernel is written in C. Learning C will get you half of the way to programming your own system tools, shared libraries and kernel drivers.

### Why C and not Rust?

I think C is a much better systems language to learn after Javascript than Rust, even though Rust has many more interesting ideas and addresses a lot of shortcomings of C. It however makes it much harder to understand how your program and the resulting binary relate to the CPU and operating system. Once you know C, so much of Rust will make a lot of sense, and you can focus on the features that make Rust great.

### Resources to learn C:


![Timeless Books - CC/A Lin Kristensen - Wikimedia](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bdc98n5ur3hjtg7v5fw8.jpeg)

I learnt C in the 90ies on a small linux computer (486 with 8 MB of RAM), and it taught me a lot about unix, network programming, memory layout, linkers, compilers. C has changed a lot since then, with the newer C99 and C11 standards. I recommend learning C in combination with the following language (assembly) by using a site like [godbolt](https://godbolt.org) which allows you to see how your C code compiles down to assembly (we will come back to that in the next post in this series).

While I don't have a list of good resources to learn modern C (there are quite a few books out there, I have never been disappointed by Manning: [Modern C](https://www.manning.com/books/modern-c). The resources that shaped my own way to C were: [Advanced Programming in the Unix Environment](https://en.wikipedia.org/wiki/Advanced_Programming_in_the_Unix_Environment#:~:text=Advanced%20Programming%20in%20the%20Unix%20Environment%20is%20a%20computer%20programming,in%20the%20C%20programming%20language.) and [Unix Network Programming](https://www.amazon.com/UNIX-Network-Programming-Richard-Stevens/dp/0139498761). And then much more importantly, and shaping my aesthetics until today: [C Interfaces and Implementations](https://www.amazon.com/Interfaces-Implementations-Techniques-Creating-Reusable/dp/0201498413) and [DJB's software](https://cr.yp.to/djb.html). I can't stress the latter one enough, as it shows you how much of C's unsafety comes from bad API design, more so than the language itself.

### Project ideas in C:

* Build a robot with an arduino, and control a lamp by pressing on a switch
* Build a little web server with no external library
* Build a tool that decompiles a shared library, showing the assembly for each function (start with an easy CPU, not x86. I recommend atmel 8-bit CPUs)
* Build a little calculator

## What's next?
The next part of this series is going to be about learning assembly. Scary yet? Don't fear, assembly is tremendous fun, and very relevant to the web these days.

Which languages did you learn that changed the way you think? Comment below!