26 Introducing Extensions

WHEN YOU PROGRAM in Java, you do not begin from scratch, you “inherit” all the power of the Java class libraries. You also usually inherit the code of your predecessors and coworkers. When you’re not reorganizing or improving this legacy code, you’re extending it. You might say that programming in Java is extension.

If you’ve ever inherited a codebase, you may have grumbled about its quality. But is the new code you’re adding really better? The answer is sometimes subjective, but this chapter reviews a few principles of object-oriented software development that you can use to assess your work.

In addition to normal techniques for extending a codebase, you may be able to apply design patterns to add new behavior. ...

Get Design Patterns in Java™, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.