Mind Matters Natural and Artificial Intelligence News and Analysis
Two female programmers working on new project.They working late at night at the office.
Photo licensed via Adobe Stock

Jonathan Bartlett’s New Book Takes the Mystery out of Programming

Many people would benefit from understanding the basics of programming, especially the ideas and principles underlying Javascript, used at websites

Jonathan Bartlett, author of the well-received Calculus from the Ground Up (2018), has a new book out, Programming for Absolute Beginners: Using JavaScript. As he told Mind Matters News, the book is aimed at those who want to get started in programming, “whether that’s someone switching careers, an introductory college course, or a high school student.” Or just someone who needs to interact with programmers, perhaps in the workplace.

Mind Matters News: You mention that, for those who want to learn programming today, the situation has changed, compared with earlier years. How has it changed?

Jonathan Bartlett: I grew up around computers. I’ve been programming computers since the 1980s, and have been around the development scene for a long time. When I grew up with computers, you had to really know how they worked to even use them. You had to know how to use a command line, format a hard drive, set up networking, etc. Modern computer users don’t know any of these things. Therefore, while knowing how these things worked used to be a prerequisite for even using a computer, nowadays people come into programming lacking all of this background knowledge.

It’s great that we have automation for end-users. The problem, however, is that programming often deals with the hidden parts of the computer. Therefore, while operating systems have essentially “hidden” the hard parts, programmers need them “un-hidden” in order to work with the system. But the background knowledge for how this happens is largely missing.

The goal of my book is to re-insert this background information for new programmers. Knowing the basics of how computers work, how files are handled by the operating system, how computers handle networking, how everything on a computer is represented by numbers are all important for computer programmers, but these details are often missed by introductory books.

My book, which uses JavaScript to introduce programming, doesn’t even get to JavaScript itself until Chapter 8.

Mind Matters News Why did you choose to focus on JavaScript?

Jonathan Bartlett: I’m using JavaScript, but the main goal is to introduce programming as a whole. JavaScript is just the vehicle, the example language.

First, everyone already has everything they need to program in JavaScript already installed on their computer. I do recommend that people install Visual Studio Code to write their programs, but even that is optional. Your computer already has a web browser which runs JavaScript code, and you can write your code using TextEdit or Notepad, which is also installed with their operating system.

Another reason is that JavaScript is essential for building websites. Nearly every modern web page has some amount of JavaScript running on it. Learning JavaScript is likely to be useful to someone no matter what they wind up getting into, even if it isn’t programming as such! It’s everywhere, so you don’t have to worry that your time is wasted.

Additionally, JavaScript was actually written to be a first programming language. It was meant to be easy for non-programmers to get started with. Any programming language is a little tough just because writing for a computer the first time is difficult. But, comparatively, JavaScript is a lot more forgiving than other programming languages.

JavaScript is also very similar to many other popular programming languages, so what you learn in JavaScript will be largely transferable, whatever language you wind up using.

The goal of the book is to teach ideas and principles, not all the sordid intricacies of JavaScript. I want to teach people to think like a programmer.

Jonathan Bartlett

Mind Matters News So how do you get people whose experience is no more than “I use a computer at work” to “think like a programmer”?

Jonathan Bartlett: I’m a big fan of training our intuitions. What sets good programmers apart is that they have a keen sense for what is really happening inside the computer. They have a “feel” for what the computer is doing with their code. When you have a sense and a feel for the computer, then you don’t have to memorize details about your programming language any more than you do about the English language. It just comes naturally.

The book tries to train intuitions in several ways. First of all, it gives some history of computation, so that the reader has a background of why things are the way that they are. It leads the user through not just how things work now, but the thought process that led us here. What problems were people trying to solve? What were the motivations behind different features? Helping new programmers see the context surrounding different technologies gives them a better feel for the process of developing technical solutions.

Second, I have found that some new programmers are so used to computers just “knowing” how to work that they don’t understand how specific and exact you have to be with them. Computers will do exactly what the program says, not what you “meant” it to do. Therefore, I spend a chapter showing students how computers work on the inside. Chapter 5 introduces a paper computer, with 64 bytes of memory, where you can do all the steps of a computer yourself.

This may seem strange for a JavaScript book, but it helps the reader really understand how precise computer instructions are. Once you have worked through how a computer reads instructions from memory, processes them in the control unit, and executes them in the arithmetic and logic unit, the precision required when instructing computers makes a lot more sense. You then really understand that computers are in fact just logic machines that do precisely what they are told.

Finally, I have a lot of exercises for the reader that are aimed at training their intuition. I have them take programs that work and add features to them. I challenge them to remake previous programs using new ideas.

Mind Matters News It sounds like you are demystifying what the computer is doing.

Jonathan Bartlett: “Demystifying” is a good way of putting it. I spend a lot of time getting readers to look under the hood. Not just How does a computer read instructions? but How does a computer find another computer on the internet? How is data stored in files? How does everything wind up being represented by numbers? What does the file extension do? How is data transmitted on the Internet? People use computers as if they are magic boxes, but a programmer has to get behind the magic and actually know where the data is going and how.

I also offer a huge glossary of terms. To many people starting out in computer programming, it seems like programmers are speaking a different language. Readers can look up the terms they need to know on a regular basis.

Mind Matters News: Thanks for joining us, and good luck with the book!

Note: Computer programming ranks among the best jobs of 2022, according to U.S. News

You may also wish to read: The needless complexity of modern calculus. How 18th century mathematicians complicated calculus to avoid the criticisms of a bishop. The fact is, calculus is taught in such a convoluted way that the natural beauty of it is almost always greatly distorted.

Mind Matters News

Breaking and noteworthy news from the exciting world of natural and artificial intelligence at MindMatters.ai.

Jonathan Bartlett’s New Book Takes the Mystery out of Programming