Using MEAN - Choosing the stack for InDEx
Identifying the role that technology plays now and in the future is crucial. We should always seek to future-proof our developments to ensure they remain relevant in the short/medium term. We are at the start of the InDEx project project; where we are mindful of selecting the most suitable technology platform to take us into the future. One of the first decisions we have to make is: which full-stack (otherwise development/production environment) should develop with. For the uninitiated, the term full-stack means working with all the layers from the back-end to the front-end technologies.
For many years, the standard environment was referred to as the LAMP and it primarily involved Linux, Apache, MySQL and PHP or Perl or Python. However, due to the resurgence of Javascript, and its ability to function both client and server-side, there's now a new stack which some considered as an alternative to LAMP; MEAN stack.
The MEAN stack includes MongoDB, ExpressJS, AngularJS and NodeJS and is gaining popularity in the industry - not so much in research. However, the questions remains, why choose MEAN over LAMP? LAMP after all is a tried and tested method that has been around for many years.
I just wanted to briefly mention some pros and cons to both technologies.
LAMP (Linux, Apache, MySQL and PHP)
LAMP stack is one of the most common packages you will find in any development environment. LAMP is composed of Linux as the operating system, Apache as the Web server, MySQL as the relational database management system and PHP as the object-oriented scripting language. It is made up entirely of free, open-source software which have been design to function with dynamic content and applications.
A drawback of the LAMP stack is that you are locked in to using a variant of Linux.
MEAN (MongoDB, ExpressJS, AngularJS and NodeJS)
The MEAN stack is the most modern stack on the market, powered solely by Javascript. This is an important aspect; for a LAMP stack you have to master numerous coding languages however for a MEAN stack you only need to know one - JavaScript. Coding in a single language saves significant amounts of time (resulting in money/time saved). Further, MEAN is designed for a cloud environment (LAMP has associated challenges for deploying in the cloud).
Benefits of MEAN over LAMP
There are some good reasons why MEAN has the upper hand over LAMP. I wanted to mention some of these:
- Node.js lets you to write server side applications using Javascript. Previously you only used to be able to use JavaScript client (browser side). Technically, Node.js is quicker than other technologies due to its non-blocking architecture, which makes it quicker than LAMP.
- AngularJS is an open source client-side JavaScript framework developed by Google. AngularJS solves many cross-device rending issues by using a extended HTML vocabulary. This makes the development reusable, maintainable and usable on client-side applications developed with JavaScript.
- MongoDB is a document-oriented database allowing you to store records in JSON format, JSON stands for JavaScript Object Notation. Therefore, it is the standard database architecture to utilise when employing JavaScript. Side-note: If you prefer another database such as MySQL or NoSQL you can still utilise these with API. No need to get rid of those databases for MongoDB!
- Expess.js is a minimal and flexible server-side script interfacing with Node.js web application framework to provide a robust set of features for web and mobile applications.
Conclusion
While LAMP may become outdated in the future, it still has a place in the stack environment - notably in research. However, MEAN stack is innovative, new and cutting-edge with state-of-the-art technologies making it the technology of the future. That is why we selected the MEAN stack when developing for the Medical Research Council funded InDEx project.
Resources
You may find these resources useful when developing with MEAN:
- Book: Getting MEAN with Mongo, Express, Angular, and Node by Simon Holmes
- Book: Write Modern Web Apps with the Mean Stack: Mongo, Express, AngularJS, and Node.js (Develop and Design) by Jeff Dickey
- Create a MEAN Page Single Page Application