Rediscovering MVC
github.com
github.com
>> new Date(1450084080 * 1000)
Date 2015-12-14T09:08:00.000ZMVC had a brief resurgence in the mid 00s with frameworks. So, everybody who learned web development during that time following MVC (mistakenly) tries to shoehorn everything into the same mental model.
For example, here's a modern Angular2 SPA + Microservice architecture in terms of MVC...
Front-End (VCVCM?C?): HTML/CSS + Routes + Templating + Services V C VC M?C?
Backend (N/A): LoadBalancer + Node HTTPD (*N Instances) + Cache + Database ? See Below ? ?
HTTPD (CMCC): StaticFileAPI + DataAPI + RedirectCatchallAPI C MC C
Altogether that makes this a VCVCM?C?CMCC
It's like devs who learned one OOP language and thing everything in the world that can't be described in OOP terms is garbage.
OK, so now that I've probably offended both the MVC and OOP crowd. Can we call this what it is?
Separation of Concerns...
Expand your perspective a bit. Try out a new worldview or two. See if you can find one where you don't have to 'hand wave' away the details.
MVC only really works to describe self-contained, monolithic, desktop applications. Even when it was applied to web development, it only really described the backend server portion and completely ignored the role the client.
Moral of the Story: Network architectures are inherently complex and multi-layered. That's what makes them so powerful. With well defined APIs it's possible to break out of a monolithic application mindset and do very interesting things.
Which you can apply MVC to. In multiple ways. If you want to use that as a way of abstracting the concepts.
Maybe you think that input->process->output is too simplistic to be the answer to every software engineering problem ?
I'm saying that the term MVC has been diluted and misused to the point that it no longer carries a specific -- and therefore useful -- meaning. It has become web 2.0 part deux.
Maybe you think that input->process->output is too simplistic to be the answer to every software engineering problem?
In the most general and abstract terms, no. Likewise, what value is to be gained from discussing application architecture in excessively general and abstract terms?
Then we have "Javascript MVC" frameworks like Angular, which have "bindings" and this makes them MVC.
Then I think about the Server-side web programmers (i.e. Rails) which are also "MVC" that render the whole response for a request.. the view is often just a template. This is also "MVC".
Basically the term has completely lost it's meaning at this point.. It's simply a pejorative term now, because we don't take the time to name/reveal the particular things we don't like about certain frameworks, we just call them MVC.
- MVC
- REP[L]
- * I forgot the other ones *I'm talking about doing complex querys on your data done through a sophisticated ORM like that of Django for example. Having relations in your data instead of having to loop trough all your arrays or doing REST calls all the time.
In that aspect I think there's still a lot of nice steps to be made in client side development.
In the terms of the 1970s breakdown presented in this article, a DOM node is both a view (presenting information to the user) and a controller (collecting and forwarding UI events).
MVC is a fine pattern, but underwhelming when taken as an architecture. It doesn't tell you how state will be managed and reasoned about, which along with asyncronous sequencing is the main challenge of browser development. Server side MVC doesn't really have this problem because at the end of they day the lifecycle of a HTTP request is relatively limited. Most JavaScript MVC libraries have their own answers for how state should change, but just being answers does not necessarily make them complete, good, or right for your application.
My general strategy these days is to avoid parts of my code having to know that other units are "a Backbone collection" or "a React view", and instead to have those as implementation details that I wrap in a smaller, more limited API. Instead of a framework I just use an event bus with a catalog of events that are very specific to my application. In a way this creates a "data" or "service" layer that has to fulfill event contracts, which are basically abstractions over HTTP, websockets, local storage, etc, and a "statically allocated" view layer that only knows how to respond and trigger a few events on the bus. You might call that MV and say that the C is somewhere, but to me that's more confusing than helpful.
When you grasp how it works, things fall into place very well, with no abstractions, polymorphism or similar things that makes the code divided and very hard to reason about.
"So there is the slightly strange paradox that, after all those years of work, the first three books are essentially complete and, from a theoretical point of view, do quite a good job of identifying the difference but actually do not accomplish anything. The conceptual structures that are presented are just not deep enough to actually break down the barrier. They actually do not do anything."
1994, so well into the 90's decade. OP, if you're reading, this is a big blunder that takes away from what is otherwise an insightful post.