Ordinary Responsibility

You probably have a strong sense of how attributes and responsibilities should come together in a well-formed class, although it can be challenging to explain your views.

CHALLENGE 7.1The class structure shown in Figure 7.1 has at least ten questionable assignments of responsibility. Circle as many problems as you can find; for four of these points, write a statement of what is wrong.
Figure 7.1. What's wrong with this picture?

Looking at all the oddities in Figure 7.1 may loosen up your thinking about appropriate object modeling. This is a good frame of mind to be in when you set out to define terms, such as class. ...

Get Design Patterns Java™ Workbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.