Win a copy of Functional Reactive Programming this week in the Other Languages forum!

# A small tips on PIE

Ranch Hand
Posts: 56
Hi guys..
I always to tend for get the 3 basic properties of OO...
Luckly I found an acronym to help me to remember the keywords.. it is PIE
P - Polymorphism
I - Inheritance
E - Encapsulattion
You should reverse PIE as IEP so that you get them properties according to importance i.e. Encapsulattion, Inheritance and Polymorphism...
Hope it helps other guys who are confused like me

John Smith
Ranch Hand
Posts: 2937

You should reverse PIE as IEP so that you get them properties according to importance i.e. Encapsulattion, Inheritance and Polymorphism

It doesn't make sense to order them by "importance". These properties are orthogonal. One could make an argument that polymorphism is possible because of inheritance, but conceptualy, all three properties characterize different aspects of OO, there is no such thing as more or less important property.
Eugene.

Ranch Hand
Posts: 56
Hi Eugene,
Thanks a lot for your information... i didn't know that... i found them in the same order in several books...
Thanks again...

Barry Gaunt
Ranch Hand
Posts: 7729
That's a nice tip Wahid. Tell you what, send it to bert.bates@wickedlysmart.com , he may want to use it in a book being written. You will then see your name in print if they use your tip.

Jim Yingst
Wanderer
Sheriff
Posts: 18671
The order you find them in books may also be the order it's easiest to teach them in. As Eugene notes, you can't really have polymorphism without inheritance, so it makes sense that they'd discuss inheritance first. Furthermore you need to have some idea what an instance is before you can understand polymorphism - and learning about encapsulation is a good way to introduce the notion of an instance. As for encapsulation vs. inheritance - I'd expect encapsulation to be taught first, but I suppose it's possible to discuss inheritance first if you're talking about static methods. Seems wierd though.
Incidentally, Peter van der Linden's excellent Just Java 2 cites four key OO concepts - including Abstraction - and suggests the mnemonic "A PIE". But he then discusses them in the order Abstraction, Encapsulation, Inheritance, Polymorphism.

Marilyn de Queiroz
Sheriff
Posts: 9067
12
APIE -
abstraction
polymorphism
inheritance
encapsulation

It's in JustJava2 by Peter van der Linden along with discussions of each.