This book uses a case-study-based approach for providing a comprehensive introduction to the principles of object-oriented design. The salient points of its coverage are:
The stress of the book is on implementation aspects, without which the learning is incomplete. This is achieved through the use of case studies for introducing the various concepts of analysis and design, ensuring that the theory is never separate from the implementation aspects. In the first edition, UML was introduced on an “as-needed” basis; certain UML diagrams that were not needed were not covered. This edition includes a new chapter for providing a concise introduction to the remaining UML diagrams using the same holistic approach used in the first edition.
Preface to the Second edition Preface to the First edition PART I: BASIC OBJECT-ORIENTED CONCEPTS 1 Introduction 1.1What is Object-Oriented Development? 1.2 Key Concepts of Object-Oriented Design 1.3 Other Related Concepts 1.3.1 Modular design and encapsulation 1.3.2 Cohesion and coupling 1.3.3 Modifiability and testability 1.4 Benefits and Drawbacks of the Paradigm 1.5 History 1.6 Discussion and Further Reading Exercises
2 Basics of Object-Oriented Programming 2.1 The Basics 2.2 Implementing Classes 2.2.1 Constructors 2.2.2 Printing an object 2.2.3 Static members 2.3 Programming with Multiple Classes 2.4 Interfaces 2.4.1 Implementation of StudentLinkedList 2.4.2 Array implementation of lists 2.5 Abstract Classes 2.6 Comparing Objects for Equality 2.7 A Notation for Describing Object-Oriented Systems 2.7.1 Class diagrams 2.7.2 Use cases and use case diagrams 2.7.3 Sequence diagrams 2.8 Discussion and Further Reading Exercises 3 Relationships between Classes 3.1 Association 3.1.1 Characteristics of associations 3.2 Inheritance 3.2.1 An example of a hierarchy 3.2.2 Inheriting from an interface 3.2.3 Polymorphism and dynamic binding 3.2.4 Protected fields and methods 3.2.5 The object class 3.3 Genericity 3.4 Discussion and Further Reading 3.4.1 A generalised notion of conformance Exercises 4 Language Features for Object-Oriented Implementation 4.1 Organising the Classes 4.1.1 Creating the files 4.1.2 Packages 4.1.3 Protected access and package access 4.2 Collection Classes 4.3 Exceptions 4.4 Run-Time Type Identification 4.4.1 Reflection: Using the Class object 4.4.2 Using the instanceof operator 4.4.3 Downcasting 4.5 Graphical User Interfaces: Programming Support 4.5.1 The basics 4.5.2 Event handling 4.5.3 More on widgets and layouts 4.5.4 Drawing shapes 4.5.5 Displaying a piece of text 4.6 Long-Term Storage of Objects 4.6.1 Storing and retrieving objects 4.6.2 Issues in storing and retrieving objects 4.6.3 The Java serialization mechanism 4.7 Discussion and Further Reading Exercises PART II INTRODUCTION TO OBJECT-ORIENTED ANALYSIS, DESIGN, IMPLEMENTATION AND REFACTORING 5 Elementary Design Patterns 5.1 Iterator 5.1.1 Iterator implementation 5.2 Singleton 5.2.1 Subclassing singletons 5.3 Adapter 5.4 Discussion and Further Reading Exercises 6 Analysing a System 6.1 Overview of the Analysis Phase 6.2 Stage 1: Gathering the Requirements 6.2.1 Case study introduction 6.3 Functional Requirements Specification 6.3.1 Use case analysis 6.4 Defining Conceptual Classes and Relationships 6.5 Using the Knowledge of the Domain 6.6 Discussion and Further Reading Exercises 7 Design and Implementation 7.1Design 7.1.1 Major subsystems 7.1.2 Creating the software classes 7.1.3 Assigning responsibilities to the classes 7.1.4 Class diagrams 7.1.5 User interface 7.1.6 Data storage 7.2 Implementing Our Design 7.2.1 Setting up the interface 7.2.2 Adding new books 7.2.3 Issuing books 7.2.4 Printing transactions 7.2.5 Placing and processing holds 7.2.6 Storing and retrieving the library object 7.3 Discussion and Further Reading 7.3.1 Conceptual, software and implementation classes 7.3.2 Building a commercially acceptable system 7.3.3 The facade pattern 7.3.4 Implementing singletons 7.3.5 Further reading Exercises 8 How ‘Object-Oriented’ is Our Design? 8.1 Introduction 8.2 A First Example of Refactoring 8.2.1 A library that charges fines: Initial solution 8.2.2 Refactoring the solution 8.3 A Second Look at Remove Books 8.4 Using Generics to Refactor Duplicated Code 8.4.1 A closer look at the collection classes 8.4.2 Instantiating Catalog and MemberList 8.5 Discussion and Further Reading Exercises PART III ADVANCED CONCEPTS IN OBJECT-ORIENTED DESIGN 9 Exploring Inheritance 9.1 Introduction 9.2 Applications of Inheritance 9.2.1 Restricting behaviours and properties 9.2.2 Abstract superclass 9.2.3 Adding features 9.2.4 Hiding features of the superclass 9.2.5 Combining structural and type inheritance 9.3 Inheritance: Some Limitations and Caveats 9.3.1 Deep hierarchies 9.3.2 Lack of multiple inheritance 9.3.3 Changes in the superclass 9.3.4 Typing issues: The Liskov substitution principle 9.3.5 Addressing the limitations 9.4 Type Inheritance 9.4.1 A simple example 9.4.2 The cloneable interface 9.4.3 The runnable interface 9.5 Making Enhancements to the Library Class 9.5.1 A first attempt 9.5.2 Drawbacks of the above approach 9.6 Improving the Design 9.6.1 Designing the hierarchy 9.6.2 Invoking the constructors 9.6.3 Distributing the responsibilities 9.6.4 Factoring responsibilities across the hierarchy 9.7 Consequences of Introducing Inheritance 9.7.1 Exception handling 9.7.2 Adding new functionality to a hierarchy 9.8 Multiple Inheritance 9.8.1 Mechanisms for resolving conflicts 9.8.2 Repeated inheritance 9.8.3 Multiple inheritance in Java 9.9 Discussion and Further Reading 9.9.1 Design patterns that facilitate inheritance 9.9.2 Performance of object-oriented systems Exercises 10 Modelling with Finite State Machines 10.1 Introduction 10.2 A Simple Example 10.3 Finite State Modelling 10.4 A First Solution to the Microwave Problem 10.4.1 Completing the analysis 10.4.2 Designing the system 10.4.3 The implementation classes 10.4.4 A critique of the above design 10.5 Using the State Pattern 10.5.1 Creating the state hierarchy 10.5.2 Implementation 10.6 Improving Communication between Objects 10.6.1 Loosely coupled communication 10.7 Redesign Using the Observer Pattern 10.7.1 Communication with the user 10.7.2 The improved design 10.8 Eliminating the Conditionals 10.8.1 Using the Java event mechanism 10.8.2 Using the context as a ‘switchboard’ 10.8.3 Implementation 10.9 Designing GUI Programs Using the State Pattern 10.9.1 Design of a GUI system for the library 10.9.2 The context 10.10 Discussion and Further Reading 10.10.1 Implementing the state pattern 10.10.2 Features of the state pattern 10.10.3 Consequences of observer 10.10.4 Recognising and processing external events 10.10.5 Handling the events Exercises 11 Interactive Systems and the MVC Architecture 11.1 Introduction 11.2 The MVC Architectural Pattern 11.2.1 Examples 11.2.2 Implementation 11.2.3 Benefits of the MVC pattern 11.3 Analysing a Simple Drawing Program 11.3.1 Specifying the requirements 11.3.2 Defining the use cases 11.4 Designing the System 11.4.1 Defining the model 11.4.2 Defining the controller 11.4.3 Selection and deletion 11.4.4 Saving and retrieving the drawing 11.5 Design of the Subsystems 11.5.1 Design of the model subsystem 11.5.2 Design of item and its subclasses 11.5.3 Design of the controller subsystem 11.5.4 Design of the view subsystem 11.6 Getting into the Implementation 11.6.1 Item and its subclasses 11.6.2 Implementation of the model class 11.6.3 Implementation of the controller class 11.6.4 Implementation of the view class 11.6.5 The driver program 11.6.6 A critique of our design 11.7 Implementing the Undo Operation 11.7.1 Employing the command pattern 11.7.2 Implementation 11.8 Drawing Incomplete Items 11.9 Adding a New Feature 11.10 Pattern-Based Solutions 11.10.1 Examples of architectural patterns 11.11 Discussion and Further Reading 11.11.1 Separating the view and the controller 11.11.2 The space overhead for the command pattern 11.11.3 How to store the items 11.11.4 Exercising caution when allowing undo 11.11.5 Synchronising updates Exercises 12 Designing with Distributed Objects 12.1 Client/Server Systems 12.1.1 Basic architecture of client/server systems 12.2 Java Remote Method Invocation 12.2.1 Remote interfaces 12.2.2 Implementing a remote interface 12.2.3 Creating the server 12.2.4 The client 12.2.5 Setting up the system 12.3 Implementing an Object-Oriented System on the Web 12.3.1 HTML and Java servlets 12.3.2 Deploying the library system on the world-wide web 12.4 Discussion and Further Reading Exercises 13 The Unified Modelling Language 13.1 Communication Diagrams 13.1.1 Specification-level Communication Diagrams 13.1.2 Instance-level Communication Diagram 13.2 Timing Diagrams 13.3 Activity Diagrams 13.4 Interaction Overview Diagrams 13.5 Component diagrams 13.5.1 Usage 13.6 Composite Structure Diagrams 13.7 Package Diagrams 13.8 Object Diagrams 13.9 Deployment Diagrams 13.10 Discussion and Further Reading
Appendix A: Java Essentials A.1 Language Basics A.2 A Simple Java Program A.3 Primitive Data Types A.4 Relational Operators A.5 A Note on Input and Output A.6 Selection Statements A.7 Loops A.8 Methods A.9 Arrays
Bibliography Index