Welcome to Node.js: Part 0 – Intro to LAMP and MEAN

June 10, 2014

My name is Nate, and I’m a Node.js newb. I’ve been asked to dive into Node.js and it’s surrounding environment of technologies, and to give an ant’s eye view of the learning process. I’ve heard the rumors, and witnessed a demonstration or two. This is the Next Big Thing in web development.

While I hack away at the task before me, I will invariably make mistakes, run off into tangential topics, and generally make a mess. I’ll do my best to clean it all up and share the most important bits with you here on the blog. Comments, complaints, and constructive criticism are always welcomed and appreciated.

Before we dive into the bigger and better, we need to review the tried and true. Here, I will summarize the current, predominant environment and tools used in web development, known as the LAMP stack. Once we know what groundwork exists, we can look at what exactly Node.js will be building upon and/or changing.

LAMP is an acronym for a suite of open source (free) software components: Linux, Apache, MySQL, and Perl (and/or PHP, Python, etc.):

  • lamp-stack3Linux is, of course, the open source operating system available for free and used dominantly in all manner of business “work,” such as servers, mainframe computers, and supercomputers. Even Android, the increasingly popular operating system for mobile (and other) devices, is built around the Linux kernel. Obviously, the rest of the items in the acronym run in Linux.
  • Apache is a web server application that played a monumental role in the development of the modern World Wide Web. It is still used to serve the lion’s share of all active websites.
  • MySQL Relational Database Management System (RDBMS) is basically used to construct and access databases, from the small to the almost incalculably large.
  • Perl, PHP, and Python were successively developed programming languages, each offering a different benefit in the communication between a user’s browser and the external application running on the server. By various, often complicated methods, these languages allowed for interactive or dynamic components on a given web page.

The LAMP stack has been effectively used to build database driven, dynamic websites like WordPress and Wikipedia. Using a database (MySQL) run on a Web server (Apache) and accessed through methods available with dynamic software components (Perl, Python, PHP), a large amount of data can be parsed quickly and precisely, and can be displayed in a useful manner.

Of course, not discussed here are a few million more details, nuances, quirks, and other tools involved in the rise of the modern Web and still used with great success today. But there is one more development to understand before addressing Node.js.

JavaScript (the “js” in Node.js) started as a browser language developed to drastically simplify interface elements on a webpage (like choosing options, submitting information, etc.). Over the years, open source communities and invested companies have built JavaScript into a mature, sophisticated language with a plethora of libraries and methods that make loading dynamic content into websites much easier. And in the face of the incredible surge of complicated and variable mobile technologies of the last few years, JavaScript has been thoroughly adapted to displaying data and interface elements on screens of variable sizes and definitions, and on hardware of variable CPU power.

The “old” way of building a web page has its strengths in data storage and manipulation, and the “new” way is remarkably flexible in working on the burdensome number of devices that exist, as well as updating parts of a page with information without having to refresh the entire page (basically, doing everything we expect a modern web page to do). This development, however, has given rise to an increasingly frustrated conflict between server side (PHP, Perl, Python) and client side (the browser, JavaScript) programming.

Translating back and forth severely confuses the issue

Translating back and forth severely confuses the issue

A complicated set of translations must be made for every instruction passed between client and server, and for every data element returned from server to client. This constant halting and translation of the “conversation” between server and client is not only slow, but often introduces unforeseeable errors and further complicates the process with bugs. And once the responsibility for a given function has been relegated in code to the client or server, the decision cannot be reversed without rewriting the corresponding code in the corresponding language(s). It’s become obvious that standardizing interactions between server and client will become increasingly necessary for the smooth, fast operation of our evolving Web.

So we have enough of a rough concept of the old and faithful LAMP stack to begin looking at the relatively new development darling, Node.js and its corresponding culture of development tools, the MEAN stack. According to the Node.js website, Node uses an event driven, non-blocking architecture, and we’ll have to figure out what exactly these mean in another post. For now, we can appreciate the fact that Node uses JavaScript for server-side applications. This means that there’s no translation between server and client.

meanNode.js and everything around it are mutating rapidly with constant updates and modifications. It’s not as bad as it sounds, however, because it means it’s all getting a lot of attention, and functionality is increasing quickly. For now, the biggest chunk to know is the MEAN stack, which stands for MongoDB, Express, AngularJS, and Node.js:

  • MongoDB (from hu-mongo-us database) stores documents in JavaScript Object Notation (JSON) format. Since the client side browser is already in JavaScript, and Node allows the server side to be written in JavaScript, MongoDB simplifies the transfer of data by being JavaScript-based.
  • Express is a “Web application framework for Node.” I’m still a little fuzzy on what exactly a framework is, so from Wikipedia, “A software framework is a universal, reusable software platform to develop software applications, products and solutions. Software frameworks include support programs, compilers, code libraries, tool sets, and application programming interfaces (APIs) that bring together all the different components to enable development of a project or solution.” We’ll figure this one out together, later.
  • AngularJS is also a little confusing right now. From the AngularJS website, “AngularJS fits the definition of a framework the best, even though it’s much more lightweight than a typical framework and that’s why many confuse it with a library. AngularJS is 100% JavaScript, 100% client side and compatible with both desktop and mobile browsers. So it’s definitely not a plugin or some other native browser extension.” I’m supposed to say something smart here…
  • Node.js is, again, a platform built on JavaScript for server-side applications.

We’ve introduced most of the key, ground level elements. In the following series, we’ll work through downloading and installing these components, and then flesh out each concept and tool required as we develop a few rudimentary applications. In the meantime, if you’re rusty or unfamiliar with JavaScript, it might be a good idea to brush up. There’s a free e-textbook by Marjin Haverbeke. It probably wouldn’t hurt if I did the same.

Nate Aeilts

Nate Aeilts is currently enrolled in an internship program at MPA. Nate is a student at Taylor University, and enjoys learning about programming and new tech tools. He likes dogs and chocolate, though he acknowledges they do not mix well.

Post your comment