Elipse and Circle inheritance problem

Recently I’ve been listening to Coding Blocks podcast, an episode which subject was software design anti-patterns. They described one of them, which is pretty well known: the Circle-Ellipse¬†problem.

The problem goes like this: let’s assume we’re writing a program and we’ve created IShape interface (which might have methods to calculate circumstance and area of the¬†shape). Now we create Ellipse, which implements IShape interface and follows that with Circle class. Now since Circle is a special case of Ellipse, and every circle is an Ellipse it naturally should inherit from Ellipse.

Continue reading “Elipse and Circle inheritance problem”