Home > Store

Object-Oriented Thought Process, The, 3rd Edition

Register your product to gain access to bonus material or receive a coupon.

Object-Oriented Thought Process, The, 3rd Edition

Book

  • Sorry, this book is no longer in print.
Not for Sale

Description

  • Copyright 2009
  • Edition: 3rd
  • Book
  • ISBN-10: 0-672-33016-4
  • ISBN-13: 978-0-672-33016-2

The Object-Oriented Thought Process

Third Edition

Matt Weisfeld

An introduction to object-oriented concepts for developers looking to master modern application practices.

Object-oriented programming (OOP) is the foundation of modern programming languages, including C++, Java, C#, and Visual Basic .NET. By designing with objects rather than treating the code and data as separate entities, OOP allows objects to fully utilize other objects’ services as well as inherit their functionality. OOP promotes code portability and reuse, but requires a shift in thinking to be fully understood. Before jumping into the world of object-oriented programming languages, you must first master The Object-Oriented Thought Process.

Written by a developer for developers who want to make the leap to object-oriented technologies as well as managers who simply want to understand what they are managing, The Object-Oriented Thought Process provides a solution-oriented approach to object-oriented programming. Readers will learn to understand object-oriented design with inheritance or composition, object aggregation and association, and the difference between interfaces and implementations. Readers will also become more efficient and better thinkers in terms of object-oriented development.

This revised edition focuses on interoperability across various technologies, primarily using XML as the communication mechanism. A more detailed focus is placed on how business objects operate over networks, including client/server architectures and web services.

“Programmers who aim to create high quality software–as all programmers should–must learn the varied subtleties of the familiar yet not so familiar beasts called objects and classes. Doing so entails careful study of books such as Matt Weisfeld’s The Object-Oriented Thought Process.”

–Bill McCarty, author of Java Distributed Objects, and Object-Oriented Design in Java

Matt Weisfeld is an associate professor in business and technology at Cuyahoga Community College in Cleveland, Ohio. He has more than 20 years of experience as a professional software developer, project manager, and corporate trainer using C++, Smalltalk, .NET, and Java. He holds a BS in systems analysis, an MS in computer science, and an MBA in project management. Weisfeld has published many articles in major computer trade magazines and professional journals.

Downloads

Downloads

Download the code examples

Sample Content

Online Sample Chapter

Frameworks and Reuse in the Object-Oriented Process: Designing with Interfaces and Abstract Classes

Sample Pages

Download the sample pages

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

Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020