Java Reference
In-Depth Information
103
Clears the display.
104 */
105
public void
clear()
106 {
107 display.setText(
ÐÑ
);
108 }
109
110
private
JPanel buttonPanel;
111
private
JButton clearButton;
112
private
JTextField display;
113 }
In this chapter, you learned a systematic approach for building a relatively complex
program. However, object-oriented design is definitely not a spectator sport. To
really learn how to design and implement programs, you have to gain experience by
repeating this process with your own projects. It is quite possible that you don't
immediately home in on a good solution and that you need to go back and
reorganize your classes and responsibilities. That is normal and only to be expected.
The purpose of the object-oriented design process is to spot these problems in the
design phase, when they are still easy to rectify, instead of in the implementation
phase, when massive reorganization is more difficult and time consuming.
576
577
S
ELF
C
HECK
12.
Why does the
Bank
class in this example not store an array list of
bank accounts?
13.
Suppose the requirements changeȌyou need to save the current
account balances to a file after every transaction and reload them
when the program starts. What is the impact of this change on the
design?
R
ANDOM
F
ACT
12.2: Software DevelopmentÏArt or
Science?
There has been a long discussion whether the discipline of computing is a
science or not. We call the field Ȓcomputer scienceȓ, but that doesn't mean much.