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.
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.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.
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.
ORM systems almost universally suck, but so does the alternative.
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.
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.
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".
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!
Desktop app UIs were never this painful. Even Swing's.
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.
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.
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.
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. ;)
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.