Search and Find
Service
Contents
7
About the Author
22
About the Technical Reviewer
23
Acknowledgments
24
Preface
25
Introduction
26
Part 1 The ABCs of Objects
37
Chapter 1 Abstraction and Modeling
38
Simplification Through Abstraction
38
Generalization Through Abstraction
39
Reuse of Abstractions
44
Inherent Challenges
45
Summary
47
Chapter 2 Some Java Basics
50
Why Java?
50
Anatomy of a Simple Java Program
59
The “Mechanics” of Java
63
Primitive Types
67
Variables
68
Variable Initialization
70
The String Type
71
Case Sensitivity
72
Java Expressions
73
Automatic Type Conversions and Explicit Casting
77
Loops and Other Flow-Control Structures
79
Block-Structured Languages and the Scope of a Variable
88
Printing to the Screen
89
Elements of Java Style
93
Summary
98
Chapter 3 Objects and Classes
100
Software at Its Simplest
100
What Is an Object?
103
What Is a Class?
106
Instantiation
109
Encapsulation
110
User-Defined Types and Reference Variables
111
Instantiating Objects: A Closer Look
112
Objects As Attributes
120
Three Distinguishing Features of an Object- Oriented Programming Language
127
Summary
127
Chapter 4 Object Interactions
129
Events Drive Object Collaboration
129
Declaring Methods
131
Methods Implement Business Rules
141
Objects As the Context for Method Invocation
142
Method Overloading
149
Message Passing Between Objects
150
Delegation
152
Obtaining Handles on Objects
153
Objects As Clients and Suppliers
156
Information Hiding/Accessibility
158
Public Accessibility
159
Accessing Private Features from Client Code
166
The Power of Encapsulation Plus InformationHiding
172
Exceptions to the Public/Private Rule
181
Constructors
184
Software at Its Simplest, Revisited
195
Summary
197
Chapter 5 Relationships Between Objects
200
Associations and Links
200
Aggregation and Composition
206
Inheritance
207
Three Distinguishing Features of an OOPL, Revisited
242
Summary
242
Chapter 6 Collections of Objects
246
What Are Collections?
246
Three Generic Types of Collection
249
Arrays As Simple Collections
252
A More Sophisticated Type of Collection: The ArrayList Class
260
The HashMap Collection Class
273
The TreeMap Class
279
The Same Object Can Be Simultaneously Referenced by Multiple Collections
281
Inventing Our Own Collection Types
282
Collections As Method Return Types
292
Collections of Derived Types
293
Revisiting Our Student Class Design
294
Summary
303
Chapter 7 Some Final Object Concepts
305
Polymorphism
306
Abstract Classes
314
Interfaces
322
Static Features
345
Summary
359
Part 2 Object Modeling 101
362
Chapter 8 The Object Modeling Process in a Nutshell
363
The “Big Picture” Goal of Object Modeling
363
Jacquie’s Recommended Object Modeling Process,in a Nutshell
367
Summary
371
Chapter 9 Formalizing Requirements Through Use Cases
372
What Are Use Cases?
373
Actors
375
Specifying Use Cases
379
Matching Up Use Cases with Actors
380
To Diagram or Not to Diagram?
380
Summary
382
Chapter 10 Modeling the Static/Data Aspects of the System
383
Identifying Appropriate Classes
384
Producing a Data Dictionary
395
Determining Associations Between Classes
396
Identifying Attributes
400
UML Notation: Modeling the Static Aspects of an Abstraction
400
Object Diagrams
414
Associations As Attributes
416
Information “Flows” Along an Association“ Pipeline”
417
“Mixing and Matching” Relationship Notations
423
Association Classes
425
Our “Completed” Student Registration System Class Diagram
428
Metadata
434
Summary
435
Chapter 11 Modeling the Dynamic/Behavioral Aspects of the System
437
How Behavior Affects State
438
Scenarios
443
Sequence Diagrams
447
Using Sequence Diagrams to Determine Methods
452
Communication Diagrams
454
Revised SRS Class Diagram
456
Summary
457
Chapter 12 Wrapping Up Our Modeling Efforts
459
Testing the Model
459
Revisiting Requirements
460
Reusing Models: A Word About Design Patterns
462
Summary
465
Part 3 Translating an Object Blueprint into Java Code
467
Chapter 13 Rounding Out Your Java Knowledge
468
Java-Specific Terminology
468
Java Application Architecture
471
Java Archive (JAR) Files
473
Javadoc Comments
477
The Object Nature of Strings
484
Message Chains
497
Object Self-Referencing with “this”
499
Java Exception Handling
500
Enum(eration)s
528
Providing Input to Command Line–Driven Programs
536
Features of the Object Class
549
A Deeper Look Behind the Scenes of the JVM
559
The Date Class
568
Accessibility, Revisited
574
Variable Initialization, Revisited
579
Inner Classes
581
Additional J2SE 5.0 Enhancements
584
Summary
591
Chapter 14 Transforming Your Model into Java Code
594
Suggestions for Getting the Maximum Value from This and Subsequent Chapters
594
The SRS Class Diagram Revisited
595
The Importance of Model–View and Model–Data Layer Separation
644
Summary
645
Chapter 15 Rounding Out Your Application, Part 1: Adding a Data Access Layer
646
An Overview of Upcoming SRS Enhancements
648
Approaches to Object Persistence
648
The Basics of File I/O in Java
651
Populating the Main SRS Collections
658
Configuring Applications with the Java Properties Class
666
Defining Custom Exceptions for the SRS
671
Encapsulating Persistence Details
672
The Importance of Model–Data Access Layer Separation
696
Our SRS Modifications, Revisited
705
Summary
706
Chapter 16 Rounding Out Your Application, Part 2: Adding a Presentation Layer
708
Java GUIs: a Primer
709
Crafting the View/Presentation of a Java GUI
719
A Simple Calculator Example
753
An Improved Application Architecture for GUIs
756
Other Interesting AWT/Swing Components to Explore
761
Java Event Handling
762
More Container Types
788
Reusable Custom Components
796
Summary
798
Chapter 17 SRS, Take 3: Adding a GUI
800
Our SRS Code Road Map
800
Preparing a Concept of Operations
802
The MainFrame Class
810
The PasswordPopup Class: Sharing Information Across Windows/Classes
830
The SRS Driver Class, Significantly Streamlined
832
An Overview of J2EE
833
Review of the Architecture of an“Industrial-Strength” Java Application
853
Summary
856
Chapter 18 Next Steps
858
Jacquie’s “Tried and True” Approach to Learning Java Properly
859
Taming the Technology Tidal Wave
860
Other Recommended Reading
861
Your Comments, Please!
862
Part 4 Appendixes
863
APPENDIX A Suggestions for Using This Book As a Textbook
864
Recommended Teaching Approaches
864
Suitability of Java As a Teaching Language
865
Some Final Recommendations
865
APPENDIX B Alternative Case Studies
867
Case Study #1: Prescription Tracking System
867
Case Study #2: Conference Room Reservation System
869
Case Study #3: Blue Skies Airline Reservation System
871
APPENDIX C Setting Up Your Java Development Environment
873
The Java Software Development Kit
873
Testing Your Installation
874
Troubleshooting Your Installation
876
Using the Online Java Documentation with Windows
885
Special Tips for Using Microsoft Windows Command Prompts
886
APPENDIX D Downloading and Compiling the Book’s Source Code
889
APPENDIX E Note to Experienced C++ Programmers
891
No More Pointers!
891
Dynamic vs. Static Object Creation
892
Exception Handling
893
Breaking the OO Rules” with C++
893
Platform Portability
894
Abstract Methods and Abstract Classes
894
Other Simplifications
894
APPENDIX F How Polymorphism Works Behind the Scenes (Static vs .Dynamic Binding)
896
Static Binding
897
Dynamic Binding
898
APPENDIX G Collections Prior to J2SE 5.0
901
Summary of 5.0 Collection Enhancements
901
Constraining Collection Contents
902
Iterating Through Collections
903
Managing Primitive Types with Collections
906
The Iterator Class
908
Using the -Xlint:unchecked Compiler Option
910
APPENDIX H Programming 101, and the Role of a Compiler
912
A LEGOs Analogy
912
The Compiler’s Job in a Nutshell
913
Index
917
All prices incl. VAT