Introduction to scripting

Submitted by sylvia.wong@up… on Mon, 01/31/2022 - 17:32
Sub Topics

All scripting languages are programming languages. However, not all programming languages are scripting languages.

A 'scripting language' is essentially a language in which instructions for a run-time environment are written and interpreted by the system, rather than needing to be compiled.

Scripting languages are computer languages used to add additional functionality to apps and connect complex systems; i.e. intended to integrate and communicate with other programming languages.

Some common scripting languages include:

  • Bash: A scripting language designed for use with the Linux interface. Bash is far more user-friendly than other programming languages for creating scripts. It discusses the tools to use and codes in the command line, how to create useful reusable scripts and save documentation for others to use.
  • Node.js: A framework for developing network applications in JS. IBM, LinkedIn, Microsoft, Netflix, PayPal and Yahoo are among the corporations that employ Node.js for real-time web applications.
  • Ruby: There are numerous reasons why you should learn the Ruby programming language. Ruby's adaptability has enabled developers to design cutting-edge software. It's a scripting language that's excellent for web development.
  • Python: Simple, free and open source. Python supports both procedure-oriented and object-oriented programming. Python is the most popular programming language among developers because it is an interpreted language with dynamic semantics, allowing vast quantities of code to be written.
  • Perl: A scripting language with unique characteristics that set it apart and make it popular. All Windows and Linux servers have it. It is useful for text manipulation tasks.

Some of the prominent characteristics of scripting language are:

  • open-source, meaning users can have full access to view and edit code
  • comparatively faster to develop than compiled applications
  • a limited number of data structures makes it easy to write and edit
  • useful for creating new applications in web browsers
  • can be used to create plug-ins and extensions for other applications.

Interpreted vs. compiled

As stated above, scripting languages are 'interpreted' rather than 'compiled'. But what is the difference?

Code that is written in a compiled language like C, C++ or C#, cannot be directly executed by a computer. Compiling means that the language is reassembled into low-level machine-readable instructions that the computer can then execute.

You cannot read, a compiled program’s written code.

A diagram depicting the difference between compiled and interpreted languages

Compiled programs often run faster than interpreted ones; however, code written in interpreted languages can be modified while the program is running.

Examples of compiled languages include:

  • C
  • C++
  • Go
  • Fortran
  • Pascal.

Examples of interpreted languages include:

  • Python
  • PHP
  • Ruby
  • JavaScript.

Advantages of scripts

  • Open-source, allowing users to view and edit the script if needed.
  • Does not require the file to be compiled, but may be when necessary.
  • Easy to learn and write.
  • Easy to port between different operating systems.

Disadvantages of scripts

  • Open source allows others to view source code, which may be prohibited by some companies.
  • Requires the user to install an interpreter or separate program before the script can be run.
  • In some situations, they may be slower than a compiled program.
Compiled Interpreted
Pros Cons Pros Cons
Ready to run Not cross-platform Cross-platform Interpreter required
Often faster Inflexible Simpler to test Often slower
Source code is private Extra step Easier to debug Source code is public

 

A developer coding in their preferred IDE, on their laptop and additional displays

What is an IDE?

An Integrated Development Environment (IDE) is essentially software for developing software…confusing, right?

An IDE typically combines the 3 main tools necessary for software development:

  1. A source code editor: Basically a fancy text editor. These often include productivity features like syntax highlighting, auto-completion and visual indications for issues and bugs.
  2. A runtime environment: A way of executing code without having to compile it. This is particularly important when using compiled languages because compiling an application every time you want to test something can be time-consuming and tedious.
  3. A debugger: A tool for finding and fixing bugs in the source code before compiling.

Scripting languages often don’t require the use of an IDE. Because the code is interpreted, the run-time environment is usually already present on the computer and debugging is done during run-time.

Popular IDEs

Visual Studio

Visual Studio (VS) is a full-featured development environment, available for Windows and Mac OS platforms. There are 3 different versions of VS provided. The 'Community' version is free for individual developers, while the 'Professional' and 'Enterprise' versions of the IDE require a licence.

PhPStorm

PhPStorm is an IDE focused on the creation of front-end code and applications using the programming language, PHP; although it also supports the use of more languages like JavaScript, CSS, HTML5, Sass, Less and others. JetBrains’ PhPStorm can be integrated with other website creation software and platforms like WordPress, Laravek, Joomla and Drupal. Similar to the other products in the JetBrains product suite, it comes with code suggestions, testing tools and debugging tools.

XCode

XCode is a free, open-source IDE. XCode provides tools for the creation of applications for Apple devices including the Mac, iPhone and iPad. XCode integrates with the CocoaTouch development framework for iPhones and iPads. It lets you enable features like Passbook or Game Center with just the click of a button and supports a split-screen workspace (even letting you build prototypes using the Interface Builder).

Check your knowledge

Answer these three questions about programming and scripting. 

Module Linking
Main Topic Image
A laptop displaying a developer's IDE, showing functions the devloper has just authored
Is Study Guide?
Off
Is Assessment Consultation?
Off