The Types of Programming Languages
Code comes in different flavors called programming languages. Some popular programing languages are shown in the following figure. You can think of programming languages just like spoken languages, as they both share many of the same characteristics, such as:
Functionality across languages: Programming languages can all create the same functionality similar to how spoken languages can all express the same objects, phrases, and emotions.
Syntax and structure: Commands in programming languages can overlap just like words in spoken languages overlap. To output text to screen in Python or Ruby you use the print command, just like imprimer and imprimir are the verbs for “print” in French and Spanish.
Natural lifespan: Programming languages are born when a programmer thinks of a new or easier way to express a computational concept. If other programmers agree, they adopt the language for their own programs and the programming language spreads. However, just like Latin or Aramaic, if the programming language is not adopted by other programmers or a better language comes along, then the programming language slowly dies from lack of use.
Despite these similarities, programming languages also differ from spoken languages in a few key ways:
Comparing low-level and high-level programming languages
One way to classify programming languages is either as low-level languages or high-level languages. Low-level languages interact directly with the computer processor or CPU, are capable of performing very basic commands, and are generally hard to read. Machine code, one example of a low-level language, uses code that consists of just two numbers — 0 and 1.
The figure shows an example of machine code. Assembly language, another low-level language, uses keywords to perform basic commands like read data, move data, and store data.
By contrast, high-level languages use natural language so it is easier for people to read and write. Once code is written in a high-level language, like C++, Python, or Ruby, an interpreter or compiler translates this high-level language into low-level code a computer can understand.
Contrasting compiled code and interpreted code
High-level programming languages must be converted to low-level programming languages using an interpreter or compiler, depending on the language. Interpreted languages are considered more portable than compiled languages, while compiled languages execute faster than interpreted languages. However, the speed advantage compiled languages have is starting to fade in importance as improving processor speeds make performance differences between interpreted and compiled languages negligible.
This executable file is then distributed via the Internet, CD-ROMs, or other media and run. Software you install on your computer, like Microsoft Windows or Mac OS X, are coded using compiled languages, usually C or C++.
Programming for the web
Software accessible on websites is gradually starting to take over installed software. Think of the last time you downloaded and installed software for your computer — you may not even remember! Installed software like Windows Media Player and Winamp that play music and movies have been replaced with websites like YouTube and Netflix.
Traditional installed word processor and spreadsheet software like Microsoft Word and Excel are starting to see competition from web software like Google Docs and Sheets. Google is even selling laptops called Chromebooks that contain no installed software, and instead rely exclusively on web software to provide functionality.
The remainder of this book will focus on developing and creating web software, not just because web software is growing rapidly, but also because programs for the web are easier to learn and launch than traditional installed software.