If you read my last post, then you are likely thinking that all of this is very interesting, but we have still not covered “how” to pick a language. It helps to understand several different ways to classify a programming language. Here are a few questions for you to answer before we get into that.
First, are you constrained in your choice? Sometimes you don’t get to pick your poison. You work for a Microsoft partner, so you must use C# because that’s what is expected of you. Maybe you’ve been hired to a team with existing projects. If you don’t get to pick, the rest of this is academic.
Second, are you constrained by an operating environment? A lot of software developers specialize. Some only write software the runs on Apple’s IOS operating system that powers their iPhones and iPads. Others write software that runs on the web while still others create software designed to be run in a Windows desktop environment.
So what kind of software do you want or need to create?
Armed with the answers to these two questions, we can start evaluating our possibilities.
General Purpose vs. Specialized Languages
Pretty much everyone has heard of an invention created by one Richard Clyburn in 1842. I present to you an adjustable wrench:
This wrench is very common and can be used on a variety of tasks befitting a wrench, like loosening and tightening of metal fasteners, pipes, etc.
Now consider this wrench:
This is a basin wrench. It was designed with a single task in mind: tightening down faucet plumbing in kitchen sinks. The long handle and articulating head allows you to get into the space behind the bowl of a sink where other wrenches cannot reach.
There exist some coding languages designed for a specific purpose. For example, the LISP programming language was designed specifically for use in Artificial Intelligence. You can create a neural network with it, but you can’t write Minecraft.
The Structured Query Language (SQL) serves the singular purpose of defining, organizing, and extracting information from a database. You can’t make a video game nor an operating system with SQL
The upside to a specialized language is that they have smaller learning curves. LISP and SQL have a small number of commands and a limited number of ways to express your ideas in code.
Contrast that with a programming language designed with a broader purpose, a general purpose language. These languages are designed to write any kind of software from operating systems to video games. They are generally based on frameworks that allow you to be productive without having to re-invent the wheel. When selecting a new language to learn, it is important to find out if there is a specialized programming language that might be used to write your program. The most common approach is to learn several general purpose languages and pick up the specialized ones as you need them.
Imperative vs. Declarative Languages
During my long career as a software developer I have worked for some interesting people. Some of these bosses could be considered “micromanagers”. You know the type. They have trouble delegating tasks and tend to want to tell you exactly how to do whatever it is you were hired to do.
Another boss had a plaque on his desk that read something like
Never tell people how to do things. Tell them what to do and they will surprise you with their ingenuity.
General George Patton
Our next bifurcation of the programming world is very similar to this idea.
Most languages are imperative in nature. As a programmer, you are micromanaging the computer. This is acceptable because computers don’t have their own intelligence. They must be told what to do and exactly how to do it.
That is unless it’s an declarative language. In an declarative language, you tell the system what you want and it devises a solution to your problem. Sounds like magic, doesn’t it? I’m not saying programs just write themselves like they do on science fiction television shows. I’m saying these systems are designed around a well defined set of concepts. In fact, the only two declarative languages I’ve run into are also the only two special purpose programming languages I’ve ever used.
Most coding languages are imperative. Your job as a programmer is to devise an algorithm to solve a problem. An algorithm need not involve complex math. An algorithm is simply a set of repeatable steps used to solve a particular problem.
That set of instructions is written as code in the imperative language of your choice.
There are a few more of these differing camps within coding languages. We'll dive into some more of these in our next article.