Hi All, I was going through UML Distilled by Fowler and was not being able to properly interpret the realization relationship he was talking about. The following is what Fowler said in the book - "Realization is deliberately similar to generalization; it indicates that one class implements behaviour specified by another. It is permissible for one implementation class to realize another; this means that the realizing class must conform to the interface, but need not use inheritance"
This is what i understand from his explanation, in my own words - " A class can subclass an abstract class and thereby realize that it is implementing a particular interface, eventhough it is not in inheritance with the interface( not like -- for example classA implements interfaceXX)". Is this interpretation correct? Please correct for any mistakes. Where is this kind of realization useful? Thanks, Jayadev.
Here is my understanding: - Generalization/Specialization: class conforms to the same interface and inherits implementation from the superclass - Realization: class conforms to the interface as defined by the realized Interface, it doesn't inherit any implementation Therefore in Java "extends" would mean Specialization for classes, Realization for interfaces; "implements" would always mean Realization.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Joined: Mar 25, 2002
That was very clear explanation. Thanks.
Joined: Jul 11, 2001
Originally posted by Jayadev Pulaparty: That was very clear explanation.
Originally posted by Ilja Preuss: .. Realization for interfaces; "implements" would always mean Realization.
Yups! Put another way, Realizing an interface means confirming an agreement! Interface is a contract between interface designer and interface implementor. By implementing an interface means implementor is realizing the rules of contract. I believe there is another good word in place of rule, which is not coming in my mind right now. Bye, Viki.