If you spent your career in a Windows- and Microsoft-focused bubble, you probably worked with scripting languages like those I mentioned in my previous blog post. But those that worked in cross-platform environments, or in organizations that embraced open-source software, you might have a completely different list of scripting languages to consider.
One of the earliest scripting languages in use is Perl. Its history goes back to 1987, an eternity in the internet age. While not originally a Windows tool, it has been available through multiple ports (including one called PerlScript that uses Windows Script Host, although that hasn’t been as popular as the more typical open-source Perl) for quite some time. I installed Strawberry Perl to try it out (which Smart Screen really objected to, telling me it was unsafe because it was an uncommon download — take that as a sign of its popularity on Windows), and it worked reasonable well. It installed over 500MB of stuff, including open-source compilers and libraries (needed to compile some of the available CPAN modules when you add them to your environment, a unique concept), but it was at least self-contained in one folder. With that, I could then run a simple script like this:
Not the most useful script, but you get the idea. Overall, it looks like Perl’s popularity peaked in the early 2000’s, but there are still plenty of die-hards out there using it.
Around the same time Perl’s popularity started decreasing, Python’s popularity started increasing. There is probably a correlation there. Even though Python is also fairly old (going back to 1991), it has many features that make it a capable development tool, not just a scripting engine, hence it is used broadly in web site development. That’s what puts it towards the top of the popularity list, behind only Java and C. Like Perl, it also has an extensive collection of modules (available through PyPI) to extend its functionality. (You can probably see a trend here, which explains why the PowerShell Gallery becomes an important piece of the puzzle.)
A trivial Python example shows how Python uses indention instead of explicit block definitions (e.g. braces, begin/end, etc.).
a = 0 while a < 10: a = a + 1 print(a)
I published a more extensive example of using Python to talk to the Microsoft Graph in an earlier blog.
Installing Python on Windows is easy (Smart Screen doesn’t mind), but it does default to a per-user installation that puts it into your user profile. If you want to do a machine-wide install, choose the custom installation path and check the box. The total install size is about 150MB, also contained within a single folder.
After those two, scripting languages rapidly become programming languages. Sure, they can be used to write scripts, but they are more likely to be used by “real programmers” to write “real code” (whatever that means). A few examples:
- Go. While Go (which is often called Golang, since searching for “go” in your search engine of choice isn’t very helpful) is similar to Node.js, it does have one major difference: You can actually compile the scripts into executables. So it’s as much a compiler as it is a scripting engine (although you don’t have to build executables, you can just run the code). This one was developed by Google initially, but has gained popularity in the broader open-source community as well.
- Ruby. Influenced by Perl and Python, it’s another interpreted language that also became popular with developers building websites and web services. (Interestingly, new Ruby releases typically come out on Christmas day each year.)
All of these have support for modules or libraries (same idea, different terminology), with simple ways to include additional modules in your own projects (again, like https://www.powershellgallery.com). While I find Node.js a little too specialized (everything is designed to be asynchronous, because for web sites and web services you want that), and Ruby to be a little strange (a little Lisp-y), I do like Go.
Regardless of the language you use, Visual Studio Code is both extremely popular and extremely useful. If you aren’t using it already, install it today.