Thursday, March 10, 2011

Inheritance and Algorithms

A lot of the time, when we deal with a number of algorithms for a specific application.  We often allow the users to pick one of the algorithms(as one of their choices).

For example, say interpolation of a set of values, a user should be able to select different types of linear interpolations such as 'bilinear', or 'bicubic', or 'trilinear' etc.  Normally, or at the premature level, we might offer three different separate methods or three decoupled classes for this scenarios.  The chance is that a lot of the helper functions are repeated.

However, this very scenario could well be used with inheritance and it's not ROCKET SCIENCE!

No comments:

Post a Comment