Example: confidence

The Object-Oriented

The Object-OrientedThought ProcessThird s LibraryESSENTIAL REFERENCES FOR PROGRAMMING PROFESSIONALSD eveloper s Librarybooks are designed to provide practicing programmers withunique, high-quality references and tutorials on the programming languages andtechnologies they use in their daily books in the Developer s Libraryare written by expert technology practitionerswho are especially skilled at organizing and presenting information in a way that suseful for other titles include some of the best, most widely acclaimed books within their topic areas:PHP & MySQL Web DevelopmentLuke Welling & Laura ThomsonISBN 978-0-672-32916-6 MySQLPaul DuBoisISBN-13: 978-0-672-32938-8 Linux Kernel DevelopmentRobert LoveISBN-13: 978-0-672-32946-3 Python Essential ReferenceDavid BeazleyISBN-13: 978-0-672-32862-6 Programming in Objective-CStephen G.

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

Tags:

  Data, Designations

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of The Object-Oriented

1 The Object-OrientedThought ProcessThird s LibraryESSENTIAL REFERENCES FOR PROGRAMMING PROFESSIONALSD eveloper s Librarybooks are designed to provide practicing programmers withunique, high-quality references and tutorials on the programming languages andtechnologies they use in their daily books in the Developer s Libraryare written by expert technology practitionerswho are especially skilled at organizing and presenting information in a way that suseful for other titles include some of the best, most widely acclaimed books within their topic areas:PHP & MySQL Web DevelopmentLuke Welling & Laura ThomsonISBN 978-0-672-32916-6 MySQLPaul DuBoisISBN-13: 978-0-672-32938-8 Linux Kernel DevelopmentRobert LoveISBN-13: 978-0-672-32946-3 Python Essential ReferenceDavid BeazleyISBN-13: 978-0-672-32862-6 Programming in Objective-CStephen G.

2 KochanISBN-13: 978-0-321-56615-7 PostgreSQLK orry DouglasISBN-13: 978-0-672-33015-5 Developer s Library books are available at most retail and online bookstores, as wellas by subscription from Safari Books Online at s LibraryUpper Saddle River, NJ Boston Indianapolis San FranciscoNew York Toronto Montreal London Munich Paris MadridCape Town Sydney Tokyo Singapore Mexico CityThe Object-OrientedThought ProcessThird EditionMatt WeisfeldThe Object-Oriented Thought Process, Third EditionCopyright 2009 by Pearson EducationAll rights reserved. No part of this book shall be reproduced, stored in a retrieval system, ortransmitted by any means, electronic, mechanical, photocopying, recording, or otherwise,without written permission from the publisher.

3 No patent liability is assumed with respect tothe use of the information contained herein. Although every precaution has been taken inthe preparation of this book, the publisher and author assume no responsibility for errors oromissions. Nor is any liability assumed for damages resulting from the use of the informa-tion contained : 0-672-33016-4 ISBN-13: 978-0-672-33016-2 Library of Congress Cataloging-in-Publication DataWeisfeld, Matt Object-Oriented thought process / Matt Weisfeld. -- 3rd 978-0-672-33016-2 (pbk.)1. Object-Oriented programming (Computer science) I. Title. '17--dc222008027242 Printed in the United States of AmericaFirst Printing: August 2008 TrademarksAll terms mentioned in this book that are known to be trademarks or service marks havebeen appropriately capitalized.

4 Sams Publishing cannot attest to the accuracy of this infor-mation. Use of a term in this book should not be regarded as affecting the validity of anytrademark or service and DisclaimerEvery effort has been made to make this book as complete and as accurate as possible,but no warranty or fitness is implied. The information provided is on an as is basis. Theauthor and the publisher shall have neither liability nor responsibility to any person or entitywith respect to any loss or damages arising from the information contained in this book orfrom the use of the programs accompanying SalesPearson offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales.

5 For more information, please Corporate and Government sales outside of the , please contactInternational EditorMark TaberDevelopmentEditorSonglin QiuManaging EditorPatrick KanouseProject EditorSeth KerneyCopy EditorChrissy WhiteIndexerTim WrightProofreaderMatt PurcellTechnical EditorJon UpchurchPublishingCoordinatorVanessa EvansBook DesignerGary AdairCompositionMark ShirarvContentsContents at a GlanceIntroduction11 Introduction to Object-Oriented Concepts52 How to Think in Terms of Objects373 Advanced Object-Oriented Concepts534 The Anatomy of a Class755 Class Design Guidelines876 Designing with Objects1037 Mastering Inheritance and Composition1298 Frameworks and Reuse.

6 Designing with Interfacesand Abstract Classes1519 Building Objects17910 Creating Object Models with UML19311 Objects and Portable data : XML20712 Persistent Objects: Serialization and RelationalDatabases22513 Objects and the Internet24714 Objects and Client/Server Applications27115 Design Patterns287 Index309 Table of ContentsIntroduction 11 Introduction to Object-Oriented Concepts 5 Procedural Versus OO Programming 6 Moving from Procedural to Object-Oriented Development 9 Procedural Programming 9OO Programming 10 What Exactly Is an Object? 10 Object data 10 Object Behaviors 11 What Exactly Is a Class?

7 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 20A Real-World Example of the Interface/ImplementationParadigm 20A Model of the Interface/Implementation Paradigm21 Inheritance 22 Superclasses and Subclasses 23 Abstraction 23Is-a Relationships 25 Polymorphism 25 Composition 28 Abstraction 29 Has-a Relationships 29 Conclusion 29 Example Code Used in This Chapter 302 How to Think in Terms of Objects 37 Knowing the Difference Between the Interface and theImplementation 38 The Interface 40 The Implementation 40An 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 513 Advanced Object-Oriented Concepts 53 Constructors 53 The Default Constructor 54 When Is a Constructor Called?

8 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 724 The Anatomy of a Class 75 The Name of the Class 75 Comments

9 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 845 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 94A Class Should Be Responsible for Itself 95 Designing with Maintainability in Mind 96 Using Iteration 97 Testing the Interface 97 Using Object Persistence 99

10 Serializing and Marshaling Objects 100 Conclusion 100 References 101 Example Code Used in This Chapter 1016 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 EachOther 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.


Related search queries