![]() |
Maciaszek L.A. and Liong B.L. (2005):
| ![]() |
Preface.............................................................................................................. I
The Book's Story...................................................................................................................... I
The Book Outline and Organization......................................................................................... I
Distinguishing Features........................................................................................................ III
Intended Readership............................................................................................................... V
Supplementary Materials......................................................................................................... V
Acknowledgements................................................................................................................ VI
Part A - Software Projects................................................................................ 1
1 Software Development Lifecycle.............................................................. 3
1.1 Software Engineering Quintessence.................................................................................. 4
1.1.1 Software System Is Less Than Enterprise Information System.............................................................. 5
1.1.2 Software Process Is Part Of Business Process......................................................................................... 6
1.1.3 Software Engineering Is Different From Traditional Engineering....................................................... 7
1.1.4 Software Engineering Is More Than Programming................................................................................ 8
1.1.5 Software Engineering Is About Modeling............................................................................................... 9
1.1.6 Software System Is Complex.................................................................................................................. 10
1.2 Lifecycle Phases........................................................................................................... 12
1.2.1 Requirements Analysis............................................................................................................................ 13
1.2.2 System Design.......................................................................................................................................... 14
1.2.3 Implementation....................................................................................................................................... 15
1.2.4 Integration and Deployment.................................................................................................................. 16
1.2.5 Operation and Maintenance................................................................................................................... 18
1.3 Lifecycle Models.......................................................................................................... 18
1.3.1 Waterfall Lifecycle With Feedback......................................................................................................... 19
1.3.2 Iterative Lifecycle With Increments....................................................................................................... 21
1.3.2.1 Spiral Model...................................................................................................................................... 23
1.3.2.2 Rational Unified Process (RUP)...................................................................................................... 24
1.3.2.3 Model Driven Architecture (MDA)................................................................................................. 25
1.3.2.4 Agile Lifecycle With Short Cycles.................................................................................................... 27
Summary................................................................................................................................ 28
Key Terms.............................................................................................................................. 30
Review Questions................................................................................................................... 31
2 Software Modeling Language................................................................. 33
2.1 Structured Modeling Language.................................................................................... 34
2.1.1 Data Flow Modeling............................................................................................................................... 34
2.1.2 Entity-Relationship Modeling................................................................................................................ 37
2.2 Object-Oriented Modeling Language........................................................................... 39
2.2.1 Class Diagrams........................................................................................................................................ 39
2.2.2 Use Case Diagrams.................................................................................................................................. 44
2.2.3 Interaction Diagrams.............................................................................................................................. 46
2.2.3.1 Sequence Diagrams........................................................................................................................... 46
2.2.3.2 Collaboration (Communication) Diagrams.................................................................................... 48
2.2.4 Statechart Diagrams................................................................................................................................ 49
2.2.5 Activity Diagrams.................................................................................................................................... 51
2.2.6 Implementation Diagrams...................................................................................................................... 52
2.2.6.1 Component Diagrams...................................................................................................................... 53
2.2.6.2 Deployment Diagrams..................................................................................................................... 55
Summary................................................................................................................................ 56
Key Terms.............................................................................................................................. 57
Review Questions................................................................................................................... 58
Problem-Solving Exercises...................................................................................................... 59
3 Software Engineering Tools.................................................................... 61
3.1 Project Management Tools.......................................................................................... 62
3.1.1 Project Scheduling and Controlling....................................................................................................... 63
3.1.2 Aligning Project and Performance Management with Strategic Objectives........................................ 64
3.1.3 Unifying Project Management with Web-Based Collaboration and Content
Management............... 65
3.1.4 Unifying Project Management with Web-Based Portfolio Management............................................. 66
3.1.5 Integrating Project Management with Metrics...................................................................................... 68
3.1.6 Integrating Project Management with Risk Management..................................................................... 70
3.2 System Modeling Tools................................................................................................ 73
3.2.1 Managing Requirements.......................................................................................................................... 74
3.2.2 Visual UML Modeling............................................................................................................................. 79
3.2.3 Report Generation.................................................................................................................................. 81
3.2.4 Database Modeling.................................................................................................................................. 82
3.3 Integrated Development Environments........................................................................ 83
3.3.1 Routine Programming Tasks.................................................................................................................. 84
3.3.1.1 Writing the Program........................................................................................................................ 85
3.3.1.2 Executing the Program.................................................................................................................... 89
3.3.1.3 Debugging the Program................................................................................................................... 89
3.3.2 Integration with Software Modeling...................................................................................................... 92
3.3.3 Enterprise Application Development.................................................................................................... 93
3.3.4 Integration with Business Components................................................................................................. 94
3.3.5 Integration with Change and Configuration Management................................................................... 96
3.4 Change and Configuration Management Tools............................................................ 98
3.4.1 Support for Changes............................................................................................................................... 99
3.4.2 Support for Versions............................................................................................................................ 101
3.4.3 Support for System Building................................................................................................................. 102
3.4.4 Support for Reengineering................................................................................................................... 104
Summary............................................................................................................................... 106
Key Terms............................................................................................................................. 107
Review Questions.................................................................................................................. 108
Problem-Solving Exercises.................................................................................................... 108
4 Software Project Planning and Tracking............................................... 112
4.1 Project Plan Development........................................................................................... 112
4.2 Project Scheduling...................................................................................................... 116
4.2.1 Tasks, Milestones and Deliverables...................................................................................................... 116
4.2.2 Task Scheduling in Bar Chart............................................................................................................... 118
4.2.3 Resources and Resource Calendars...................................................................................................... 120
4.2.4 Effort-driven Scheduling in Bar Chart................................................................................................ 122
4.2.5 Resource Underallocation and Overallocation.................................................................................... 123
4.3 Project Budget Estimation......................................................................................... 126
4.3.1 Schedule-driven Budget Estimation..................................................................................................... 127
4.3.2 Algorithmic Budget Estimation............................................................................................................ 132
4.3.2.1 Principles of Algorithmic Models................................................................................................. 132
4.3.2.2 COCOMO 81................................................................................................................................. 133
4.3.2.3 COCOMO II.................................................................................................................................. 135
4.4 Tracking Project Progress........................................................................................... 138
4.4.1 Tracking the Schedule........................................................................................................................... 139
4.4.2 Tracking the Budget.............................................................................................................................. 142
4.4.2.1 Actual Costs from Schedule........................................................................................................... 142
4.4.2.2 Actual Costs from Accounting...................................................................................................... 144
4.4.2.3 Earned Value.................................................................................................................................. 147
Summary............................................................................................................................... 149
Key Terms............................................................................................................................. 151
Review Questions.................................................................................................................. 151
Problem-Solving Exercises.................................................................................................... 152
5 Software Process Management.............................................................. 155
5.1 People Management................................................................................................... 157
5.1.1 Acquiring and Motivating People........................................................................................................ 157
5.1.1.1 Team Creation................................................................................................................................ 158
5.1.1.2 Motivational Theories.................................................................................................................... 159
5.1.2 Project Communications...................................................................................................................... 160
5.1.2.1 Forms of Communication............................................................................................................. 160
5.1.2.2 Lines of Communication............................................................................................................... 161
5.1.2.3 Factors in Communication............................................................................................................ 162
5.1.2.4 Communication in Conflict Resolution........................................................................................ 163
5.1.3 Team Development............................................................................................................................... 164
5.2 Risk Management...................................................................................................... 165
5.2.1 Risk Identification................................................................................................................................. 165
5.2.2 Risk Assessment.................................................................................................................................... 166
5.2.3 Risk Handling........................................................................................................................................ 169
5.3 Quality Management.................................................................................................. 170
5.3.1 Software Qualities.................................................................................................................................. 171
5.3.2 Quality Control...................................................................................................................................... 173
5.3.2.1 Software Testing............................................................................................................................. 173
5.3.2.2 Testing Techniques......................................................................................................................... 175
5.3.2.3 Test Planning.................................................................................................................................. 177
5.3.3 Quality Assurance.................................................................................................................................. 179
5.3.3.1 Checklists........................................................................................................................................ 179
5.3.3.2 Reviews............................................................................................................................................ 180
5.3.3.3 Audits.............................................................................................................................................. 181
5.4 Change and Configuration Management.................................................................... 181
5.4.1 Requirements Changes.......................................................................................................................... 182
5.4.2 Artifact Versions................................................................................................................................... 184
5.4.3 Defects and Enhancements.................................................................................................................. 186
5.4.4 Metrics.................................................................................................................................................... 189
Summary............................................................................................................................... 192
Key Terms............................................................................................................................. 193
Review Questions.................................................................................................................. 194
Part B - From Requirements via Architectural Design to
Software Release...................................................................................................................... 196
6 Business Object Model......................................................................... 198
6.1 Advertising Expenditure Measurement - The
Business............................................... 199
6.2 Business Context Diagram......................................................................................... 199
6.3 Business Use Case Model.......................................................................................... 200
6.3.1 Business Use Cases and Business Actors.............................................................................................. 200
6.3.2 Business Use Case Model for Advertising Expenditure Measurement.............................................. 201
6.3.3 Alternative Business Use Case Model for Advertising Expenditure
Measurement........................... 203
6.4 Business Glossary...................................................................................................... 204
6.4.1 Business Glossary for Advertising Expenditure Measurement........................................................... 205
6.5 Business Class Model................................................................................................ 206
6.5.1 Business Entities.................................................................................................................................... 206
6.5.2 Business Class Model for Advertising Expenditure Measurement..................................................... 207
6.5.3 Alternative Business Class Model for Advertising Expenditure Measurement................................. 208
Summary............................................................................................................................... 209
Key Terms............................................................................................................................. 209
Review Questions.................................................................................................................. 210
Problem-Solving Exercises..................................................................................................... 211
7 Domain Object Model........................................................................... 214
7.1 Contact Management - The Domain.......................................................................... 215
7.2 Domain Use Case Model............................................................................................ 215
7.2.1 Use Cases and Actors............................................................................................................................ 216
7.2.2 Use Case Relationships......................................................................................................................... 216
7.2.3 Use Case Model for Contact Management.......................................................................................... 217
7.2.4 Alternative Use Case Model for Contact Management....................................................................... 219
7.3 Domain Glossary........................................................................................................ 221
7.3.1 Domain Glossary for Contact Management........................................................................................ 221
7.4 Domain Class Model.................................................................................................. 223
7.4.1 Classes and Attributes........................................................................................................................... 224
7.4.2 Class Relationships................................................................................................................................ 225
7.4.3 Class Model for Contact Management................................................................................................. 226
7.4.4 Alternative Class Model for Contact Management............................................................................. 227
Summary............................................................................................................................... 229
Key Terms............................................................................................................................. 229
Review Questions................................................................................................................. 230
Problem-Solving Exercises.................................................................................................... 231
8 Iteration 1 Requirements and Object Model........................................ 234
8.1 Use Case Model......................................................................................................... 235
8.2 Use Case Document................................................................................................... 236
8.2.1 Brief Description, Preconditions and Postconditions........................................................................ 237
8.2.2 Basic Flow.............................................................................................................................................. 238
8.2.3 Subflows................................................................................................................................................. 239
8.2.4 Exception Flows.................................................................................................................................... 242
8.3 Conceptual Classes.................................................................................................... 243
8.4 Supplementary Specification....................................................................................... 244
Summary............................................................................................................................... 247
Key Terms............................................................................................................................. 247
Review Questions................................................................................................................. 248
Problem-Solving Exercises.................................................................................................... 248
9 Architectural Design............................................................................. 250
9.1 Architectural Layers and Dependency
Management................................................... 250
9.1.1 Architectural Modules........................................................................................................................... 251
9.1.1.1 Design Classes................................................................................................................................. 251
9.1.1.2 Packages.......................................................................................................................................... 252
9.1.2 Package Dependencies.......................................................................................................................... 253
9.1.3 Layer Dependencies.............................................................................................................................. 254
9.1.4 Class Dependencies............................................................................................................................... 256
9.1.5 Inheritance Dependencies.................................................................................................................... 257
9.1.5.1 Inheritance without Polymorphism............................................................................................... 260
9.1.5.2 Extension and Restriction Inheritance.......................................................................................... 261
9.1.5.3 Down-calls...................................................................................................................................... 261
9.1.5.4 Up-calls............................................................................................................................................ 262
9.1.6 Method Dependencies.......................................................................................................................... 263
9.1.6.1 Method Dependencies in Presence of
Delegation....................................................................... 264
9.1.6.2 Method Dependencies in Presence of
Implementation Inheritance........................................... 265
9.1.7 Interfaces............................................................................................................................................... 267
9.1.7.1 Implementation Dependency........................................................................................................ 268
9.1.7.2 Usage Dependency......................................................................................................................... 269
9.1.7.3 Breaking Circular Dependencies with
Interfaces.......................................................................... 269
9.1.8 Event Processing................................................................................................................................... 271
9.1.8.1 Event Processing and Layer Dependencies.................................................................................. 272
9.1.8.2 Event Processing and Interfaces................................................................................................... 273
9.1.9 Acquaintance......................................................................................................................................... 275
9.1.9.1 Acquaintance Dependencies and Interfaces................................................................................. 276
9.1.9.2 Acquaintance Package.................................................................................................................... 277
9.2 Architectural Frameworks.......................................................................................... 280
9.2.1 Model-View-Controller......................................................................................................................... 280
9.2.2 Presentation-Control-Mediator-Entity-Foundation........................................................................... 282
9.2.2.1 PCMEF Layers............................................................................................................................... 282
9.2.2.2 PCMEF Principles.......................................................................................................................... 284
9.2.2.3 Acquaintance in PCMEF+............................................................................................................. 285
9.2.2.4 Deployment of PCMEF Layers..................................................................................................... 287
9.3 Architectural Patterns................................................................................................. 287
9.3.1 Facade.................................................................................................................................................... 288
9.3.2 Abstract Factory.................................................................................................................................... 289
9.3.3 Chain of Responsibility......................................................................................................................... 290
9.3.4 Observer................................................................................................................................................ 291
9.3.5 Mediator................................................................................................................................................. 292
Summary............................................................................................................................... 294
Key Terms............................................................................................................................. 295
Review Questions................................................................................................................. 296
Problem-Solving Exercises.................................................................................................... 297
10 Database Design and Programming.................................................. 303
10.1 Quick Tutorial in Relational Databases from
Software Engineering Viewpoint........... 304
10.1.1 Table................................................................................................................................................... 304
10.1.2 Referential Integrity........................................................................................................................... 306
10.1.3 Conceptual versus Logical Database Models.................................................................................... 308
10.1.4 Implementing Business Rules............................................................................................................ 309
10.1.5 Programming Database Application Logic...................................................................................... 311
10.1.6 Indexes................................................................................................................................................ 314
10.2 Mapping Transient Objects to Persistent
Records...................................................... 317
10.2.1 Object Databases, SQL:1999, and Impedance Mismatch................................................................ 317
10.2.2 Object-Relational Mapping............................................................................................................... 318
10.2.2.1 Mapping One-to-Many Association and
Aggregation................................................................. 319
10.2.2.2 Mapping Many-to-Many Association............................................................................................ 320
10.2.2.3 Mapping One-to-One Association................................................................................................ 321
10.2.2.4 Mapping One-to-Many Recursive Association............................................................................. 322
10.2.2.5 Mapping Many-to-Many Recursive Association........................................................................... 323
10.2.2.6 Mapping Generalization................................................................................................................. 324
10.3 Database Design and Creation for Email
Management.............................................. 325
10.3.1 Database Model.................................................................................................................................. 326
10.3.2 Creating Database Schema................................................................................................................ 327
10.3.3 Sample Database Content.................................................................................................................. 328
Summary............................................................................................................................... 329
Key Terms............................................................................................................................. 330
Review Questions.................................................................................................................. 331
Problem-Solving Exercises.................................................................................................... 332
11 Class and Interaction Design............................................................... 333
11.1 Finding Classes from Use Case Requirements............................................................ 334
11.1.1 Finding Classes from Use Case Requirements for Email Management.......................................... 335
11.1.2 Initial Class Design for Email Management..................................................................................... 339
11.1.2.1 Constants in Interface.................................................................................................................... 341
11.2 Architectural Elaboration of Class Design.................................................................. 341
11.2.1 Architectural Elaboration of Class Design for Email Management............................................... 342
11.2.2 Class Design for Email Management after Architectural Elaboration........................................... 346
11.2.3 Class Instantiation.............................................................................................................................. 347
11.2.3.1 Who Instantiates the First Object?................................................................................................ 348
11.2.3.2 Instantiation Diagram for Email Management............................................................................. 348
11.3 Interactions................................................................................................................ 349
11.3.1 Sequence Diagrams............................................................................................................................ 349
11.3.2 Communication Diagrams................................................................................................................. 351
11.3.3 Interaction Overview Diagrams........................................................................................................ 353
11.4 Interactions for Email Management........................................................................... 354
11.4.1 The "Login" Interaction.................................................................................................................... 355
11.4.2 The "Exit" Interaction....................................................................................................................... 357
11.4.3 The "View Unsent Messages" Interaction........................................................................................ 357
11.4.4 The "Display Message Text" Interaction.......................................................................................... 359
11.4.5 The "Email Message" Interaction..................................................................................................... 360
11.4.6 The "Incorrect User Name or Password" Interaction..................................................................... 362
11.4.7 The "Incorrect Option" Interaction................................................................................................. 362
11.4.8 The "Too Many Messages" Interaction............................................................................................ 363
11.4.9 The "Email Could Not Be Sent" Interaction................................................................................... 364
Summary............................................................................................................................... 365
Key Terms............................................................................................................................. 366
Review Questions................................................................................................................. 366
Problem-Solving Exercises.................................................................................................... 367
12 Programming and Testing.................................................................. 370
12.1 Quick Tutorial in Java from Software
Engineering Viewpoint..................................... 370
12.1.1 Class.................................................................................................................................................... 371
12.1.2 Class Associations and Collections................................................................................................... 374
12.1.2.1 From Conceptual to Design Class Model..................................................................................... 374
12.1.2.2 Java Collections.............................................................................................................................. 375
12.1.2.3 Associations on Entity Objects...................................................................................................... 377
12.1.2.4 C++ Parameterized Types............................................................................................................. 378
12.1.3 Database Access in Java..................................................................................................................... 381
12.1.3.1 Comparison of JDBC and SQLJ................................................................................................... 381
12.1.3.2 Establishing Database Connection................................................................................................ 382
12.1.3.3 Executing SQL Statements............................................................................................................. 384
12.1.3.4 Calling Stored Procedures and Functions..................................................................................... 387
12.2 Test-Driven Development........................................................................................... 389
12.2.1 JUnit Framework............................................................................................................................... 391
12.2.2 Test-Driven Development in Email Management........................................................................... 394
12.3 Acceptance and Regression Testing........................................................................... 399
12.3.1 Test Scripts in Email Management.................................................................................................... 401
12.3.2 Test Input, Output, and Regression Testing in Email Management............................................... 402
12.3.3 Implementation of Test Script in Email Management..................................................................... 404
12.4 Iteration 1 Runtime Screenshots................................................................................. 408
Summary............................................................................................................................... 413
Key Terms............................................................................................................................. 413
Review Questions.................................................................................................................. 414
Problem-Solving Exercises.................................................................................................... 416
13 Iteration 1 Annotated Code................................................................. 418
13.1 Code Overview............................................................................................................ 418
13.2 Package Acquaintance............................................................................................... 420
13.2.1 Interface IAConstants....................................................................................................................... 421
13.2.2 Interface IAEmployee....................................................................................................................... 421
13.2.3 Interface IAContact........................................................................................................................... 422
13.2.4 Interface IAOutMessage.................................................................................................................... 424
13.3 Package Presentation................................................................................................. 425
13.3.1 Class PMain........................................................................................................................................ 425
13.3.2 Class PConsole................................................................................................................................... 426
13.3.2.1 Constructing PConsole object....................................................................................................... 427
13.3.2.2 Displaying Login and Menu........................................................................................................... 428
13.3.2.3 Viewing Outmessages..................................................................................................................... 429
13.3.2.4 Requesting to Email an Outmessage.............................................................................................. 432
13.4 Package Control......................................................................................................... 433
13.4.1 Class CActioner.................................................................................................................................. 433
13.4.1.1 Constructing CActioner object...................................................................................................... 435
13.4.1.2 Initiating Login............................................................................................................................... 435
13.4.1.3 Routing Retrieval of Outmessages................................................................................................. 436
13.4.1.4 Emailing an Outmessage................................................................................................................ 436
13.4.1.5 Using JavaMailT API.................................................................................................................... 437
13.5 Package Entity........................................................................................................... 439
13.5.1 Interface IEDataSupplier................................................................................................................... 439
IEDataSupplier Method
Summary.............................................................................................................. 439
13.5.1.1 Object Identifiers and Identity Field
Pattern................................................................................ 440
13.5.2 Class EEmployee................................................................................................................................ 441
EEmployee Method Summary.................................................................................................................... 442
13.5.2.1 Constructing EEmployee object.................................................................................................... 442
13.5.2.2 Getting Unsent Outmessages......................................................................................................... 442
13.5.2.3 Removing Sent Outmessages......................................................................................................... 443
13.5.3 Class EContact................................................................................................................................... 443
EEmployee Method Summary.................................................................................................................... 444
13.5.3.1 Constructing EContact objects...................................................................................................... 444
13.5.3.2 Getting Unsent Outmessages......................................................................................................... 445
13.5.3.3 Removing Sent Outmessages......................................................................................................... 445
13.5.4 Class EOutMessage............................................................................................................................ 445
EOutMessage Field Summary...................................................................................................................... 446
EOutMessage Method Summary................................................................................................................. 447
13.5.4.1 Constructing EOutMessage objects............................................................................................... 447
13.5.4.2 Getting and Setting a Contact for
Outmessage............................................................................ 447
13.5.4.3 Getting and Setting a Creator Employee for
Outmessage........................................................... 448
13.5.4.4 Getting and Setting a Sender Employee for
Outmessage............................................................ 448
13.6 Package Mediator...................................................................................................... 449
13.6.1 Class MBroker.................................................................................................................................... 449
MBroker Field Summary.............................................................................................................................. 449
MBroker Method Summary......................................................................................................................... 450
13.6.1.1 Constructing MBroker Object....................................................................................................... 451
13.6.1.2 Requesting Login Connection....................................................................................................... 452
13.6.1.3 Creating Employees Cache............................................................................................................ 452
13.6.1.4 Retrieving Unsent Outmessages.................................................................................................... 453
13.6.1.5 Creating Outmessages Cache......................................................................................................... 455
13.6.1.6 Creating Contacts Cache................................................................................................................ 455
13.6.1.7 Updating Outmessage after Emailing and
Restoring the Cache.................................................. 456
13.7 Package Foundation.................................................................................................. 457
13.7.1 Class FConnection............................................................................................................................. 457
FConnection Field Summary...................................................................................................................... 458
FConnection Method Summary.................................................................................................................. 458
13.7.1.1 Constructing FConnection Object................................................................................................ 458
13.7.1.2 Obtaining Database Connection................................................................................................... 459
13.7.2 Class FReader..................................................................................................................................... 460
FReader Method Summary.......................................................................................................................... 460
13.7.3 Class FWriter...................................................................................................................................... 460
FWriter Method Summary........................................................................................................................... 460
Summary............................................................................................................................... 461
Key Terms............................................................................................................................. 461
Iteration 1 Questions and Exercises...................................................................................... 462
Part C - Software Refactoring and User Interface
Development............... 463
14 Iteration 2 Requirements and Object Model..................................... 464
14.1 Use Case Model......................................................................................................... 464
14.2 Use Case Document................................................................................................... 466
14.2.1 Brief Description, Preconditions and Postconditions..................................................................... 466
14.2.2 Basic Flow........................................................................................................................................... 467
14.2.3 Subflows............................................................................................................................................. 468
14.2.4 Exception Flows................................................................................................................................ 473
14.3 Conceptual Classes and Relational Tables................................................................. 474
14.4 Supplementary Specification....................................................................................... 476
Summary............................................................................................................................... 478
Key Terms............................................................................................................................. 478
Review Questions................................................................................................................. 478
15 Architectural Refactoring.................................................................... 479
15.1 Refactoring Targets.................................................................................................... 480
15.2 Refactoring Methods.................................................................................................. 480
15.2.1 Extract Class....................................................................................................................................... 481
15.2.2 Subsume Method................................................................................................................................ 482
15.2.3 Extract Interface................................................................................................................................ 484
15.3 Refactoring Patterns................................................................................................... 485
15.3.1 Identity Map....................................................................................................................................... 486
15.3.2 Data Mapper....................................................................................................................................... 488
15.3.2.1 Load - Check-out........................................................................................................................... 490
15.3.2.2 Unload - Check-in......................................................................................................................... 490
15.3.3 Alternative Data Mapper Strategies.................................................................................................. 492
15.3.3.1 Many Data Mappers....................................................................................................................... 493
15.3.3.2 Metadata Mapping.......................................................................................................................... 493
15.3.4 Lazy Load........................................................................................................................................... 495
15.3.4.1 Lazy Initialization........................................................................................................................... 495
15.3.4.2 Virtual Proxy................................................................................................................................... 496
15.3.4.3 OID Proxy...................................................................................................................................... 498
15.3.4.3.1 Navigation in Identity Map..................................................................................................... 499
15.3.4.3.2 Navigation in Entity Classes................................................................................................... 502
15.3.5 Unit of Work...................................................................................................................................... 504
15.4 Refactored Class Model.............................................................................................. 505
Summary............................................................................................................................... 507
Key Terms............................................................................................................................. 508
Review Questions................................................................................................................. 509
Problem-Solving Exercises.................................................................................................... 510
16 User Interface Design and Programming........................................... 511
16.1 User Interface Design Guidelines............................................................................... 512
16.1.1 User in Control.................................................................................................................................. 513
16.1.2 Interface Consistency......................................................................................................................... 513
16.1.3 Interface Forgiveness......................................................................................................................... 514
16.1.4 Interface Adaptability........................................................................................................................ 515
16.2 User Interface Components........................................................................................ 515
16.2.1 Containers.......................................................................................................................................... 516
16.2.1.1 Layout Management....................................................................................................................... 519
16.2.1.2 Layering Management.................................................................................................................... 521
16.2.2 Menus.................................................................................................................................................. 521
16.2.3 Controls.............................................................................................................................................. 523
16.3 User Interface Event Handling................................................................................... 525
16.4 Patterns and UI......................................................................................................... 529
16.4.1 Observer............................................................................................................................................. 529
16.4.2 Decorator........................................................................................................................................... 531
16.4.3 Chain of Responsibility..................................................................................................................... 531
16.4.4 Command........................................................................................................................................... 532
16.5 User Interface For Email Management....................................................................... 533
Summary............................................................................................................................... 537
Key Terms............................................................................................................................. 538
Review Questions................................................................................................................. 539
Problem-Solving Exercises.................................................................................................... 540
17 Web-based User Interface Design and
Programming....................... 542
17.1 Enabling Technologies for Web Client Tier................................................................ 543
17.1.1 Basic HTML....................................................................................................................................... 544
17.1.2 Scripting Language............................................................................................................................. 546
17.1.3 Applet: Thin and Thick..................................................................................................................... 548
17.2 Enabling Technologies for Web Server Tier................................................................ 553
17.2.1 Servlet................................................................................................................................................. 553
17.2.2 JSP....................................................................................................................................................... 556
17.3 Transactions on Stateless Internet Systems................................................................ 559
17.4 Patterns and the Web................................................................................................. 561
17.4.1 Observer............................................................................................................................................. 562
17.4.2 Composite.......................................................................................................................................... 563
17.4.3 Factory Method.................................................................................................................................. 564
17.4.4 Strategy............................................................................................................................................... 564
17.4.5 Decorator........................................................................................................................................... 565
17.4.6 Model-View-Controller..................................................................................................................... 565
17.4.7 Front Controller................................................................................................................................ 566
17.4.8 Reuse of Tags in JSP.......................................................................................................................... 567
17.4.9 Decoupled Control: Struts................................................................................................................. 571
17.5 Servlet Implementation of Email Management........................................................... 572
Summary............................................................................................................................... 580
Key Terms............................................................................................................................. 581
Review Questions................................................................................................................. 582
Problem-Solving Exercises.................................................................................................... 583
18 Iteration 2 Annotated Code................................................................. 584
18.1 Code Overview........................................................................................................... 584
18.2 Package Acquaintance............................................................................................... 586
18.2.1 Interface IAEmployee....................................................................................................................... 587
18.3 Package Presentation................................................................................................. 588
18.3.1 Class PWindow.................................................................................................................................. 589
18.3.1.1 Constructing and Launching PWindow........................................................................................ 590
18.3.1.2 Data Retrieval in PWindow........................................................................................................... 591
18.3.1.3 Filter Activation.............................................................................................................................. 593
18.3.2 Class PMessageDetailWindow........................................................................................................... 595
18.3.3 Class PMessageTableModel............................................................................................................... 597
18.3.4 Class PDisplayList.............................................................................................................................. 601
18.3.5 Class PDisplayList.Filter.................................................................................................................... 603
18.4 Control Package......................................................................................................... 605
18.4.1 Class CAdmin..................................................................................................................................... 605
18.4.2 Class CMsgSeeker............................................................................................................................... 606
18.5 Package Entity........................................................................................................... 608
18.5.1 Class EIdentityMap............................................................................................................................ 609
18.6 Package Mediator....................................................................................................... 611
18.6.1 Class MModerator.............................................................................................................................. 611
18.6.2 Class MDataMapper........................................................................................................................... 612
18.6.2.1 Outmessage Retrievals and Loading.............................................................................................. 614
18.6.2.2 Outmessage Saving and Unloading............................................................................................... 616
18.7 Presentation Layer: Applet Version............................................................................. 618
18.8 Presentation Layer: Servlet Version............................................................................. 620
18.8.1 Class PEMS........................................................................................................................................ 620
18.8.1.1 Login in Servlet............................................................................................................................... 622
18.8.1.2 Show Outmessages in Servlet......................................................................................................... 623
18.8.2 Class PEMSEdit................................................................................................................................. 626
Summary............................................................................................................................... 628
Key Terms............................................................................................................................. 629
Iteration 2 Questions and Exercises...................................................................................... 629
Part D - Data Engineering and Business Components............................. 632
19 Iteration 3 Requirements and Object Model..................................... 634
19.1 Use Case Model......................................................................................................... 634
19.2 Use Case Document................................................................................................... 636
19.2.1 Brief Description, Preconditions and Postconditions..................................................................... 636
19.2.2 Basic Flow........................................................................................................................................... 637
19.2.3 Subflows............................................................................................................................................. 639
19.2.4 Exception Flows................................................................................................................................ 647
19.3 Conceptual Classes and Relational Tables................................................................. 648
19.4 Supplementary Specification....................................................................................... 652
19.5 Database Specification............................................................................................... 653
Summary............................................................................................................................... 655
Key Terms............................................................................................................................. 655
Review Questions................................................................................................................. 655
20 Security and Integrity.......................................................................... 657
20.1 Designing Security..................................................................................................... 657
20.1.1 Discretionary Authorization.............................................................................................................. 658
20.1.1.1 System and Object Privileges......................................................................................................... 659
20.1.1.2 Programmatic Discretionary Authorization................................................................................. 662
20.1.1.2.1 Using Views............................................................................................................................. 662
20.1.1.2.2 Using Synonyms...................................................................................................................... 664
20.1.1.2.3 Using Stored Procedures and Functions................................................................................ 665
20.1.2 Mandatory Authorization.................................................................................................................. 667
20.1.3 Enterprise Authorization................................................................................................................... 669
20.2 Designing Integrity.................................................................................................... 673
20.2.1 Null and Default Constraints............................................................................................................ 673
20.2.2 Domain and Check Constraints........................................................................................................ 674
20.2.3 Unique and Primary Keys.................................................................................................................. 675
20.2.4 Foreign Keys...................................................................................................................................... 676
20.2.5 Triggers............................................................................................................................................... 677
20.3 Security and Integrity in Email Management............................................................. 682
20.3.1 Security in Email Management.......................................................................................................... 682
20.3.1.1 Explicit Authorization Table......................................................................................................... 685
20.3.1.2 Using Individual Schemas, Global Schema,
and Stored Procedures........................................... 686
20.3.1.3 Using Individual Schemas, Global Schema,
Views, and Stored Procedures............................... 687
20.3.1.4 Authorization Administration....................................................................................................... 689
20.3.2 Integrity in Email Management......................................................................................................... 691
Summary............................................................................................................................... 693
Key Terms............................................................................................................................. 694
Review Questions................................................................................................................. 695
Problem-Solving Exercises.................................................................................................... 696
21 Transactions and Concurrency.......................................................... 697
21.1 Concurrency in System Transactions.......................................................................... 698
21.1.1 ACID Properties................................................................................................................................ 699
21.1.2 Isolation Levels.................................................................................................................................. 700
21.1.3 Lock Modes and Levels..................................................................................................................... 701
21.1.4 Transactional Models......................................................................................................................... 702
21.1.5 Concurrency Control Schemes.......................................................................................................... 705
21.2 Concurrency in Business Transactions....................................................................... 708
21.2.1 Business Transaction Execution Contexts........................................................................................ 708
21.2.2 Business Transactions and Component Technology....................................................................... 709
21.2.3 Transaction Services Across Tiers..................................................................................................... 710
21.2.3.1 Web Tier.......................................................................................................................................... 711
21.2.3.2 Application Tier.............................................................................................................................. 711
21.2.3.3 Database Tier.................................................................................................................................. 713
21.2.4 Offline Concurrency Patterns........................................................................................................... 715
21.2.4.1 Unit of Work.................................................................................................................................. 715
21.2.4.2 Optimistic Offline Lock................................................................................................................. 717
21.2.4.3 Pessimistic Offline Lock................................................................................................................ 718
21.3 Transactions and Concurrency in Email
Management................................................ 719
21.3.1 Flat Transaction Model...................................................................................................................... 720
21.3.2 Unit of Work and Transactional Support......................................................................................... 720
Summary............................................................................................................................... 723
Key Terms............................................................................................................................. 724
Review Questions................................................................................................................. 725
Problem-Solving Exercises.................................................................................................... 726
22 Business Components........................................................................ 728
22.1 Enterprise JavaBeans................................................................................................. 728
22.1.1 EJB Fundamentals............................................................................................................................. 731
22.1.2 Entity Beans........................................................................................................................................ 733
22.1.3 Session Beans...................................................................................................................................... 738
22.2 Business Components for Java................................................................................... 739
22.2.1 Creating Entity Components............................................................................................................ 739
22.2.1.1 XML for Entity Components........................................................................................................ 740
22.2.1.2 Java for Entity Components.......................................................................................................... 742
22.2.2 Creating View Components.............................................................................................................. 743
22.2.2.1 XML for View Components.......................................................................................................... 743
22.2.2.2 Java for View Components............................................................................................................ 744
22.2.3 Creating Application Module............................................................................................................ 745
Summary............................................................................................................................... 746
Key Terms............................................................................................................................. 747
Review Questions................................................................................................................. 747
23 Iteration 3 Annotated Code................................................................. 749
23.1 Code Overview........................................................................................................... 749
23.2 Package Acquaintance............................................................................................... 750
23.2.1 Interface IAReportEntry................................................................................................................... 751
23.3 Package Presentation................................................................................................. 752
23.3.1 Class PWindow.................................................................................................................................. 753
23.3.1.1 Populating Report Contact List..................................................................................................... 753
23.3.1.2 Report Window.............................................................................................................................. 753
23.3.1.3 Activity Report............................................................................................................................... 755
23.3.1.4 Printing Report............................................................................................................................... 756
23.3.1.5 Populating Report Table................................................................................................................ 757
23.3.1.6 Show Authorization Window........................................................................................................ 758
23.3.1.7 Conversion from Rule Matrix to
Authorization Table................................................................ 760
23.3.1.8 Saving Modified Authorization Rules........................................................................................... 762
23.3.1.9 Conversion from Authorization Table to Rule
Matrix................................................................ 762
23.3.1.10 Delete Outmessage......................................................................................................................... 763
23.3.1.11 Modify Outmessage........................................................................................................................ 764
23.3.1.12 Create Outmessage......................................................................................................................... 765
23.3.2 Class PTableWindow......................................................................................................................... 765
PTableWindow Method Summary.............................................................................................................. 765
23.3.2.1 Dynamic Registration of Buttons.................................................................................................. 766
23.3.2.2 Adding Listeners to Dynamically Generated
Button................................................................... 767
23.3.2.3 Button Return Status...................................................................................................................... 768
23.3.2.4 Printing in PTableWindow............................................................................................................ 768
23.4 Package Control......................................................................................................... 769
23.5 Package Entity........................................................................................................... 770
23.5.1 Class EIdentityMap............................................................................................................................ 771
23.5.1.1 Report Registration and Removal................................................................................................. 772
23.5.1.2 Report Retrieval.............................................................................................................................. 773
23.6 Package Mediator...................................................................................................... 775
23.6.1 Class MModerator.............................................................................................................................. 775
23.6.1.1 Authorization Rules........................................................................................................................ 776
23.6.1.2 Report Retrieval.............................................................................................................................. 777
23.6.1.3 Creating Outmessage...................................................................................................................... 779
23.6.1.4 Updating Outmessage.................................................................................................................... 779
23.6.2 Class MDataMapper........................................................................................................................... 780
23.6.2.1 Changes to Previous Methods....................................................................................................... 781
23.6.2.2 Report Retrieval in MDataMapper................................................................................................ 782
23.6.2.3 Authorization Rules Loading in MDataMapper........................................................................... 784
23.6.2.4 Saving Authorization Rules in MDataMapper.............................................................................. 785
23.6.3 Class MUnitOfWork.......................................................................................................................... 786
23.6.3.1 Acquiring MUnitOfWork.............................................................................................................. 787
23.6.3.2 New Entity Registration in MUnitOfWork.................................................................................. 788
23.6.3.3 Dirty Entity Registration in MUnitOfWork................................................................................. 789
23.6.3.4 Entity Removal in MUnitOfWork................................................................................................. 789
23.6.3.5 Committing MUnitOfWork........................................................................................................... 790
23.6.3.6 Execution of Transaction............................................................................................................... 791
23.6.3.7 Starting Transaction....................................................................................................................... 792
23.7 Package Foundation.................................................................................................. 792
23.7.1 Transactions on FConnection........................................................................................................... 793
23.7.2 Execute Statements in FWriter.......................................................................................................... 794
23.7.3 Querying Database in FReader......................................................................................................... 795
23.8 Database Code........................................................................................................... 796
23.8.1 Ref Cursor for ResultSet.................................................................................................................... 796
23.8.2 Retrieval of OutMessages.................................................................................................................. 797
23.8.3 Retrieval of Departmental Outmessages........................................................................................... 798
23.8.4 Deleting Outmessage......................................................................................................................... 799
23.8.5 Creating Outmessage......................................................................................................................... 800
23.8.6 Report Generation............................................................................................................................. 801
23.8.7 Trigger on OutMessage Table........................................................................................................... 803
Summary............................................................................................................................... 804
Key Terms............................................................................................................................. 805
Iteration 3 Questions and Exercises...................................................................................... 805
Bibliography................................................................................................. 807
Index............................................................................................................. 813