Professional Documents
Culture Documents
Objectives
Understand the principles of event-driven programming
Describe user-initiated actions and GUI components Design graphical user interfaces
Objectives (continued)
Modify the attributes of GUI components
List the steps to building an event-driven application
software that you use to run a computer and manage its resources
A text field that one can use to enter text is another source
10
Instead, call prewritten routines or methods that draw the GUI components on the screen for you
When you use preexisting GUI components, you are instantiating objects that belong to a prewritten class
Programming Logic and Design, Third Edition Comprehensive 11
12
14
When there are too many components on a screen, users cant find what theyre looking for
Programming Logic and Design, Third Edition Comprehensive 15
17
19
2. Create storyboards
3. Define the objects 4. Define the connections between the screens the user will see 5. Plan the logic
22
23
Assume that policy rates are determined using the factors shown in Table 14-3
The final output of the program is a second screen that shows the semiannual premium amount for the chosen policy
24
Creating Storyboards
A storyboard represents a picture or sketch of a screen the user will see when running a program Figure 14-2 shows two storyboard sketches for the insurance program Represent the introductory screen at which the user
selects a premium type and answers questions, and the final screen that displays the semiannual premium
Programming Logic and Design, Third Edition Comprehensive 25
26
27
28
29
30
You can plan the logic for each of the modules (or method or scripts) that the program will use
The pseudocode in Figure 14-6 should look very familiar to youit uses decision-making logic you have used since the early chapters of this book
Programming Logic and Design, Third Edition Comprehensive 31
32
The generic name used for errors in objectoriented languages is exceptions because,
presumably, errors are not usual occurrences; they are the exceptions to the rule
Programming Logic and Design, Third Edition Comprehensive 33
34
35
36
There are at least two shortcomings to the errorhandling logic shown in Figure 14-8
module is not as reusable as it could be it is not as flexible as it might be
37
38
40
Summary
Interacting with a computer operating system from the command line is difficult
Easier to use an event-driven graphical user interface (GUI) in which users manipulate objects such as buttons and menus
When you create a program that uses a GUI, the interface should be natural, predictable, attractive, easy to read, and non-distracting
Programming Logic and Design, Third Edition Comprehensive 41
Summary (continued)
Developing an event-driven application is more complicated than developing a standard procedural program
Traditional error-handling methods have limitations Object-oriented error handling involves throwing exceptions
Programming Logic and Design, Third Edition Comprehensive 42