Skip to content

Languages#

There are so many programming languages available to us as engineers. Over 700. These languages come in a variety of styles, and each has a different objective. We'll look at a few types of languages here, the ones you'll likely encounter a lot, and just explain the differences you need to be aware of.

The differences are between scripting languages and programming languages. And with programming languages, there are compiled and parsed variations. The lines between all of these things can blur really quickly, but we'll keep it simple (and opinionated.)

Note

These will be simplified overviews. There's more to it than what I'm claiming here, but it's accurate enough for your level at this point in time.

Programming vs Scripting#

A scripting language is a language you write to control an existing piece of software. Bash scripting, which we'll cover, is an example of this. With a bash script, you're automating commands that you would otherwise type yourself to the bash shell. So instead of writing code that becomes instructions executed directly on the CPU, you instead write code that tells the bash interpreted what it should do for you.

Let's look at an example. Here are some commands I've typed at the shell:

1
2
3
4
$ touch /tmp/myfile
$ echo "Hello, world!" > /tmp/myfile
$ grep world /tmp/myfile
Hello, world!

Just three commands: touch, echo, and grep. In the real world this example doesn't really make much sense, but it'll do for our needs.

Now let's create a bash script from this:

1
2
3
4
#!/bin/bash
touch /tmp/myfile
echo "Hello, world!" > /tmp/myfile
grep world /tmp/myfile

And save it has myscript.sh.

Note

Technically, the .sh extension on the file isn't needed under Linux. I like to use file extensions to make it easier to identify files at a glance.

Now if we run this, the results are identical:

1
2
$ bash myscript.sh
Hello, world!

All we've done is scripted bash, telling it to run the commands for us. This allows us to keep repeating the commands, over and over, without having to type them out every time. This means we've essentially automated a task in bash. We've written code that works "through" bash to give the computer instructions.

This isn't programming, however.

The act of programming is writing code that tells the CPU to do something for you. Even something really simple like adding two numbers together for us. Python and Golang are examples of programming languages. They work directly with the computer hardware (via the operating system.)

Compiled vs Interpreted#

Python is an example of an interpreted language. This means the Python code you write is literally interpreted by the Python runtime every time you execute it. The runtime then takes your code, interprets it from Python to instructions the local CPU architecture will understand (remember CPU architecture from back in the day?), and then has the CPU execute them. This happens every time (there are exceptions we'll ignore.)

Golang (Go) doesn't behave in this manner. Instead, any Go code you write is compiled to a binary and then you use your operating system's interface to execute that binary. The binary has been created with the target CPU architecture in mind, from the moment it is compiled.

At this point in time and based on your future objectives of becoming a CloudOps and then a DevOps engineer, this is all academic. You won't actually need to worry about these distinctions' day to day. You'll mostly be writing Python and bash scripts.

What to learn?#

We're going to learn bash scripting. You only need some basics at this point in time. You're not trying to become a software engineer; you're trying to learn the basics of programming/scripting and then automating some tasks. Bash scripting will handle this fine.

But first you'll need an editor to use.