Originally posted by Manoj Kumkumath:
I don�t have any control on this class (I won�t be able introduce a new parent class to this class by moving some behaviors up).
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
Originally posted by Manoj Kumkumath:
But all my existing Car(the reference) should run(method ) even if it is a Boat(of type).
Originally posted by Manoj Kumkumath:
For an example for Sort, the framework should return the application a column row, rows of data and the names of columns on which sorting has to happen. In the case of grouping, it's going to be a column row, rows of data and the names of columns on which it has to be grouped and the name of the function like average.
Originally posted by Manoj Kumkumath:
Let�s say I have a class called �Car�. I don�t have any control on this class (I won�t be able introduce a new parent class to this class by moving some behaviors up).
Now I am going to write a new class called �Boat�. Now I find that my new class is a specialization of the class �Car� even though in a real world scenario it�s not. But it will be a perfect follower of Liskov substitution principle in an OO world.
Now my question is should the Boat extend Car?
Originally posted by Manoj Kumkumath:
If not how will you reuse behavior of Car?
Basically you have identified a data access interface that needs to be extracted. There may even the command aspect to it.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |