[LIP] MVC is not OO

Sandip Bhattacharya <[email protected]>
Newsgroups gmane.user-groups.linux.india.programmers
Organization Puroga Technologies Pvt. LTd.
Message-ID <[email protected]>
[I found a really interesting article on building interfaces to OO 
systems. The article is delightfully irreverent. :) - Sandip ]

http://www.javaworld.com/javaworld/jw-07-1999/jw-07-toolbox_p.html

[...]

I'll explain the whys and wherefors in a moment, but here are some rules 
of thumb that you can apply to see if you're really looking at an 
object-oriented system:

    1. All data is private. Period. (This rule applies to all 
implementation details, not just the data.)
    2. get and set functions are evil. (They're just elaborate ways to 
make the data public.)
    3. Never ask an object for the information you need to do something; 
rather, ask the object that has the information to do the work for you.
    4. It must be possible to make any change to the way an object is 
implemented, no matter how significant that change may be, by modifying 
the single class that defines that object.
    5. All objects must provide their own UI.

If the system doesn't follow these rules, it isn't object-oriented. It's 
that simple. That's not to say non-object-oriented systems are bad; 
there are many perfectly good procedural systems in the world. 
Nonetheless, not exposing data is a fundamental principle of 
object-oriented systems. If you violate your principles, you're nothing, 
and the same goes for object-oriented systems. If a system violates 
object-oriented principles, it isn't object-oriented; it's some sort of 
weird hybrid that you may or may not ever get to work right.

[...]

This extract-data-then-shove-it-elsewhere approach requires you to know 
way too much about how the model-level objects are implemented. A system 
based on that approach cannot be called object-oriented: there's just 
too much data flowing around for the system to be maintainable. 
Unfortunately, many programmers mimic the MVC architecture in their own 
hand-built code, so this non-object-oriented design is endemic in some 
programs.

[...]


-- 
Sandip Bhattacharya
sandip (at) puroga.com
Puroga Technologies Pvt. Ltd.
Work: http://www.puroga.com        Home: http://www.sandipb.net

GPG: 51A4 6C57 4BC6 8C82 6A65 AE78 B1A1 2280 A129 0FF3



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.