Languages

First off, let’s briefly talk about machine code and how computers work.

<aside> 💡 Machine Code is the lowest level of code that computers require to run instructions. Looks like “101010101”, which is binary data that controls the physical computing devices (transistors) on the CPU. You never need to operate at this level as a programmer, since we have invented helpful abstractions

</aside>

🚧 Assembly — one of the lowest level of abstractions and languages that is “one step” above writing in binary. This is reserved for the most advanced highly performant applications and systems, and hardly anyone nowadays ever programs in assembly. It is also used as a form of torture to first-year engineering students.

section .data
    counter db 0        ; define byte variable counter with initial value 0

section .text
    global _start

_start:
    mov al, [counter]   ; move the value of counter into AL register

count_loop:
    cmp al, 10          ; compare AL with 10
    jg exit_loop        ; if AL > 10, exit the loop

    inc al              ; increment AL by 1
    mov [counter], al   ; update counter variable with new value
    jmp count_loop      ; jump back to start of loop

exit_loop:
    ; exit code or end of program

The above is a simple program that counts to 10. Confused? You bet. This is a difficult way to think and program, which is why we have invented more abstract and human-friendly languages to write and think in.

For example, here is the equivalent code written in the Python programming language:

let counter = 0; // define variable counter with initial value 0

while (counter <= 10) {
    console.log(counter); // or any other operation with counter
    counter++; // increment counter by 1
}

Is that much nicer? Even you have never programming before, I bet you could read through the above code and reason through it. Python is in fact one of the most human readable programming languages, which is why it is one of the most beginner friendly and popular choices as a first programming language to learn. It is also very powerful and pretty efficient given how simple it is to use.

In this curriculum, I have identified and selected 4 programming languages that we will learn. Each one for a particular reason, and all of increasing complexity and difficulty.

THE CORE FOUR LANGUAGES

There are many many many (too many) programming languages. The four that I have selected cover almost every use-case and scenario that a project in a Fab Lab or makerspace might need. I think learning any more as a beginner will become overwhelming and difficult to manage. That said, if you get really into coding, you should follow your curiosity and check out new languages and see what they have to offer. Some people really love certain aspects about a language, while others hate them. It can be a very polarizing world, which is why there are so many languages.

  1. Bash (Command Line) — a general purpose scripting language for working with computers, you will use it often as a tool but usually not for entire projects. Your first interaction with a language will be Bash, but we will not spend too much time with it. Consider it an appetizer in this 4-course meal.
  2. Python — as mentioned above, it is a general purpose language that could build almost any type of project. It is beginner friendly and enormously popular, which means that there is lots of great and free learning resources available online, youtube, and so on.
  3. JavaScript/TypeScript — one of the most popular programming languages used in the world. It is the primary programming language of the internet and also expanded to include a powerful set of tools that allow for building a wide variety of projects. What makes this slightly more complex is the addition of TypeScript, which was invented to solve some of the issues with JavaScript. You can think of these two as the same language, and most developers are adopting TypeScript - we’ll talk more about why later.
  4. C/C++ — a more advanced and low-level language that allows for developing highly performant and efficient programs that need to operate in real-time. Arduino is built on-top of C/C++ , and is considered to be more user-friendly, but knowing the underlying C language will be helpful for more advanced projects. We are not going to deep on C, but rather, discuss it a bit more in the context of embedded systems, such as the Arduino or RaspberryPi, where we often are developing real-time systems that are sensitive to latency and require fast computations and operations (like a drone or robot reading sensor data).