[Tutor] designing POOP
alan.gauld at btinternet.com
Fri Feb 15 10:07:54 CET 2008
"Tiger12506" <keridee at jayco.net> wrote
> up. I like things to be explicit, and don't care for the level of
> abstraction common in MVC. I know it seems naive, but I like to be
> able to
> model object designs after tangible things, and to me, a View does
> not know
> how to keep a state or execute methods because it does not exist. A
> Controller does not exist alone of the model, and without the view
> it fails
> to work.
That's an interesting take and depending on which description of MVC
you read you could be forgiven for seeing it that way.
The original Smalltalk MVC however was very tied to the hardware.
The Model was the abstract thing, the View was the Output device
(usually the screen representation) and the Controller was the Input
device (usually the keyboard/mouse combo). You could swap
controllers to accomodate pens, sensors or whatever, and you
could swap Views to accomodate plotters and printers as well as
just showing different graphical forms.
Other versions of MVC have tended to move away from that style
and focus purely on the software elements but the concept of
mapping Views to screens and Controllers to mice/keyboars
is usually still there. So in principle its the View and Controlller
that are real, the model is just abstract data...
> Sure it helps tremendously in interchanging code pieces-reusability
> a big issue here, but for my purposes, it just seems extraneous.
It is a big reuse benefit but you need to write a lot of apps on
the same platform for that to become obvious. The other tangible
benefit s the flexibility it gives an app. It becomes almost trivial
to add a new perspective on the data or to convert an app from
CLI to GUI to Web. But if you are writing apps for a strictly one-off
use the benefits of those are a moot point.
> Asking what I use in its place very neatly makes me blush
> because I use no set model, but tend to mix them at my
Don't blush, if you can get a GUI app to work without using
MVC you are probably approaching it with a fresher mind than
I would since I have been "trained" into MVC thinking. I would
literally struggle to architect a GUI application without MVC
nowadays! Or at the very least the MV parts of it, I do often
work without an explicit controller element in smaller apps,
especially in Delphi and Tkinter.
More information about the Tutor