Live data from Hacker News

MVC is dead, it's time to MOVE on

cirw.in

111–120 of 233 posts

Re: MVC is dead, it's time to MOVE on

#111
post #108
post #96

Earlier quoted context omitted.

JSON and RSS views don't make sense - in MVC, views are visual representations of data (the model). Views are how the user percieves the application. JSON and RSS are just different methods for representing data to be communicated to other systems.

"views are visual representations of data" I see no purpose for this distinction. A view is an output representation of the model data. Given the challenge, "How much of my code survives if I drastically change the view?", I think json and rss make perfect sense. They are drastically different output representations of the data.

The purpose of the distinction is to prevent even more confusion about what MVC means.

Re: MVC is dead, it's time to MOVE on

#113
post #59
post #43

Earlier quoted context omitted.

MVC is terrible for web apps (in the original local GUI domain it's fine for some things), you aren't an idiot for using it because you're probably not actually using it but rather only something loosely inspired by it, and the solution is simply DRY. MVC at its best is simply one manifestation of DRY, but there's no real reason to get too stuck on it when with practice DRY is something you should just always be doin…

I suspect this is because most people do not actually understand what MVC is and how it applies to server-client relationships; in fact, the wikipedia article on MVC is slightly off on the subject, assuming one accepts the original Xerox description as a source. Try not to wrap the entire complicated application into one big MVC umbrella because that will just confuse. There are actually multiple processes involved,…

"The big epiphany for me was when I realized that the server has its own MVC, and the browser has its own MVC."

While I'd still advocate DRY over this POV (unless of course DRY leads you here naturally), I will agree this is a generally valid viewpoint, because you've got the server-client model built in there instead of glossed over. And you are now the first person who has gotten me to be generally agreeable about MVC used in the web world.

Which raises the interesting question of building a framework that builds this idea into the core, with server-side MVC, client-side MVC, and some sort of defined crossover instead of the usual hacky stuff that emerges from single-MVC.

Re: MVC is dead, it's time to MOVE on

#114
The author probably never heard about the 'service layer' pattern. The problem that 'MOVE' is trying to solve is a non-existing one. If you're stuffing all your logic in your controller, you're doing it wrong. The logic should be in the service layer, that's how it has always been.

Re: MVC is dead, it's time to MOVE on

#115
post #96
post #83

Earlier quoted context omitted.

my rails apps pass this test with flying colors. Nearly all of my end points have at least 3 views. 1 for html, 1 for json (often used for ajax calls), and 1 for rss/atom.

JSON and RSS views don't make sense - in MVC, views are visual representations of data (the model). Views are how the user percieves the application. JSON and RSS are just different methods for representing data to be communicated to other systems.

So it's only a view when you write all your code to push bits to the monitor yourself. Outputting using libraries that convert formats like html (-> browser -> os/driver -> screen) aren't views. Got it.

Re: MVC is dead, it's time to MOVE on

#116
post #82

MVC, more than other design patterns, is horribly abused. Developers should keep in mind its GUI roots. Here's my "is it MVC?" litmus test: How much of my code survives if I drastically change the view? For example, if I want to switch to a new desktop, web or text console interface, can I reuse much of the application? Of course, architecture changes this significantly (particularly web architecture), but still, if…

Maybe I'm doing it wrong, but I've always thought Controllers were supposed to be dumb and Models were supposed to be smart.

That is, a model encompasses extracting the knowledge and turning into something that the controller passes to a view or another model, but is not processed much (if any) during the transfer. At most, it might be combined with data from other models into an uber-record that is passed to the view.

Re: MVC is dead, it's time to MOVE on

#117
post #23

This sure looks like MVC, but they call the Controller "operations". The MVC abstraction has an issue with web applications, since the request-response cycle doesn't provide feedback as directly as the hardware-monitor-software cycle that the pattern was originally designed around. However, if the problem is that you are putting too much "logic" into your controllers, you should probably find a better place for it. I…

It's very similar you're correct, particularly when you add in the Manager/Service layer (something that I hadn't spent enough time investigating).

The main advantage of Operations over controllers is that they're fully composable. You can take the operation that logs a user in (which displays the login screen, and awaits the user typing a username and password) and use it as a sub-part of any other operation.

In a purer MVC world you get something similar to this by making a function that instantiates the login controller with its associated view; that's pretty good, but there's no obvious place to put that function.

I'll certainly be following up with more details, and some actual code.

Re: MVC is dead, it's time to MOVE on

#118
There is no MVC.

A design pattern is a reusable solution to problem, given a certain context (set of constraints).

My design pattern study group iterated over the Gang of Four book 3 times, please many others. The MVC sessions were the least constructive.

No two people could agree on what is and isn't MVC.

Or MVP. No, you're not doing it right. Oh, MVC can only be done "correctly" using Smalltalk.

Yadda yadda yadda.

I can't even begin to discuss "MVC web frameworks". Huh? Methinks the only reason for "MVC" is to justify Spring, inversion of control, containers, dependency injection, annotations, and all that other useless enterprisey J2EE-esque shovelware.

I agree with jerf's statement (upthread) that devs should worry more about DRY than MVC.

Re: MVC is dead, it's time to MOVE on

#119
post #108

Earlier quoted context omitted.

"views are visual representations of data" I see no purpose for this distinction. A view is an output representation of the model data. Given the challenge, "How much of my code survives if I drastically change the view?", I think json and rss make perfect sense. They are drastically different output representations of the data.

The purpose of the distinction is to prevent even more confusion about what MVC means.

I find the distinction more confusing, and I don't see the value.

Re: MVC is dead, it's time to MOVE on

#120

Earlier quoted context omitted.

Users are not necessarily human - they can be search engines, API consumers, etc.

In the context of MVC, a user is a human being - describing JSON and RSS services as "views" totally misses the point. Quote from the inventor of MVC, Trygve Reenskaug: "The essential purpose of MVC is to bridge the gap between the human user's mental model and the digital model that exists in the computer."

I'm a human user and I have a mental model of the json and rss apis I consume via code I write. I notice that he didn't say visual as you did earlier
Post reply on HN