Live Sales Chat    US Sales/Support: 855-NEPHOS-9   International Sales/Support: 408-599-7008   Sign in
Home / Blog / Bash is the new JavaScript

Bash is the new JavaScript

bruce's picture

As programmers we use a large number of specialized languages for good reason, because we have a task to accomplish we tend to choose a language that we believe is just good enough to do the job. Programming languages become important because they contain interesting ideas, or they are very popular. How do languages that are just good enough become so popular?

Given it's shortcomings, JavaScript is an amazing success story. Its programming model is not popular, it was implemented in a hurry, it has too many poorly designed features, and it is tied to the DOM, a terrible API. Yet, there is something expressive and powerful in the language, and when AJAX came along JavaScript worked surprisingly well for managing the DOM. JavaScript has another critical advantage that has lead to its success, it is the only programming language available for programming in the web browser.

Bash is another specialized language that is very popular for programming tasks on Unix, Linux, BSD, OS X, and Windows (Cygwin). Bash is also tied closely to an idiosyncratic yet well designed API, in this case the portable operating system interface, or POSIX. It has many shortcomings including a limited programming model, inelegant syntax, compatibility problems between different platforms, and inefficiencies in speed of execution and resource utilization. Yet, it is quick and easy to use, good for working with files and directories, and works well for automating system administration tasks.

Bash and JavaScript have many things in common. They are both interpreted and they are both portable. Both are specialized programming languages with many shortcomings that are very popular for accomplishing tasks in their respective domains. While Bash does not quite have the unique advantage of being the only option for shell scripting, it is the default shell provided by most operating systems and it can be assumed to be widely available.

JavaScript became a popular language when AJAX came along as a way to improve the responsiveness of websites by providing a way to handle user interactions in the web browser and communicate asynchronously with the server. Once AJAX was established as the preferred way to build better websites all major web browsers worked to improve support of the JavaScript engine in the web browser. New frameworks emerged to mediate the interactions with the web browsers and JavaScript itself. Later on a framework called jQuery appeared on the scene. It wasn't like the others because it made three things very simple: handling events, manipulating the DOM, and talking back to your server. It is such an elegant solution it really changed the game, and many programmers were successful with jQuery before even learning JavaScript itself.

The rise in popularity of JavaScript doesn't stop with the introduction of AJAX. Most recently, node.js has developed into a credible server-side container that doesn't require a web browser. It provides event-driven, asynchronous I/O for programs written in JavaScript to minimize overhead and maximize scalability for web applications. And, JavaScript’s serialization form, JSON, is becoming ubiquitous for streaming structured data, and it is being used as the preferred interchange format for RESTful web services and for querying NoSQL databases.

Bash, like JavaScript, is becoming a more popular programming language in recent years in part due to the emergence of cloud computing as a new model for IT that displaces the client/server computing model. Next generation applications, such as big data, mobile applications, and SaaS have very elastic workloads and are being designed for web-scale computing where infrastructure elements such as servers are expected to be transient and failures in the infrastructure should not cause the application to fail. These higher level IT services allow programmers to treat server infrastructure as objects that need to be automatically configured when provisioned, and for this purpose Bash is ideally suited. Another important driver for the rise in the popularity of Bash shell scripting is the growing emphasis DevOps places on collaborative team work between development and IT operations resulting in the fast flow of planned work with high deployment rates and increased stability, resiliency, and security of the production environment.

There are a number of automation frameworks, such as Puppet, Chef, and CFEngine that are designed to manage large numbers of servers. The designers of these frameworks all take a slightly different approach, but all allow programmers to embed Bash shell scripts into the elements that are used to manage the servers. Even higher level frameworks for managing infrastructure on cloud computing platforms like CloudFormation and CloudScript are designed to manage multiple infrastructure elements such as networks, servers and storage. Not only do these frameworks allow programmers to embed Bash shell scripts into the elements that are used to manage the servers, but they allow to programmers to launch Puppet, Chef and CFEngine in the cloud computing platform.

The majority of the programming languages used by these frameworks that are designed to manage large numbers of servers and other infrastructure on cloud computing platforms are declarative, with the exception of Chef, and they are domain specific languages that have their own interpreters. Each framework provides an execution engine for the distributed systems management of the infrastructure elements. Because Bash is good for working with files and most of the cloud management platforms can be controlled through declarative domain specific languages or JSON based RESTful APIs, it is a good fit for the local control loop in autonomic computing leaving the global control loop up to the cloud management platform. As new approaches for self-management of systems are developed to deal with the problem of growing complexity of web-scale computing, Bash is ideally positioned to gain a resurgence in popularity similar to that which occurred for JavaScript with the coming of AJAX.

Specialized languages that are just good enough can become extremely popular due to the extenuating circumstances of a technology ecosystem, and a new innovation can catalyze the rise in popularity of the language. JavaScript's meteoric rise is one example of this phenomenon, and as a result of its widespread adoption new innovations have resulted in previously unforeseen ways. Bash is another specialized language that has many of the same fundamentals that position it for a resurgence in popularity. Due to the coming of cloud computing, DevOps, and automation frameworks for large-scale distributed systems, it shouldn't come as a surprise if you find Bash as an important language in your programming toolkit.

Nick Peterson
Director of Engineering,
NephoScale