True software reusability
Truth about reusability
Reusability is the key concept in the IT industry. Due to OpenSource initiative we are able to reuse more code now. The understanding of the concept of the reusability is crucial since we may end up misusing the concept. I would like to share my understanding on this topic
Horizontal Reusability
Reusability could be found in many things around us. For instance we could use a log of wood to build a house or it could be used to protect us from the cold winter when burnt. Most of us would say that this is not reusability since if the wood is used to build a home cannot be used again for creating a fire. I would say that the basic concept of the reusability here is - Reusability by diversity. Which means once you have a wood you can choose of the many options you have. This is horizontal reusability. In software world it is achieved by either copy pasting the code or using the same service or module in multiple places. To achieve this kind of reusability we need to ensure the code is more generic which serves the purpose ( using same module in multiple places ) or it could be specific to some problem which is repeated ( copy pasting the code ). We observe this is the most common concept of Software reusability.
Vertical Reusability
Next is the vertical reusability i.e. reusability by abstraction. For instance Developer-A creates a library-a which is used by another Developer-B to create library-b which is then used by third Developer-C to create library-c. In this chain the dependencies are transitive. The benefit of this kind of reusability is that we are going towards more simplified solutions and can make things more advanced. Evolution and advancements in human society was achieved by building on top of existing knowledge. Hence each one of us have a role in the chain of abstraction. Similar to pyramid all layers are important for it to stand. I promote this reusability more because we need to look forward from what we already have and start creating on top of existing.
Comparison
Horizontal Reusability
Provides more options ( Ex : JPA implementations will help in easily switching from Oracle to MySQL ) ( Note: Oracle and MySQL are the examples of horizontal reusability of RDBMS Concept )
Can make us loosely coupled to dependencies so that we can easily switch
Avoids monopoly since we can easily find more alternatives
Vertical Reusability
The lower layers need to chosen wisely as it is crucial for the upper layers to support
A lower layer if compromised will lead to disaster
Gives better visibility and leads to a simplified solution understanding ( due to abstraction )
Summary
We need to focus on the Vertical Reusability while ensuring that the lower layers are made up of Horizontally reusable components. Although society has evolved in a fashion wherein we like to create our own implementations of something instead of building on top of existing but it is a choice based on how trustworthy is the reusable library or module.