Learn Computing from the Experts | The Rheinwerk Computing Blog

How Is Scripting Different from Programming?

Written by Rheinwerk Computing | Feb 28, 2025 2:00:00 PM

Scripting allows you to automate repetitive tasks, connect different software tools, and quickly solve small problems with minimal code.

 

This differs from traditional programming, which focuses on building structured, long-term software projects with scalability and maintainability in mind.

 

Scripting means the following:

  • You can write 20 lines of code to create a backup of your database once a day, including encrypting and uploading this data to cloud storage.
  • With a tiny program, you can reduce countless wedding photos to a maximum resolution of 1024×768 pixels, including watermarking and uploading the files to a hidden directory on your web server so that your customers can view and select their favorite images via your website.
  • You can easily scan all the computers on your local network for a specific security vulnerability or an outdated software version.
  • You can capture, for instance, the volume of gas stored in Germany, the price fluctuations of the next notebook you want to buy, or the latest COVID-19 case numbers from public websites and represent this data in charts.
  • You can filter out the 20 error messages relevant to you from a log file of 50,000 lines.

Scripting versus Programming

Scripts, too, are “only” programs. However, they differ from large software projects in the way they are programmed, the tools/components used, and their objectives:

  • Typically, scripts perform manageable, relatively simple tasks. They often help automate administrative tasks or at least perform them more efficiently.
  • Scripts are used in text mode (in the terminal) or executed automatically in the background. No graphical user interface (GUI) exists.
  • Special script languages are used for programming, which make uncomplicated, efficient development possible. Script languages require neither elaborate development tools nor compilers. The syntax is minimalistic (sometimes, unfortunately, also outdated and it can take some getting used to). Central principles familiar from large projects, such as object orientation or strict type control of variables, play a subordinate role or cannot be implemented at all.
  • Popular script languages are characterized by huge offering of commands or extension modules. This diversity helps to perform basic operations (read and evaluate files, set up users, perform network operations, etc.). When it comes to scripting, you don’t have time to reinvent the wheel! You should rather make use of a huge toolbox of existing components and building blocks as best you can.
  • The code size of scripts is small, typically under 100 lines (not counting comments and strings).

In large software projects, an extremely important goal is that code be developed “cleanly”—that is, the code can be understood by all members of the team and later extended or modified. In other words, all guidelines of modern software design are observed.

 

Scripting, on the other hand, is about solving a small problem quickly and pragmatically (getting things done). Of course, you shouldn’t go out of your way to develop sloppy scripts! Scripts should also use meaningful variable names, be documented with comments, contain basic error protection, and so on. But the priorities and development goals of a script that should be ready within a day if possible are quite different from the priorities and development goals for a software project whose code may need to be maintained for a decade.

 

Glue Languages and Glue Code

In the context of scripting, sometimes, you’ll hear talk of “glue code.” Accordingly, scripting languages are sometimes referred to as “glue languages.” What do these terms mean?

 

In larger projects, the proverbial glue is often necessary to connect independent or incompatible software components. In the simplest case, a script calls some external commands that in themselves have nothing to do with each other: One creates a backup of a database, the second encrypts the resulting file, the third transfers the file to another server via HTTP, and so on. Each of the commands used was developed independently of all the others. But by connecting the commands through your script, a new meaningful component is created.

 

Glue code is sometimes also necessary to efficiently apply modern software development tools. For example, let’s say your team is developing a large project in JavaScript using tools like Git (version control) and Docker (containers for local testing environments). Each time a team member completes (“checks in”) a new test version, the current code should be transferred (“deployed”) to an external test server. This step could be performed by a small script.

 

Theoretically, you can perform such tasks with any programming language. However, scripting languages are particularly well suited for these tasks because of their simple syntaxes, minimal development overhead, and the fact that scripts create few (or even no) new project dependencies.

 

Do One Thing and Do It Well

Unix programs were developed according to the motto “Do one thing and do it well,” formulated by Doug McIlroy, and these programs are still assessed by this standard today. When Unix became Linux and macOS, what was then called a “program” is now called a “command.” But the principle has not changed: A command like ls, grep, or find is expected to perform a very specific task and to do that task really well.

 

What does Unix’s motto have to do with scripting? On Linux and macOS, when you develop scripts in the Bash or Zsh languages, you do so on a foundation of several hundred commands that meet the Unix recommendation. You would be well advised to adopt the motto for your own projects as well. Write scripts that perform one task neatly.

 

Editor’s note: This post has been adapted from a section of the book Scripting: Automation with Bash, PowerShell, and Python by Michael Kofler. Dr. Kofler is a programmer and Linux administrator. He studied electrical engineering/telematics at Graz University of Technology. He has been one of the most successful and versatile computing authors in the German-speaking world for many years. His current topics include Linux, Docker, Git, hacking and security, Raspberry Pi, and the programming languages Swift, Java, Python, and Kotlin. Dr. Kofler also teaches at the Joanneum University of Applied Sciences in Kapfenberg, Austria.

 

This post was originally published in 2/2025.