Third principle in object oriented paradigm is Hierarchy. Actually hierarchy is a technique for managing complexities; As Grady Booch states in his seminal book – Object-Oriented Analysis and Design with Applications– “There are fundamental limiting factors of human cognition; we can address these constraints through the use of decomposition, abstraction, and hierarchy.”
Since our complexity management ability is limited we have to face with complexities in appropriate levels and the hierarchy is the solution for applying this leveling, each level of a hierarchy embodies its own complexity. A set of abstractions often forms a hierarchy, and by identifying these hierarchies in our design, we greatly simplify our understanding of the problem. Again, Grady Booch has defined hierarchy as: “Hierarchy is a ranking or ordering of abstractions.”
The two most important hierarchies in a complex system are its class structure (the “is a” hierarchy) and its object structure (the “part of” hierarchy).” We use these type of relation between classes and objects to create understandable and meaningful part for a complex system. In each level of hierarchy we deal with well-known type of complexities.
“Is a” is a type of hierarchy which we almost call it as Inheritance. Inheritance is an essential element of object oriented systems. It defines a relationship among classes that results in sharing structure and behavior of parent class with its children.
“Part of” relationship expresses an Aggregation relation that shows the ownership connection among objects, it’s obvious that the aggregation is not unique to object oriented development. It had been exist since structural programming languages era;
For conclusion, hierarchy defines types of associations among objects and classes in order to simplify categorizing them to create understandable subset.