Programming in terms of interfaces is a fundamental concept in OO systems in general and the Gang-of-Four design patterns in particular. Nonetheless, many Java programmers make little use of interfaces (and overuse the
extends relationship). This chapter explains the problems with
extends and how you can solve some of those problems with interfaces. I also introduce a few of the Creational patterns that simplify interface-based programming.
Why extends Is Evil
extends keyword is evil—maybe not at the Charles-Manson/Vlad-the-Impaler level, but bad enough that reputable designers don’t want to be seen in public with it. The Gang-of-Four Design ...