[LIP] Re: [JUG-Delhi] MVC is not OO

Rahul Kumar <rahulk-TkgXTuSR4r0f5/[email protected]>
Newsgroups gmane.user-groups.linux.india.programmers
Organization Bharti Telesoft Intl Pvt Limited
Message-ID <[email protected]>
Interesting point of view, Sandy. But altho' its fine as a guideline, it
wont survive much ... Some points below.
And oh, by the way,  does that mean python is not object oriented :)
Same for C++?

On Thu, Mar 04, 2004 at 10:34:47PM +0530, Sandip Bhattacharya wrote:
>    1. All data is private. Period. (This rule applies to all 
> implementation details, not just the data.)
See "Idempotence".
>    2. get and set functions are evil. (They're just elaborate ways to 
> make the data public.)
They do suck. The caller never knows what it does. At least with public
or protected data, u know it is not being tampered. See point 1 :)
That also suggests a proliferation of overloaded methods/constructors.
>    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.
Oooooh. What about those procedure which take many kinds of objects
conforming to one interface. 
Does that mean the Properties object should do the work ?
That means i cant switch from a Properties class to an XML / DB. Or am i
taking it too literally.
>    5. All objects must provide their own UI.
Great. But i take it that that class/object can have its own inner or
other classes to handle view ? But what if various classes establish
themselves as listeners to a class that knows the UI. This could be the
Listener design, or the publish-subcribe pattern.
> 
> 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. 
I am wondering whether there is any really working OO system in
production in the world.
Its like Oracle says that theres probably no database in the world thats
in pure 3rd normal form.
> Nonetheless, not exposing data is a fundamental principle of 
> object-oriented systems.
Personally i think, within one package, having protected data is a great
way of getting performance, and also protecting yourself from other
packages.
>If you violate your principles, you're nothing, 
OK, then even C++ is nothing (since you can always violate data through
pointers, huh ?)
> 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.
No wonder i never got C++ to work (and i thought __i__ was pig-headed :).

Anyway, i am not making fun of the points above - i think they serve as
a good starting point. However, with all rules and guidelines, i believe
we should use them to help us, and know when to make an exception. 

Great summarization, Sandip.

--
re
rahul

Linux 2.4.18-14
 10:51am  up 125 days, 6 min,  1 user,  load average: 0.10, 0.20, 0.30

p.s. the tip below violates 4 of 10 OO principles.

#### Java Tip:051.jtips ####
Cache frequently used objects whenever possible.
#####


-------------------------------------------------------
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.