The core idea of The Computer Science Book is that computing is a teetering tower of abstraction. By understanding the design and function of the levels below, we can more intuitively understand the behaviour of the system. Asynchronous programming in JavaScript is an excellent example of this. We saw in the previous chapter how JavaScript runtimes implement an asynchronous programming model using a task queue fed by background worker threads. Callbacks map neatly to the tasks executed by the runtime. Read more »
When noodling around on Reddit's /r/learnprogramming, it's common to find misconceptions about how JavaScript works: how does the compiler know to make it asynchronous? how do I make this function a callback? JavaScript is unusual because it is asynchronous by default and so requires a different programming model using callbacks and so on. That can be tricky to understand, which is why this question on Stack Overflow has nearly 6,000 upvotes. Read more »
The operating system (OS) is a very special program. It's the first thing to run when you start up your computer and it is the only program to have complete control over the system. Every other program has to go through the OS when it wants to access system resources. This is a good thing because a malicious or poorly-written program could otherwise steal your data or trash your expensive hardware. Read more »
Look at any computer program and you'll see two things: data and operations on that data. From the computer's perspective, everything is just a huge sequence of ones and zeroes. It is the programmer who creates meaning by telling the computer how to interpret these ones and zeroes. In this post, we'll start off with a quick summary of the distinction between data types and data structures. We'll then look at one of the most fundamental, but surprisingly interesting, data structures: the array. Read more »
Alan Turing (1912-1954) is the founder of computer science. In a single paper from 1936, On computable numbers, with an application to the Entscheidungsproblem, Turing presented the first precise definition of computation. He did this by devising an imaginary computational device, which he called an “automatic machine”, and proving that it was capable of carrying out any computation. In doing so, Turing proved that his automatic machine was equivalent to computation itself. Read more »