What’s the Difference Between Scripting and Coding?
Next on your path toward demystifying tech jargon is the difference between coding and scripting. You may have heard these terms thrown around in ways that make them sound similar: “You’ll need to learn coding languages to make a website,” or “We need to use a script to automate our network login.” It sounds like coding and scripting are two ways to describe programming on a computer, so they’re identical, right? Well, not exactly. Coding and scripting are related, for sure, but there’s a subtle (yet distinct) difference.
Think of Coding as an Umbrella Term…
According to Skillcrush WordPress Instructor Maren Vernon, it’s easiest to think of it like this: Coding (or programming) is an umbrella term that applies to all computer languages. Whenever you’re using a machine language to write instructions that a computer or computer program can understand, you’re coding.
…And Scripting As One Type of Coding
But under that big coding umbrella there are specific kinds of coding, one of which is scripting. So then what exactly defines scripting vs programming?
Scripting Makes Content Dynamic
Scripting is code used to automate processes that would otherwise need to be executed step-by-step by a web developer. Where different kinds of coding languages (such as markup languages like HTML and CSS) are used to tell computers how to display a website, scripting languages are used to give instructions to programs (like websites) that are running on a computer.
Here are the scripting languages you’ve probably heard of/used:
When it comes to scripting vs programming (in the more general sense), you wouldn’t use scripting or scripting languages to program static features like the overall appearance or layout of a website or web application, but you would use a scripting language to tell the static website to “do something,” making your static content dynamic.
Here’s an Example of Scripting
Vernon says that WordPress sites are a good example of a situation where scripting languages come into play. “Developers building WordPress themes or plugins use PHP to call for site content, be it a reusable snippet of code from another file, or information stored in the site’s database that a user has entered. That information is processed and output as HTML, which then lets site visitors see the content in their browser,” she says.
For instance, Vernon says, a PHP script makes it possible to have your three latest blog posts automatically appear on a site’s homepage. Or you could utilize conditional statements (if/else/endif) to change what is displayed on the site based on parameters—e.g. if the site administrator uploads a photo to x field, show the photo; if not, show y default photo or show nothing.
And—since code written in scripting languages is able to make decisions and relay instructions to its parent program—these functions happen automatically. The user viewing the website doesn’t see the script or its process, they just see the end result. Meanwhile, the site’s developer is able to implement these features with a one-time set of instructions, rather than hand-coding every single instance and outcome of a dynamic function (because who has time for that?).
Takeaway: Coding Is a Genre, Scripting Is a Subgenre
So remember: when it comes to scripting vs programming (or coding), coding includes more than just scripting, but scripting is a kind of coding. Whether it’s building a chatbot that sends back inspirational quotes, causing a pop-up window or form to appear on the screen in response to user behavior, or having animation occur when a user scrolls past a given point on the page, these are the kinds of tasks scripting can automate on a website.