Re: [LIP] MVC is not OO
Shridhar Daithankar <[email protected]>
| Newsgroups | gmane.user-groups.linux.india.programmers |
|---|---|
| Organization | Persistent Systems Pvt. Ltd. |
| Message-ID | <[email protected]> |
Sandip Bhattacharya wrote: > [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.) Academic principle I would say. Not all practicalities can be modelled in such a fashion.. I question the motive behind placing such a restriction. What happened to good old returning a const pointer? It still maintains encapsulation, isn't it? > 2. get and set functions are evil. (They're just elaborate ways to > make the data public.) Agreed... I hate java for bringing that ugly face of OO so upfront..:-) > 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. Not true always. When your a modelling a containership and need more than one object to perform a job, it breaks down. And such a design is often required.. > 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. Again.. fine in theory but see above points. OO is fine concept but religiously limit change impact to a single class is stupid IMHO. It may not work all the time.. > 5. All objects must provide their own UI. LOL. That takes the cake.. So the application server I wrote in C++, is not object oriented I guess.. What UI has to do with being OO.. Doesn't that sound insane to anybody else or this phase of moon drives me crazy.. > 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. In my experience it is the hybrid that works the best. OK, it could be worst at times but if something works that is the hybrid described above. And IMO OO is a modelling concept. Not a religion. I design OO(In my definition) to solve my problems. Not to make it OO in first place.. Shridhar ------------------------------------------------------- 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