LAMP vs. MEAN: Which Stack Is Right for You?
Looking for a new tech stack for your next project? Read on for a comparative look at these two popular stacks for web app development.
Join the DZone community and get the full member experience.
Join For FreeA web stack is a collection of software or technologies that are used to build a web application. There are plenty of choices, but picking one can be hard.
When chatting with co-workers, developers or customers, suggestions for what technologies and stacks to use couldn’t be more different. When I started off as a web developer, I went the usual way at that time: learning HTML and CSS, exploring some PHP – and of course MySQL. That was, if you were not using Java or ASP.NET, the technology stack of that time. Whether you wanted to host a blog, a bulletin board or become an image hoster – you would more than often need these things: Linux, Apache, MySQL and PHP (LAMP).
Here is a detailed overview of LAMP and the relatively new MEAN stack, which are currently the most popular open source web stacks and a brief overview of other stacks. Whichever stack you choose, Bitbucket works with them all.
LAMP
LAMP delivers a strong platform for developing and hosting large, performant web applications. With the biggest and oldest community, countless libraries and tools, you get great support and will find developers quite easily.
Its integral components are:
- Linux (OS)
- Apache (Webserver)
- MySQL (Data persistence)
- PHP (Programming language)
There are also some derivatives of this stack:
- LAMP (with Perl or Python instead of PHP)
- LAMP (with MongoDB instead of MySQL)
- WAMP (Windows as OS)
- MAMP (Mac OS X as OS)
- XAMPP (Any OS + Perl or PHP + FTP Server)
- LAPP (PostgreSQL as database)
LAMP Stack Pros
LAMP is kind of the dinosaur of web development, used by hundreds of thousands of companies and therefore maintained and supported very well. With endless modules, libraries, and add-ons available you can adapt it to your company’s needs.
Being Linux-based, you will find help for any topic in the large open source community. MySQL is a very reliable and scalable solution. PHP is in version 7 and is also supported by a mature and big community. PHP is also very fast and integrates well with the rest of the stack.
You can control the server and decide which versions and software you install, so you don’t have to depend on the client’s browser. It works best if you have lots of server-side tasks.
LAMP Stack Cons
Because it’s easy to learn, there are a lot of developers out there who are not following best practices and building garbage apps. Starting with PHP is easy, but mastering it is hard. This is also true for security in these PHP apps. Some would also describe it as a scripting language instead of a real programming language because it’s not strongly typed and not pre-compiled. I’d recommend diving deeper into the pros and cons of PHP, Python, and Perl.
As for MySQL, other options are becoming more mature. NoSQL databases like MongoDB are popular among enterprises today due to their scalability. Plus, pure JavaScript Stacks like MEAN gain more traction every year and new developers might not be interested in learning all of the skills required by LAMP.
MEAN
Compared to LAMP, the MEAN stack is fairly new. One of its biggest differences is that MEAN is not dependent on a specific operating system – Node.js takes care of server-side execution. The MEAN Stack is especially recommended for JavaScript enthusiasts – as it uses JavaScript at all levels. This also makes it preferred by new developers.
MongoDB is a popular and flexible document-based, NoSQL database, compared to MySQL’s relational database system. Angular helps build progressive and modern web apps.
Its components are:
- MongoDB (Data persistence)
- Express.js (server-side application framework)
- Angular (client-side application framework)
- Node.js (server-side environment)
This stack has some derivatives too:
- MERN (React instead of Angular)
- MEEN (Ember.js instead of Angular)
MEAN Stack Pros
Using JavaScript as the primary programming language is a huge advantage. Everything can be set up quickly and done in JS, which makes it much easier to find developers, and LAMP developers typically know JavaScript as well. MongoDB is very popular for its easy schemaless data persistence and is faster than MySQL if you have a lot of read requests. The fact that Angular is maintained by Google is also a big plus. It receives new releases and functions on a constant basis. Another huge advantage is the ability to easily build mobile or desktop apps, for example with Ionic. Code and components can easily be reused or added.
MEAN Stack Cons
Like all new technologies, MEAN’s glamour is creating some hype. Developers fall for this hype and build their apps in JavaScript, just because it’s trendy. Many of these libraries and frameworks are quite new, and new versions get released quickly, so maintaining your app can become quite a hassle. Since many technologies disappear after a few years, sustainability can become an issue. It’s also harder to maintain a clean code base and follow best practices as your app grows. Further, you have to rely on the client and the client’s available technologies e.g. if you are targeting IE users, embedded systems or low end PCs, there may be usability issues.
A Few Other Stacks to Consider
WISA
Windows Server / IIS / Microsoft SQL Server /ASP.NET
Not open source, but all components are from Microsoft, so it should work seamlessly.
LAMP (With MongoDB)
Linux, Apache, MongoDB, PHP
NoSQL Databases like MongoDB can also be used in a classic LAMP environment.
Ruby Stack
Ruby/Ruby on Rails/RVM (Ruby Virtual Machine) / SQLite
This stack is losing popularity. Ruby on Rails was an often used framework once, and thus the whole stack.
Java+Spring
Preferred by large enterprises and shied away from by indie developers for its complexity, Spring offers an entire full-stack framework written in Java.
Django Stack
Python / Django / Apache / MySQL
The Django framework is loved by Python developers, delivers performance, and is often referred to as an easy to learn stack.
Which Stack Is Used More Frequently?
It’s hard to compare the popularity of stacks, but you can use Google Trends to compare programming languages and get a feel for what people are searching for. As the chart below shows, JavaScript is searched for more than PHP right now.
I’d recommend checking development trends using Google’s trend tool from time to time.
I’d also suggest diving deeper into databases (SQL vs. NoSQL) to gain a basic understanding of the two concepts and make a choice.
So, How Do You Pick a Stack?
Picking a stack depends on many factors. If you are a developer or project owner, here are a few questions to ask yourself.
- What kind of web application am I planning to create?
- What is its expected lifetime?
- What technologies are available at my customer’s/client’s /cat’s/… infrastructure?
- How easy is it to find developers to maintain the application?
Let me give you an example. Let’s say you have a website for listing used cars. It was developed using a LAMP stack a while ago. But your website lacks a backend for used car dealers, where they can manage their listings on your website. Depending on your company size, time, and budget, you have to ask yourself all the above questions. If you have a small team, it might make sense to extend your existing application into a LAMP environment. Since your developers know the ecosystem and it’ll be much faster. If you have time and resources to spare, you could take another approach and extend your existing LAMP application with an API. Later, your team could focus on developing a small, standalone (M)EAN application, that can easily be maintained, improved with new features, and released using a much faster cycle.
Another example: You want to build a newsletter platform, where people can sign up, upload mailing lists, compose mail, and so on. You could of course use MEAN, but you have large scale and high traffic potential. It may make more sense to use a LAMP stack as your foundation, since Linux, MySQL, and Apache provide a stable, scalable environment with lots of community support for any problem. You will also have lots of server-side tasks and cron jobs and will encounter mailing topics like SMTP and so on. I would recommend a Linux environment customized to your needs in this case.
Here is a summary of things to know/consider.
MEAN | LAMP |
|
|
If you are new to programming and web development, ask yourself:
- What is the easiest to learn for you and your team?
- What technologies are trending and which will win in the long run?
- If open source, could you imagine contributing to the project?
- Which technologies will serve you personally in the long term?
A great resource for finding answers on JavaScript technologies is the StateOfJS project – https://stateofjs.com/. It’s a project that conducts a survey every year asking thousands of developers on their opinions on current technologies and salary.
Published at DZone with permission of Christoph Heike. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments