Scripting Languages: What You Need to Know


by Howard Fosdick   © RexxInfo.org


What is a scripting language? And why should you care? Which one should you learn to boost your career?

This article answers these questions and more. We'll look at how scripting languages evolved, and in the process, give you a more thorough understanding of what they are and what they can do.

What's Scripting?

Scripting languages are interpreted, rather than compiled. An interpreter processes each source code statement, one at a time. It translates each statement into machine language and then executes it. In contrast, compilers convert your entire program into machine language first. Then you run the compiled machine code.

Scripting languages can yield higher developer productivity than compiled languages like Java, C, or C++. That's because interpreters support high-level features like automatic memory management, variables and data structures that can vary in size, the ability to declare variables on the fly, built-in interactive debuggers, and extensibility.

So it's often quicker to script than code traditional programs.

Scripting languages often function as glue languages. They tie together existing code: objects, components, widgets, OS commands, system services, programs, functions, modules, and more. This increases productivity.

On the downside, interpreted languages are not as execution-efficient as compiled programs. So for the first decades of their use, scripting languages were employed in situations where run-time performance was not a concern. This shortcoming rarely matters today, since computers are now many thousands of times more powerful than when scripting languages were first invented.

Also, scripting languages are not capable of close-to-the-hardware programming tasks. For example, writing a device driver.


Scripting Benefits and Drawbacks

Mainframe Origins

Scripting first evolved on mainframes in the 1960s and 1970s. It became apparent that there was a need for a command language -- a language that could issue operating system commands and invoke other programs. Early examples were the EXEC, EXEC2, and Clist languages.

In the 1980s, Rexx superceded all these languages. Rexx is a full-featured scripting language that handles any kind of application.

Today Rexx remains the default mainframe scripting language. It's famous for being easy to learn, use, and maintain. Rexx is open source and is available on all other platforms, from cell phones to supercomputers. Object Rexx compatibly adds object programming to classic Rexx. There's also a Rexx compiler for runtime efficiency.

Shell Languages: Unix, Linux, and BSD

Unix and its heirs contributed a new concept to scripting -- that of the shell language. The shell is both the program that accepts and interprets your command at the command line prompt, and also a full-featured programming language.

Shells are portable and replaceable. You can add more shells to an operating system. Don't care for the default shell? Install another and use it instead.

The first shell was developed at Bell Labs in the 1970s.

Since then, dozens of full-featured shells have superceded it. These include Bourne-Again shell (Bash), C shell, tsch, KornShell, Z shell, and others. They're all open source under a variety of licenses. They're cross-platform tools but are primary associated with Linux/Unix/BSD systems. All are very powerful based on the shell concept. They are also syntactically difficult. This can result in hard-to-maintain scripts if programmers do not allow for this.

The best known and most-widely used shell these days is Bash, the default shell for Linux.

Windows: PowerShell

Windows was originally conceived as a completely interactive system, responsive to a single user. Thus the concept of a scripting language was considered secondary to its development.

Initially Windows just used the old Batch language of its predecessor, DOS. Batch files had the file extensions of .bat or .cmd. Batch files are limited compared to full-featured programming languages.

As Windows moved beyond the desktop and into the role of server, Microsoft perceived that a more complete scripting language was needed. In response, Microsoft introduced VBScript in 1996, Windows Script Host in 1998, and supplied Rexx in the Windows Resource Kit.

The company ultimately decide to provide a custom product and control scripting through its own language. So it introduced PowerShell in 2006. PowerShell is particularly adept at Windows task automation and configuration management. It leverages the large number of application programming interfaces (APIs) that exist in Windows, Windows Management Instrumentation, and the .NET Framework. So programmers can focus on PowerShell cmdlets rather than the details of lower-level APIs.

While Microsoft has transitioned PowerShell to open source and cross-platform use, it remains primarily associated with Windows.

Scripting Everywhere!

By the early 2000s, scripting had burst out of its role of operating system support and become viable for almost any application. Here are examples:

Scripting Benefits and Drawbacks

Several factors underlie scripting's widespread popularity.

First, computers became much more powerful. Today's laptop exceeds the power of a mainframe fifty years ago. So the run-time differential between interpreted scripts and compiled programs rarely matters compared to years ago.

Second, the advent of the internet led to new programming needs. Scripting perfectly fits the web programming paradigm. It works well for both server- and client- side development.

Lastly, there's the increased emphasis on programmer productivity. As computers become more powerful, why not push the programming burden onto them, instead of the developer? Scripting does exactly that.

The upshot is that today dozens of scripting languages are used for all sorts of tasks. Is there any way to make sense of them all?

Classifying Scripting Languages

One approach separates scripting languages into those that are general purposes versus those designed for a specific purpose:


General Vs Special Purpose Languages

You can see that some of the special-purpose languages support web development. Others are for text processing or embedded programming. Specially designed scripting languages can be ideal for such tasks.

You might disagree with some of the classifications in the charts I'll present in this section. That's because it's not always clear how to classify languages. And languages change and evolve over time.

PHP is a great example. It was designed exclusively for server-side web programming, running on servers to dynamically generate web pages. But it expanded its purview over time, and today can be used for client-side development as well. It can even be used for applications other than web programming.

PHP highlights another another useful distinction. Some scripting languages were designed specifically for web programming, while others address other kinds of applications. Some cover both bases, while others specialize.

This chart shows some of the more common scripting languages for web development. We've split them into server- versus client- side tools:


Scripting Languages for Web Development

Yet another way to categorize scripting languages is to divide them into open source and proprietary products:


Open Source vs Proprietary Scripting Languages

You could judge scripting languages by many other criteria than those listed here. Ease of use is one. For example, Python, PHP, JavaScript, Rexx, GML, and forms of Visual Basic are easy to learn, use, and maintain. Other languages, notably the Unix/Linux shell languages, Perl, and AWK, have challenging syntax and can be harder to work with.

Another distinction is between languages that are cross-platform, versus those that are identified with a particular operating system. Many cross-platform examples spring to mind here, including Python, Perl, Rexx, Ruby, PHP, JavaScript, and others. Most are open source.

And of course there are languages that are cross-platform, but in practice are rarely seen outside their native environment. An example would be PowerShell, which most still consider a Windows tool. Another example is the Linux/Unix/BSD shell languages.

Which Should You Learn?

Now you have an idea of how various languages fit into the scripting universe. Knowing the distinctions among them can prove useful in your career.

Which language should you learn to help your career?

The answer depends on two key questions. First, what is your role in the organization? And second, what platform(s) do you work on?

If you're a System Administrator or work in systems support, learning the default scripting language for your operating system is imperative.

The chart below shows that for Linux, Unix, and BSD, this means the default shell language for your platform. Windows relies on PowerShell, mainframes on Rexx, and Apple on AppleScript.

If you're not in a technical support role -- say you're an applications programmer or system analyst -- scripting knowledge for the platform you work on can be useful but is not essential.

If you're a web developer, scripting is vitally important. For client-side development, you need to know JavaScript (or TypeScript). It totally dominates this market niche. (You'll want to couple your JavaScript expertise with intimate knowledge of the two major markup languages, HTML and CSS.)

On the server side, your choice depends on the tools stack your organization favors. Some prime candidates include PHP, Python, Node.js/JavaScript, Microsoft's ASP.NET, and JSP.


Which Language Should You Learn?

What if you could only learn just one general-purpose, cross-platform language? Which would it be?

Python is certainly a good choice. It's easy to learn, work with, and support. It interfaces to everything, runs everywhere, and can be used for nearly any kind of application.

Programming language surveys consistently rate Python the single most popular programming language -- interpreted or compiled -- for the past several years.

This chart generated from the PYPL Index shows how Python wins the popularity race over all other scripting languages including JavaScript, PHP, Perl, PowerShell, Rexx, Visual Basic, Ruby, and Lua. It's also more popular than all compiled languages including Java and C/C++.


Programming Language Popularity

If popularity indicates value to your career, Python wins the prize.

That said, I know people who have made fine careers for themselves by staying away from the most popular languages and instead burrowing into a critical niche. Some companies pay a premium for hard-to-find skills.

As a consultant, I find that clients value flexibility, so I must work in whichever language they prefer. Fortunately, most scripting languages are easy to learn.

If you're interested in how different programming languages correspond to salaries, check out Stack's Annual Developer Survey.

Summary

From their humble origins as command and shell languages, today's scripting languages support nearly all kinds of applications and run literally everywhere.

Let's wrap up with brief profiles of many popular scripting languages:


Scripting Language Profiles