tl; dr; — In this article, I argue that MVC/MVVC isn’t right for projects of certain size and complexity and introduce you to Remake which lets you drop the C of MVC.
This is Part 1 of a two part series on
remake-serverless. Here is Part 2 which explains
remake-serverless in more detail.
The Case against MVC
It is received wisdom that for web projects, the multi layer MVC/MVVC architecture is the right way to go about designing our system.
To be fair, in many cases, this architectural dogma is absolutely right. E.g., for ecommerce shops having a model (M) layer where you can add products and product related content without having to touch the website (V) is useful.
Yet, at times, following the MVC paradigm increases the complexity of a system with no discernible upside. E.g., if I am a solo developer launching an MVP, do I have to have a separate model layer?
In fact, NoSQL products like MongoDB emerged to address the need for a more flexible model whose final, stable structure you discover along the way as the product matures.
Even so, having a Model forces you to set up some sort of persistent database be it Relational or NoSQL. And this is often unnecessary for many use cases.
Let’s take an example — say you are building an online bookshelf where you show book jackets with some basic information about books you own or have read.
Does this really need a database layer? Does it have to be ACID? Run at web scale? Support multi-user updates, offer concurrency protections, consistency guarantees?
Even the most ridiculously voracious reader has probably read somewhere around five thousand books in their life time. The simplest backend for this would be a csv/json file containing all the books you have read.
Therefore, I’d say that you probably don’t need a database layer at all.
Context Switching is hard
In addition to the complexity it introduces, for small teams and solo developers, context switching between different layers adds cognitive load and forces them to create handshake APIs (the…