Java Reference
In-Depth Information
You might want to refactor this code, applying O BSERVER , so that the StackPanel object
will repaint itself when the stack changes.
Shopping around and discovering such tools as Java's support for locking may occasionally
make you feel overwhelmed. There is so much to learn! Avid learning is good, but it has the
downside that you are coding today with much less knowledge than you'll have in a year. A
good balance is to spend an hour a day learning and to spend the rest of your work time
applying what you know. Although you are learning all the time, you have to write code
today, creating your own extensions to an existing software base.
Extending by Subclassing
When you create a new class, you should ensure that it is a logical and consistent extension of
the class you extend, as Chapter 7, Introducing Responsibility, explores. A Java compiler will
enforce certain aspects of consistency.
CHALLENGE 26.3
What four aspects of the model in Figure 26.4 will a Java compiler take exception
to?
Figure 26.4. What's wrong with this picture?
A Java compiler helps to ensure the consistency of your classes, but many potential extension
problems will elude a compiler. In particular, class names have a meaning in English that only
human-level intelligence can appreciate. For example, an overt error is to make Customer a
Search WWH ::




Custom Search