If you were learning to program back in the old days then you remember that the LAMP stack was all the rage. Linux, Apache, MySQL, and PHP. Everything you needed to create a great web application. Can you believe that Facebook started out as a simple LAMP stack application? Now that the MEAN stack is all the rage I want to make sure you’re not putting together SPA’s using that stack as prescribed because “that’s how it’s done”. Remember, the one rule trumps all others is that you use the right tool for the job. I’ll explain here what the MEAN stack is, how it’s used, and how to know when to break the rules.
These days single page apps (SPA’s) are all the rage and so LAMP became lame and everyone started learning the MEAN Stack. MongoDB, Express, Angular.js, and Node.js. This stack allowed developers to build rich back-end web APIs with the added bonus of making it super easy to build single page applications quickly using Angular.js and AJAX requests,
Everyone knows you should use the right tools for the job so remember that the LAMP and MEAN stacks should be taken more like suggestions rather than hard and fast rules. Your mileage may vary, see official contest rules, no purchase necessary for entry, and so on… Anyway, on with the MEAN stack:
MongoDB is a schema-less NoSQL (non-relational) database. This means that you can use it to store data that doesn’t conform to a specific schema and can make schemas up on the fly. Each record you save can have different keys and values.
Express is a Node.js framework for building web applications quickly. No need to worry about how you’ll handle requests and responses. Just use Express and focus on building out your app. Express is like the Sinatra of the Node world.
The MEAN stack is the new hot thing right now. But all good developers know that while you should definitely try out as many new things as possible, nothing lasts forever and the MEAN stack’s time started running out the moment it became a thing like so many other tech stacks before it (remember Nginx, Rails, Rack, and Unicorn?). Be ready to learn ask the next stack when it comes out but don’t jump in right away if you’re unsure. Watch it a while. The MEAN stack is a great example of why.
Like we talked about the MEAN stack includes Mongo, Express, Angular, and Node. The name came about before best practices and competing technologies came out. As far as I’m concerned the “M” and the “A” are now stand-ins for any database and front end JS framework respectively. I’ve built “MEAN” apps that used MySQL and React instead of Mongo and Angular. I’ve also built apps that used both Mongo and MySQL with React (a MMERN stack if you will).
Coding is a science, sure but not an exact one. There are the people who use your app to consider. Those people don’t care about the code – they just want it to work. So if we go back to the old adage “use the right tool for the job” we find that if your proficient enough in programming you can bend the rules of these prescribed stacks so long as they make sense to you.
Rules are made to be broken. It just takes a master of those rules to know when it’s time to break them.