title: Put the knife down and take a green herb, dude. |
descrip: One feller's views on the state of everyday computer science & its application (and now, OTHER STUFF) who isn't rich enough to shell out for www.myfreakinfirst-andlast-name.com Using 89% of the same design the blog had in 2001. |
FOR ENTERTAINMENT PURPOSES ONLY!!!
Back-up your data and, when you bike, always wear white. As an Amazon Associate, I earn from qualifying purchases. Affiliate links in green. |
|
Wednesday, May 30, 2012 | |
Note that nothing said here should be taken as anything other than the ramblings of a madman. From the apparently fairly seminal doc, Applications Programming in Smalltalk-80(TM): How to use Model-View-Controller (MVC) by Steve Burbeck, Ph.D.: In the MVC paradigm the user input, the modeling of the external world, and the visual feedback to the user are explicitly separated and handled by three types of object, each specialized for its task. The view manages the graphical and/or textual output to the portion of the bitmapped display that is allocated to its application. The controller interprets the mouse and keyboard inputs from the user, commanding the model and/or the view to change as appropriate. Finally, the model manages the behavior and data of the application domain, responds to requests for information about its state (usually from the view), and responds to instructions to change state (usually from the controller). [emph mine] I think that does it. MVC means you've got a View (what the viewer sees), the Controller (controlling what happens to a user's input) and a Model (what encapsulates the data itself). I'm going to try to go with that. It's like 3-tier, but with two one-way roads going from your UI to your data management tier, one for what your app is showing the user, and another one-way road designed for what to do with your user's responses to what they see in the view. That would make Fowler's image of MVC make more sense: local copy of image
As well as his explanation of the "missing" line between View and Controller:
Essential dependencies between model, view, and controller. (I call this essential because in fact the view and controller do link to each other directly, but developers mostly don't use this fact.) Note that the arrows are pointing the right way. The View does ask the Model for data to display. The Model does not push to the view. That's the first time I've seen MVC described in a way that makes sense, so I'm latching on like a bit bull, right or not. Ah, this makes more sense. It's one-way roads from the Model's point of view, but occasionally the Controller might yell at the View to save it a trip to the Model. Communication Within The MVC Triad Though note that this only works on a locked resource in the Model, like the text editor hypothetical here. You can't do passive (well) in practice without very stringent locks, which is what the next section in the doc explains -- you need to have the View listening to the Model for changes, and event handling is born. Say someone else (an object other than its own Controller) changes the string that the text editor is editing -- the View needs to be alerted. And complex listening is born. And since we can nest Views (a window holds multiple text boxes, eg, and both the Window and each text box has a View and a Controller) and since each needs to listen in on [different?] Models and Controllers in case of change (Controller says button for "Create new text doc" is pressed; wipe the View at the Window level and start over), what we've really got is an exceptionally finely channeled encapsulation for UI design that works well within, for instance, a 3-tiered setup. I think the bottom line is that MVC gets complicated quickly with a complicated UI, but to fully flesh it out causes some slick encapsulation and very easy maintenance. Afaict, IANAL, LMNOP. In other vents, did I mention I hate the new Blogger interface? Hate it. It's so far from WYSIWYG that a 6 year-old could do better. What's wrong with the beautiful simplicity of the current Edit Html tab that I love, and that used to pop up with BlogThis? Seriously, I have to double check my View (har) every time I freakin post from BlogThis now. I HATE THE NEW BLOGGER INTERFACE. HATE HATE HATE HATE HATE. No kidding. Labels: blogger, code, mvc, noteToSelf posted by ruffin at 5/30/2012 10:03:00 AM |
|
| |
MarkUpDown is the best Markdown editor for professionals on Windows 10. It includes two-pane live preview, in-app uploads to imgur for image hosting, and MultiMarkdown table support. Features you won't find anywhere else include...
You've wasted more than $15 of your time looking for a great Markdown editor. Stop looking. MarkUpDown is the app you're looking for. Learn more or head over to the 'Store now! |
![]() |
|
|