Coalescing the Abstract into Software

Dane Hillard
Easy as Python
Published in
5 min readJan 6, 2016

--

It’s been a bit. Thinking a lot about how I began this discussion and where I want it to lead in the end, I was having difficulties figuring out the intermediate steps. After some digging with a friend of mine who’s trying to learn some programming skills as we speak, I believe I’ve found a clear way forward.

Up to now, the ideas we’ve discussed are pretty abstract. I started with propositional logic and followed that up with propositional-er logic. While I consider that content rather foundational to my career as a software developer, I also understand the argument that it’s abstract and doesn’t provide much in the way of actually getting things done. This is precisely what my friend confirmed when prompted to ask his most burning question about programming.

When I asked about his biggest curiosity, my friend essentially said he still doesn’t know what programming is, concretely. He described it abstractly as the “action or process of computers/electronics.” This isn’t blatantly wrong, but it’s the starting point on the way to writing software. Let’s go.

Programming is not, in fact, the action or process of computers and electronics. To state it as succinctly as I know how, programming is “a framework that enables humans to instruct computers.” In so many words, programming allows us — as humans who speak “natural languages” — to tell computers how to act using “programming languages.”

Back when computers were in their infancy, people were responsible for telling a computer how to act using what was essentially the computer’s language. This was a tedious process involving translation of plain English algorithms into a configuration readable by the computer, usually by flipping switches or punching holes in paper cards. That wasn’t fun for a lot of people; indeed, programming languages were invented to bridge the gap. So how do these languages work?

Programming languages are so called because they have a grammar or syntax that defines how the language is structured. People can leverage this syntax to create structured sets of files that can be interpreted and translated automatically by the computer. Let’s hear that again: programming is the process of using languages, with varying degrees of similarity to human language, to write instructions that a computer can translate and execute automatically. That’s the value statement.

Now that we’ve gotten to the core of what programming languages do, let’s get a little more concrete and see what some of them are and what they look like.

Python

Python is one of the most pervasive languages right now, due in part to its relative closeness to English and therefore low barrier to entry. It may seem cryptic at first, but you’ll see in time that other languages can get worse.

names = ['Ann', 'Bob', 'Catherine', 'Dave']for name in names:
print('Hello ' + name)

Can you guess what the above will do? First, we create a list of names. We then take each name in the list and “print” it to the screen along with a greeting. It would look something like this:

Hello Ann
Hello Bob
Hello Catherine
Hello Dave

Neat, huh? (Not all that neat, but hey. We’re learning, people.)

JavaScript

JavaScript is another very popular language right now due to its use in web browsers like Chrome or Safari. As more and more people use the web, it’s convenient to use a language that works natively on the tools they use. Let’s see the equivalent of the code above, in JavaScript:

var names = ["Ann", "Bob", "Catherine", "Dave"];for (name of names) {
console.log("Hello " + name);
}

You’ll notice there are some differences from Python, but ultimately the program reads similarly. We build a list of names, and then “log” them to the “console” with results identical to the above.

Java

Java — not at all related to JavaScript — is a programming language used by uncountable pieces of software. It’s the go-to choice when writing enterprise software because of its maturity and portability among operating systems like Windows, Mac OS X, and Linux. Let’s see our program once more, this time in Java:

public class NamePrinter
{
public static void main(String [] args)
{
String[] names = {“Alice”, “Bob”, “Catherine”, “Dave”};
for (String name : names)
{
System.out.println(“Hello “ + name);
}
}
}

This example is the most involved and probably the most cryptic as well. It requires a bit of overhead, like the “NamePrinter” and “main” wrappers you see, but then we see our familiar tasks once again. We set up the list, then print a line to the system output for each name in the list. Java can be heavy-handed for small tasks like this, but large projects often benefit from Java’s speed and features that increase its reliability as compared to other languages.

You might wonder why there are different languages at all, if they all do roughly the same thing! Part of the answer is simply that different industries and companies adopted different languages that seemed right for their work at the time. These decisions tend to carry forward for years. Another reason is that not all languages are created equally. While most languages can perform the same tasks as others, some are faster at doing so or make those kinds of tasks easier on the programmer.

Your appetite for real-world stuff has hopefully been whetted. We’ve seen a program in three different languages and talked at a high level about how those programs end up being used by the computer. Armed with this knowledge, I think we can finally move on to talking real programming principles and even writing some real software. And we will, my friend, we will. All in good time.

I’m so freaking excited

Up Next: Get Your Feet Wet with Python

--

--

Publishing Python Packages 🐍📦 ⬆️ Practices of the Python Pro 🐍📘 Technical architect at ITHAKA