Understanding the mechanics of creating C++ or Java code is relatively easy, but creating a good
object-oriented design is much more complex. In this context, good means that the code
works correctly and is reasonably easy to understand, maintain, extend, and reuse.
Reusability is an important goal and is one of the primary advantages of using objectoriented
programming languages. Creating reusable code saves time and effort by avoiding
the duplication that occurs when software must be created that’s similar or identical to something
that was written previously.
Although creating reusable code should always be your goal, the reality is that it’s sometimes
impossible or impractical to make code reusable. Some classes are good candidates for
reuse while others aren’t, and creating reusable software usually requires more work in the
short term than creating “throwaway” code. However, as you become more experienced in
creating good object-oriented designs, you’ll learn to recognize good candidates for reuse and
become better at creating classes, interfaces, and packages that aren’t tied too closely to a single
application.