10 Ways to Take Your Error Logs Up a Level
Error logs are the first port of call for any outage. Great error logs provide context and cause to a mysterious, 3am outage. Engineers often treat…
Our next-gen architecture is built to help you make sense of your ever-growing data Watch a 4-min demo video!
Formats: PNG, PDF, and SVG
Files size: 2.8 MB
For brand guidelines, please click here
Like all programming, scripting is a way of providing instructions to a computer so you can tell it what to do and when to do it. Programs can be designed to be interacted with manually by a user (by clicking buttons in the GUI or entering commands via the command prompt) or programmatically using other programs (or a mixture of both).
Consider this web page displayed on your browser – the browser is a program that you can interact with manually, and that program also reads other code (the HTML and CSS that describes the page) to determine what to display.
So what exactly is the difference between writing a script and writing code? The answer is simple: scripting is just a particular type of coding. You can think of coding – or programming – as the collective term for providing instructions to a computer.
These instructions can achieve a whole range of things, from building web pages and writing apps to automating IoT devices, designing databases, or developing a new operating system.
One of the considerations when you start writing these instructions is deciding which programming language to use. There are hundreds of computer languages in existence, with more being developed all the time.
Different languages are better suited to different use cases, whether that’s manipulating data, generating graphics, or creating tools to help developers write code. Scripting languages are a subset of these programming languages, and different scripting languages are helpful for various tasks.
One of the critical features of scripts is that they provide instructions that are read and executed by another program while it is running. In technical terms, instructions from a script are interpreted at runtime (i.e., when the code is used).
By contrast, the code is compiled in advance of being run in other programming languages. You can think of this as packaging up the instructions ready for use. This means you get the same behavior each time you run them, but if you want to make a change, you need to recompile the program into a new package and redeliver it.
Sometimes that’s acceptable, but in other cases, it’s helpful to modify the instructions without recompiling the code first. Scripts allow you to modify the instructions each time the program runs.
(Note that the distinction between interpreted and compiled languages isn’t completely clear cut, but that’s a topic for another day.)
Because scripts provide instructions to other computer programs while running, they are ideal for creating dynamic experiences. One of the significant use cases for scripting languages is web development, where dynamic and responsive experiences are highly valued.
Imagine a basic webpage, such as an online retailer’s page for a particular prod, consisting of text and images. You could create a static version of that webpage with HTML and CSS.
However, most online retailers have hundreds, if not thousands, of products and therefore pages. Those pages need to be kept up to date with the latest availability and price information. The retailer usually wants to display other information on each page, such as reminders of other products you’ve viewed and the number of items in your basket.
Creating every possible permutation of each webpage in advance as static HTML and CSS would be very inefficient. Instead, we can combine the static HTML and CSS with scripts that call up the dynamic content each time a user loads the page. Scripts populate the web page with relevant content based on your browsing history and product database.
The following scripting languages are widely used in web development to create dynamic user experiences (such as social media feeds, recommendations, and search results) and generate pages from templates (such as news and e-commerce sites).
As we’ll see, web development frameworks have been created for each. Frameworks make building and maintaining experiences with a particular language easier by providing tools and libraries that simplify everyday tasks (such as authenticating users or making database calls).
PHP (a recursive acronym for Hypertext Preprocessor) is very widely used for server-side scripting, powering Facebook, Wikipedia, and WordPress, to name just a few.
Server-side scripts are the instructions run on the servers hosting your website when a user visits a particular page. For example, you could use PHP scripts to call a database to retrieve availability and pricing information about a specific product or request the five most recent blog posts. The script runs when a page is requested, allowing you to populate it with the latest information without generating the page in advance.
There are a number of PHP web frameworks to choose from, including Laravel and CodeIgniter. You can also use PHP for other use cases, such as command-line scripting.
One of the most popular programming languages globally, is Python. It is a scripting language with many use cases, from application and game development to data science and DevOps automation.
Python is a popular scripting choice for back-end web development, where it is used to retrieve data from databases and APIs and manipulate it for inclusion in response to the client. Python server-side web frameworks include Django, a fully-featured framework widely used for content-oriented sites including Instagram and Dropbox, and Flask, a lightweight web framework that’s popular with microservice architectures.
Perl is best known as a language for writing text-manipulation scripts, whether writing regular expressions (regex), parsing HTML, manipulating JSON files, or extracting data from log files. As a result, Perl is a popular choice for sysadmin work, such as managing file systems, databases, and users.
Thanks to both its versatility in integrating backend services and the fact it was a widely used language when the Internet started to take off, Perl was at one point a popular choice for server-side web development.
Over the years, there have been several Perl web frameworks, with Dancer and Mojolocious being the most popular still in development. While Perl might not be your first choice when starting on a new web project, you’re likely to encounter it on older web projects, and it remains a widely used scripting language in other contexts.
Like Python, Ruby is a general-purpose scripting language with many applications, from websites and web apps to desktop programs, data processing tools, and automated DevOps tasks.
Ruby has become increasingly popular as a server-side scripting language thanks to the Ruby on Rails web framework, which powers the likes of Airbnb, Kickstarter, and GitHub.
You can think of scripting as a subset of coding, and scripting languages as a particular family of programming languages. As we’ve seen, scripting is widely used in web development to create dynamic, responsive experiences and enable pages to be generated from templates.
But scripting is not limited to websites; you’ll find scripting languages used to create mobile and desktop apps, manipulate large data sets, automate deployments, and orchestrate machine learning utilities. In all cases, a script requires another program to run it.
Finally, as with any programming language, choosing the correct scripting language for a project will depend on several factors, including your specific use case, the existing ecosystem, and you and your team’s previous experience.