Warehouse Stock Clearance Sale

Grab a bargain today!


Object-Oriented Thought Process
By

Rating

Product Description
Product Details

Table of Contents

Introduction 1

 

1 Introduction to Object-Oriented Concepts 5

Procedural Versus OO Programming 6

Moving from Procedural to Object-Oriented Development 9

    Procedural Programming 9

    OO Programming 10

What Exactly Is an Object? 10

    Object Data 10

    Object Behaviors 11

What Exactly Is a Class? 14

    Classes Are Object Templates 15

    Attributes 17

    Methods 17

    Messages 17

Using UML to Model a Class Diagram 18

Encapsulation and Data Hiding 19

    Interfaces 19

    Implementations 20

    A Real-World Example of the Interface/Implementation Paradigm 20

    A Model of the Interface/Implementation Paradigm 21

Inheritance 22

    Superclasses and Subclasses 23

    Abstraction 23

    Is-a Relationships 25

Polymorphism 25

Composition 28

    Abstraction 29

    Has-a Relationships 29

Conclusion 29

Example Code Used in This Chapter 30

 

2 How to Think in Terms of Objects 37

Knowing the Difference Between the Interface and the Implementation 38

    The Interface 40

    The Implementation 40

    An Interface/Implementation Example 41

Using Abstract Thinking When Designing Interfaces 45

Giving the User the Minimal Interface Possible 47

    Determining the Users 48

    Object Behavior 48

    Environmental Constraints 48

    Identifying the Public Interfaces 49

    Identifying the Implementation 50

Conclusion 50

References 51

 

3 Advanced Object-Oriented Concepts 53

Constructors 53

    The Default Constructor 54

    When Is a Constructor Called? 54

    What’s Inside a Constructor? 54

    The Default Constructor 54

    Using Multiple Constructors 55

    The Design of Constructors 59

Error Handling 60

    Ignoring the Problem 60

    Checking for Problems and Aborting the Application 60

    Checking for Problems and Attempting to Recover 61

    Throwing an Exception 61

The Concept of Scope 63

    Local Attributes 64

    Object Attributes 65

    Class Attributes 67

Operator Overloading 68

Multiple Inheritance 69

Object Operations 70

Conclusion 71

References 71

Example Code Used in This Chapter 72

 

4 The Anatomy of a Class 75

The Name of the Class 75

Comments 77

Attributes 77

Constructors 79

Accessors 80

Public Interface Methods 83

Private Implementation Methods 83

Conclusion 84

References 84

Example Code Used in This Chapter 84

 

5 Class Design Guidelines 87

Modeling Real World Systems 87

Identifying the Public Interfaces 88

    The Minimum Public Interface 88

    Hiding the Implementation 89

Designing Robust Constructors (and Perhaps Destructors) 89

Designing Error Handling into a Class 90

Documenting a Class and Using Comments 91

    Building Objects with the Intent to Cooperate 91

Designing with Reuse in Mind 91

    Documenting a Class and Using Comments 91

Designing with Extensibility in Mind 92

    Making Names Descriptive 92

    Abstracting Out Nonportable Code 93

    Providing a Way to Copy and Compare Objects 93

    Keeping the Scope as Small as Possible 94

    A Class Should Be Responsible for Itself 95

Designing with Maintainability in Mind 96

    Using Iteration 97

    Testing the Interface 97

Using Object Persistence 99

    Serializing and Marshaling Objects 100

Conclusion 100

References 101

Example Code Used in This Chapter 101

 

6 Designing with Objects 103

Design Guidelines 103

    Performing the Proper Analysis 107

    Developing a Statement of Work 107

    Gathering the Requirements 107

    Developing a Prototype of the User Interface 108

    Identifying the Classes 108

    Determining the Responsibilities of Each Class 108

    Determining How the Classes Collaborate with Each Other 109

    Creating a Class Model to Describe the System 109

Case Study: A Blackjack Example 109

    Using CRC Cards 111

    Identifying the Blackjack Classes 112

    Identifying the Classes’ Responsibilities 115

    UML Use-Cases: Identifying the Collaborations 120

    First Pass at CRC Cards 124

    UML Class Diagrams: The Object Model 126

    Prototyping the User Interface 127

Conclusion 127

References 128

 

7 Mastering Inheritance and Composition 129

Reusing Objects 129

Inheritance 130

    Generalization and Specialization 133

    Design Decisions 134

Composition 135

    Representing Composition with UML 136

Why Encapsulation Is Fundamental to OO 138

    How Inheritance Weakens Encapsulation 139

    A Detailed Example of Polymorphism 141

Object Responsibility 141

Conclusion 145

References 146

Example Code Used in This Chapter 146

 

8 Frameworks and Reuse: Designing with Interfaces and Abstract Classes 151

Code: To Reuse or Not to Reuse? 151

What Is a Framework? 152

What Is a Contract? 153

    Abstract Classes 154

    Interfaces 157

    Tying It All Together 159

    The Compiler Proof 161

    Making a Contract 162

    System Plug-in-Points 165

An E-Business Example 165

    An E-Business Problem 165

    The Non-Reuse Approach 166

    An E-Business Solution 168

    The UML Object Model 168

Conclusion 173

References 173

Example Code Used in This Chapter 173

 

9 Building Objects 179

Composition Relationships 179

Building in Phases 181

Types of Composition 183

    Aggregations 183

    Associations 184

    Using Associations and Aggregations Together 185

Avoiding Dependencies 186

Cardinality 186

    Multiple Object Associations 189

    Optional Associations 190

Tying It All Together: An Example 191

Conclusion 192

References 192

 

10 Creating Object Models with UML 193

What Is UML? 193

The Structure of a Class Diagram 194

Attributes and Methods 196

    Attributes 196

    Methods 197

Access Designations 197

Inheritance 198

Interfaces 200

Composition 201

    Aggregations 201

    Associations 201

Cardinality 204

Conclusion 205

References 205

 

11 Objects and Portable Data: XML 207

Portable Data 207

The Extensible Markup Language (XML) 209

XML Versus HTML 209

XML and Object-Oriented Languages 210

Sharing Data Between Two Companies 211

Validating the Document with the Document Type Definition (DTD) 212

Integrating the DTD into the XML Document 213

Using Cascading Style Sheets 220

Conclusion 223

References 223

 

12 Persistent Objects: Serialization and Relational Databases 225

Persistent Objects Basics 225

Saving the Object to a Flat File 227

    Serializing a File 227

    Implementation and Interface Revisited 229

    What About the Methods? 231

Using XML in the Serialization Process 231

Writing to a Relational Database 234

    Accessing a Relational Database 236

Loading the Driver 238

    Making the Connection 238

    The SQL Statements 239

Conclusion 242

References 242

Example Code Used in This Chapter 242

 

13 Objects and the Internet 247

Evolution of Distributed Computing 247

Object-Based Scripting Languages 248

A JavaScript Validation Example 250

Objects in a Web Page 253

    JavaScript Objects 254

    Web Page Controls 255

    Sound Players 257

    Movie Players 257

    Flash 258

Distributed Objects and the Enterprise 258

    The Common Object Request Broker Architecture (CORBA) 259

    Web Services Definition 263

    Web Services Code 267

    Invoice.cs 267

    Invoice.vb 268

Conclusion 270

References 270

 

14 Objects and Client/Server Applications 271

Client/Server Approaches 271

Proprietary Approach 272

    Serialized Object Code 272

    Client Code 273

    Server Code 275

    Running the Proprietary Client/Server Example 276

Nonproprietary Approach 278

    Object Definition Code 278

    Client Code 280

    Server Code 281

    Running the Nonproprietary Client/Server Example 283

Conclusion 283

References 284

Example Code Used in This Chapter 284

 

15 Design Patterns 287

Why Design Patterns? 288

Smalltalk’s Model/View/Controller 289

Types of Design Patterns 290

    Creational Patterns 291

    Structural Patterns 295

    Behavioral Patterns 298

Antipatterns 299

Conclusion 300

References 300

Example Code Used in This Chapter 301

 

Index 309

About the Author

Matt Weisfeld

is an associate professor in business & technology at Cuyahoga Community College (Tri-C) in Cleveland, Ohio.A member of the information technology faculty, he focuses on programming, web development, and entrepreneurship. Prior to joining Tri-C,Weisfeld spent 20 years in the information technology industry gaining experience in software development, project management, small business management, corporate training, and part-time teaching. He holds an MS in computer science and an MBA in project management. Besides the first two editions of The Object-Oriented Thought Process, he has published two other computer books and articles in magazines and journals such as developer.com, Dr. Dobb’s Journal, The C/C++ Users Journal, Software Development Magazine, Java Report, and the international journal Project Management.

Ask a Question About this Product More...
 
Look for similar items by category
Item ships from and is sold by Fishpond.com, Inc.

Back to top
We use essential and some optional cookies to provide you the best shopping experience. Visit our cookies policy page for more information.