If you are a programmer of a certain age, it will be hard for you, as it was for me, to accept the don't inherit—compose philosophy. After all, we were taught that OOP is the key to everything and that it will fix all our problems.
That was indeed the dream behind the OOP movement. The practice, however, dared to disagree. In most real-life scenarios, the OOP approach leads only to mess and ugly code. The following short example will succinctly demonstrate why this happens.
Let's say we would like to write a class that implements a list of only three operations. We'd like to add integer numbers (Add), get the size of the list (Count), and read each element (Items). Our application will use this list to simulate ...