News for hackers. Stuff that matters.
Re:What web developers thought of in the noughties as being ... by jerf on Friday May 16, 2014 @10:32AM (#7755691)
"The sleight-of-hand was the assumption—baked into the servlet spec—that each HTTP request would map to a single controller which would delegate to a single view."

I've been struggling for a while to explain why I don't like MVC in web apps. Some of it is definitely just annoyance at how "MVC" has come to be simply a synonym for "good design" without any particular reference to any particular design, resulting in the term MVC being smeared over anything that has three classes that have a vaguely-plausible claim to fitting some interpretation of a "model" (this is the one most often got most correct), "view", or "controller" (both these latter just sort of get slung about with wild abandon). Despite how long it's been around, it is certainly a fad in every sense of the term, including large numbers of coattail riders and hangers on who don't really "get it".

But beyond that, regardless of what the "MVC" is, we've still got some sort of separation going on. But the separation is often pointless. The original MVC in the GUI arena was written for Ms, Vs, and Cs to be highly interconnected, not in the "coupling" sense but in the sense that there should be a significant number of many-to-many relationships between all the layers. But a lot of web "views" and "controllers" are used in only place, talking to only one other "thing", or perhaps the view talks to three "controllers" each of which is used nowhere else. The models are often reused, but more as just a data access layer.

If you don't have rich and free mixtures of all three pieces going on, you've split out your design on a useless dimension, and blown valuable design budget for a feature you're not going to use. And MVC is particularly designed for simultaneous usage of multiple things... one of the touchstones of needing the MVC model is when you have two simultaneous dynamic views on the same data, which multiple controllers may be simultaneously affecting. If you don't have that, seriously question your use of MVC.

Every once in a while, you may encounter a web app that really does deeply mix and match, in which case, go nuts. But it's going to be a special-purpose thing, not something used by everything. It's not always inappropriate... it's just that it's not anywhere near always appropriate, and it's appropriate rarely enough that it is, frankly, a stupid default for a web framework. Further, it's something that you can easily fold in only where needed; oh, do you have a statistics component where you really are using simultaneous views on the same underlying mutable data (perhaps a query)? Sure, use MVC for that. But as a default code structure? Be sure that mixing and matching Ms, Vs, and Cs at scale (not "I have this one class out of dozens that may sometimes need two views" but "this combination of 5 models, views, and controllers will be nearly arbitrarily mixed and matched") really is how your app's needs are going to change over time.

Re:What web developers thought of in the noughties as being ... by mattgreenrocks on Friday May 16, 2014 @11:19AM (#7755927)
MVC in Web frameworks won by being watered down to almost nothing, repackaged, and sold in a manner that appealed to non/novice/intermediate devs. They were told that if they put their code in these tightly-coupled boxes, then they wouldn't have to worry about all those hard things like design or coupling. Instead, development could almost be a process of coloring by number so that anybody could do it. And they were told it was good design because it was MVC, which is an acronym that smart people talked about long ago, so it must be good. And they were told they were being saved from those other developers who have the gall to do things differently!

I cannot overstate the appeal of a prescribed architecture. This removes some of the essential anxiety a newer developer has when building things by narrowing the available choices. Rather than fret about where to put things, and how much objects should do, they have two neat categories to choose from. The problem is a novice/intermediate dev often knows they should be thinking about the design, but they don't know where to put things, so they waffle about things rather than just putting it somewhere and trusting themselves to fix it when they're wrong.

Combine a prescribed architecture with a relentless marketing campaign that repeatedly tells developers exactly what they want to hear: "blog in 15 minutes!", "design is wankery, just use the framework!", "testing just isn't worth it, it's too hard".

This is anti-intellectualism. It advocates ignoring software engineering principles established over the past few decades, and ignoring design feedback in the name of pragmatism.

Don't entrust your skills to a crappy framework. It will fade, much like the Web.

Re:What web developers thought of in the noughties as being ... by Zelphyr on Friday May 16, 2014 @12:05PM (#7756181)

    Don't entrust your skills to a crappy framework. It will fade, much like the Web.
I've been lambasted for my agreement with that statement. But, regardless, I'll go so far as to suggest that one shouldn't entrust their skills to a framework at all. They're all crappy.
Re:What web developers thought of in the noughties as being ... by mattgreenrocks on Friday May 16, 2014 @12:23PM (#7756268)
Yes, they are.

The near-religious association devs have with frameworks seems to have almost displaced the association they had with languages. I'm not sure what prompts it, but frameworks die out even faster than languages. You don't have to work very long in the industry to see this happening.

Don't sweat that opinion, BTW. HN is not very kind to any sort of software engineering discussion. I presume this is a direct fallout of the Lean/"move fast and break things" ideology.

Re:What web developers thought of in the noughties as being ... by Zelphyr on Friday May 16, 2014 @01:01PM (#7756489)
Ironically, I'm in favor of using frameworks for when you need to move fast and break things. You're effectively creating a working prototype to test the idea in the market and thats one area where frameworks are useful. The problem is that then the developers always build the actual production version on that working prototype instead of taking what they learned and doing it right.

I'm sure someone will say, "but it takes too much time to rewrite it!" which in my experience is wrong. In fact you'll rebuild it faster because of what you learned in developing the prototype.

Re:What web developers thought of in the noughties as being ... by DonHopkins on Friday May 16, 2014 @07:15PM (#7758452)
Sometimes the best thing that can happen to you is that you never get around to backing up your laptop with your working prototype, and somebody breaks into the trunk of your car late Tuesday night while you're parked on the street around the corner from the Stud at 9th and Harrison, eating grilled hot dogs wrapped with bacon and smothered with caramelized onions at Trannyshack, and steals all your hard work, so you have to rewrite it all from scratch.
Re:What web developers thought of in the noughties as being ... by ChikkaChiChi on Friday May 16, 2014 @02:41PM (#7757151)
I've felt the same way about ORMs. I've never understood the appeal of abstracting away from writing your own queries which is the closest to natural language as programming comes.
Re:What web developers thought of in the noughties as being ... by curun1r on Friday May 16, 2014 @05:30PM (#7758032)
The appeal of an ORM has never been about abstracting away the writing of queries...almost every developer I've met is comfortable writing SQL queries. But the appeal of an ORM framework is in not having to write the code that maps the results of the sql query to/from the properties of an object. When you combine the annoyance of writing and maintaining that type of code with the realization that the majority of queries you end up making are one of the CRUD operations and you it completely explains the popularity of ORM frameworks. It's about not having to constantly write code that could just as easily be written by a CS 1 student.

ORM systems almost universally suck, but so does the alternative.

Re:What web developers thought of in the noughties as being ... by tveita on Friday May 16, 2014 @12:51PM (#7756432)
> But beyond that, regardless of what the "MVC" is, we've still got some sort of separation going on. But the separation is often pointless.

Django divides things into models, views and templates, which correspond to most other web frameworks' models, controllers and views.

One reason this division makes perfect sense is that the views and templates are worked on by different people. The templates are mostly HTML with some markup language and will be the responsibility of the designers. The views and models provide functionality and will be worked on by more backend-oriented programmers.

Another reason is that the views are actually reusable. You have generic views for browsing a model by date, or for a simple edit form. You can bind them to a model and skin them with a template to quickly get basic functionality that would otherwise require boilerplate.

Re:What web developers thought of in the noughties as being ... by mattmanser on Friday May 16, 2014 @11:10AM (#7755876)
I'll tell you one thing that I do not doubt. The splitting of the M, V & C is far better than bundling them in one page.

I'd take a crap MVC design over the pre-MVC stuff I worked on any day of the week.

The thing you don't seem to be saying is what you're doing instead? You're just waving hands at the moment and saying it's bad, but it used to be much worse.

Re:What web developers thought of in the noughties as being ... by jerf on Friday May 16, 2014 @01:02PM (#7756492)
"The thing you don't seem to be saying is what you're doing instead?"

DRY. Just, DRY. If DRY leads you to MVC, rock on. But DRY is the real thing. It isn't a framework, and you have to think about it. But it's what you're really trying to do.

You're trying to define yourself the win by imputing to me a motivation to go "back" to crappy design. It's quite disingenuous, since I just got done complaining that MVC is often a crappy design, and logically concluding from that that I must want crappy designs is ludicrous once I call it out.

And if you further feel inclined to say "But you didn't give me an answer!", well, the need for "one" answer is part of the problem. There isn't one answer for which design structure will lead you to the DRYest design. Sometimes it'll be MVC. But you have to think. Not just knee-jerk MVC and think you've "designed".

Re:What web developers thought of in the noughties as being ... by DonHopkins on Friday May 16, 2014 @07:32PM (#7758506)
The whole idea that all problems can be broken up into three different essential concepts that you can describe with a TLA seems like a throwback to the Christian doctrine of Trinity: the Father, Son and the Holy Ghost. They're one God in three persons, monotheistic polytheism! Monolithic polymorphism!

People seem to think that if you dress software architecture up in the trappings of religious dogma, then it's easier to evangelize and recruit people to your cause. Well maybe they're right: it kind of worked for Larry Wall, for a while...

It usually turns out that there are more like 17 different essential concepts that you need to get a complex software project off the ground, but 17LAs like MVPATQSDYKRFXZFHW aren't as catchy, and are too hard to remember and pronounce, so they end up cramming everything that's not obviously M or V into the kitchen sink C.

DRY is great, but you should also DRTMOTP: Don't Repeat The Mistakes Of The Past!

Re:What web developers thought of in the noughties as being ... by mattgreenrocks on Friday May 16, 2014 @11:22AM (#7755943)
It's still the wrong approach to the problem.

Desktop app UIs were never this painful. Even Swing's.

Re:What web developers thought of in the noughties as being ... by king_magic on Friday May 16, 2014 @02:34PM (#7757095)
Desktop app UIs were never this painful? WPF, WinForms, WTL, MFC... all could be pretty darn painful when you got beyond the basic Hello World examples.
Re:What web developers thought of in the noughties as being ... by AnimalMuppet on Monday May 19, 2014 @03:32PM (#7769301)
Interestingly, MFC was painful at least partly because instead of MVC, it wanted to drive you toward a Document/View architecture, where Document had both Model and View. This was painful exactly because of some of the problems that MVC was designed to fix.
Re:What web developers thought of in the noughties as being ... by endlessvoid94 on Friday May 16, 2014 @12:07PM (#7756194)
That's a really good point.
Re:What web developers thought of in the noughties as being ... by pgeorgi on Friday May 16, 2014 @12:38PM (#7756345)
A good counter proposal to the "typical" server-side web architecture is seaside (www.seaside.st).

Its tutorial (A walk on the seaside on http://seaside.st/documentation/tutorials) is rather basic, but shows the concepts well. (edit: longer article http://book.seaside.st)

Of course it has a different set of quirks to get used to, so it's not a cure-all - but it gives a different perspective on web-things.

Re:What web developers thought of in the noughties as being ... by benjaminpv on Friday May 16, 2014 @12:15PM (#7756232)
Solid copy on this. I'm under no delusions that MVC is The One True Way to handle architecting software, but I'll take it over joining a bunch of strings to generate a web page.

I'd say anyone upset over MVC's leaky abstractions could better funnel that energy spent into making something better but I can't help to think that no software project is ever going to so neatly conform to having a structure imposed upon it.

Re:What web developers thought of in the noughties as being ... by mattgreenrocks on Friday May 16, 2014 @12:25PM (#7756275)
> I can't help to think that no software project is ever going to so neatly conform to having a structure imposed upon it

That's the problem with prescribing an architecture ahead of time. That's why you learn the basics and improvise/draw on established architectures as the project evolves.

Re:What web developers thought of in the noughties as being ... by ollysb on Friday May 16, 2014 @12:07PM (#7756193)
Yeah, enough with the hand waving. I can't say I've ever experienced any pain using MVC for web apps but I'm very happy to be enlightened. Let's see the side-by-side code examples (or if someone can can at least explain what they're doing instead I'll have a crack at it :) ).
Re:What web developers thought of in the noughties as being ... by josephschmoe on Friday May 16, 2014 @12:38PM (#7756354)
Agreed. MVC is vastly, vastly superior to what people, especially inexperienced programmers, "naturally" seem to do - which is to dump their models into their views.
Re:What web developers thought of in the noughties as being ... by richroc6 on Thursday May 29, 2014 @05:53AM (#7815476)
Ok St. Joe... Perhaps you should google "Martin Fowler empty bags of getters and setters" for a dose of real domain model justification. There are too many outright false assertions in the MVC camp. WebForms encourage mixing code and markup? Actually, they fairly obviated that practice which slowly JIT compiles into the crappy GUID-name microlibs now predominant in Razor CSHiTMeaL views. Much easier than viewstate and page lifecycle? Only if you call the necessary AJAX, LINQ, and routing trivial. In all of the examples I have seen, ASP.NET MVC views only route back to a single controller, which makes them pretty tightly coupled, thus no better than web forms. I pity the "inexperienced" programmers subject to your review.
Re:What web developers thought of in the noughties as being ... by richroc6 on Tuesday June 03, 2014 @09:11AM (#7839914)
Correction, Google AnemicDomainModel Martin Fowler
Re:What web developers thought of in the noughties as being ... by DonHopkins on Friday May 16, 2014 @12:07PM (#7756189)
> I've been struggling for a while to explain why I don't like MVC in web apps.

That doesn't sound like struggling to me -- you've explained the fundamental problems with the MVC Cargo Cult perfectly! I'd love to read what you write when you don't feel like you're struggling. ;)