5 ms·
I'll never forget the day I had this book recommended to me. It's fortunate that I was two-handing old-fashioned's since I have a fear of resting on best pract
by knappador 13y ago
I'll never forget the day I had this book recommended to me. It's fortunate that I was two-handing old-fashioned's since I have a fear of resting on best practices akin to the way a Midway albatross fears the Pacific garbage gyre; the ocean seems to be moving, so I'm not stuck in one place, yet the garbage just keeps floating by, and every time I eat some, I'm a little closer to dying.
Months later, my conclusion is that web is pretty irritating, and never call Django MVC. Calling it MVT is kind of like waking up in front of a mirror and realizing you've been sawing your hand off with a fork -- a rude awakening. Think about it, templates do absolutely nothing that controllers do, nothing. MVC is convergent evolution in application programming, yet web programming kind of doesn't have it directly.
Probably the best recommendation I can make to any web developer, is to work in application programming. The biggest difference is in application state persistence and the massive indirection across caches, http, databases, sessions, message queues etc that one finds in web programming.
The second biggest difference is that instead of relying on a variety of run-times that are supposed to match a standard, there is a single run-time/program that has to rely on features of the OS and a lot more platform specific deployment hoops to jump through. However, internet explorer.
History of web development: Used to, the internet was used to network applications together. Then one day, we put the entire application on the internet. 50% of the indirection is still geared towards networking application instances, the whole global community part of the internet. The other 50% of indirection is geared towards recovering through abstraction what is missing when doing application development. Hybrid API architectures make this explicit.
I'm saying that the best way, in my experience, to get better at web development, is to work outside of web, where you find the stark lack of indirection somewhat awesome, and when going back into the web world, all of this indirection now speaks to me as if a kind of synesthesia where badly arranged furniture appears to be on fire.
Not node.js, rails, meteor, flask or cold-hard gevent http servers will make this apparent. All of web development is riddled with this indirection, top to bottom. It's almost painful to me to be helping someone learn how to program LAMP because I'm doing them the greatest good on their current trajectory while 100% conscious of how all the problems they're experiencing are in trying to pierce the indirection that is web application programming.
Let's just start calling web programming mainframe programming with soft client terminals in virtual machines called browsers and where UNIX has been replaced with a relatively massive software stack because not many people like writing OS's but everyone likes writing http servers and libraries. Don't get me wrong, I'm still making a ton of skrill on Django and web programming in general, but can we just raise the alarm a little bit? Web application programming does not seem to have the goal of abstracting on top of web stacks to make it into application programming, but rather stops at a C-like worldview where it's still possible to utterly destroy all that is consistent application state for the sake of being able to run trampolines written in assembly.
- lhc- 13y agoYou do realize that django is MVC, but that templates are not the C right? Their naming convention is kinda terrible, but the M is the models (obviously), the V is the templates (the "views") and the C is the views.py file (this is the poorly named part). If you compare to other MVC systems, those are the appropriate parts of django.
- thatthatis 13y agoI prefer to think of it as: M is obvious, V is views and templates, C is handled by django and if you need to to custom "C" stuff (which is fairly rare) you intercept the request/response flow with middleware. Your mapping, Djano's MTV ~= MVC (in that order), is not a bad way to build your conceptual model.
- knappador 13y agoRoles are mixed in Django almost without exception. I blame this on the fact that you want to make changes to M, V, and C during a UI interaction while usually only one URL gets called, and so the view updates the M, V, and C. It's like having a layer cake to keep things separate and then cutting it from the top into pie-slices. Sure it makes sense somewhat, but each slice now contains every layer. That is typical web programming. Unless you're using class-based views or Meteor etc AND hybrid-style API's, things aren't even beginning to resemble application programming with a separate network aspect to the application. These days I'd just about rather print HTML/CSS onto paper so I can at least burn it. The whole web-standards movement never grasped me as egalitarian or a good way to get FOSS into closed platforms. I know there are supporters to web, but basically I view web as pretty limited in spite of all the work that's been done with it. Templates in Django are nothing that I would call views in application programming. If I use data binding to hook up my controller state (in some way a wrapper around the model), then this has nothing to do with the M, V, or T in Django. It's a js object and not part of Django at all. Templates are a decent way to somewhat modularize HTML/CSS without falling back to generating HTML/CSS from objects and giant data-structures, which would be torture. This is not what views do.