Thursday, September 10, 2015

Object Reuse vs Component Reuse

In the 1992 book 'Object Oriented Software Engineering: A Use Case Driven Approach' Ivar Jacobson talks about three types of objects and one of the types he talks about is Entity. Let's say we have a product, the intention is to reuse this object in different applications such as Order Entry, Fulfillment, Inventory Management, Catalog etc.

There are several problems with this object reuse:

1. The object becomes big.
2. Only some methods are used in some applications.

 From the perspective of the developer of that
object, it is difficult to figure out which applications will be affected when a certain method changes. It is easier to reuse if a group of objects provides a service that is focused on doing one thing really well. In this approach you may end up with different components that have the product object, but they will be small since they are focused on doing only one thing. We can namespace the product so that there will be no conflicts in applications that use them.