Enterprise Software Architecture and Design Enterprise Software Architecture and Design Entities, Services, and Resources Dominic Duggan AJOHNWILEY&SONS,INC.,PUBLICATION Copyright©2012byJohnWiley&Sons,Inc.Allrightsreserved. PublishedbyJohnWiley&Sons,Inc.,Hoboken,NewJersey. PublishedsimultaneouslyinCanada. Nopartofthispublicationmaybereproduced,storedinaretrievalsystem,ortransmittedinanyform orbyanymeans,electronic,mechanical,photocopying,recording,scanning,orotherwise,exceptas permittedunderSection107or108ofthe1976UnitedStatesCopyrightAct,withouteithertheprior writtenpermissionofthePublisher,orauthorizationthroughpaymentoftheappropriateper-copyfee totheCopyrightClearanceCenter,Inc.,222RosewoodDrive,Danvers,MA01923,(978)750-8400, fax(978)646-8600,oronthewebatwww.copyright.com.RequeststothePublisherforpermission shouldbeaddressedtothePermissionsDepartment,JohnWiley&Sons,Inc.,111RiverStreet, Hoboken,NJ07030,(201)748-6011,fax(201)748-6008. LimitofLiability/DisclaimerofWarranty:Whilethepublisherandauthorhaveusedtheirbestefforts inpreparingthisbook,theymakenorepresentationsorwarrantieswithrespecttotheaccuracyor completenessofthecontentsofthisbookandspecificallydisclaimanyimpliedwarrantiesof merchantabilityorfitnessforaparticularpurpose.Nowarrantymaybecreatedoreextendedbysales representativesorwrittensalesmaterials.Theadviceandstrategiescontainedherinmaynotbe suitableforyoursituation.Youshouldconsultwithaprofessionalwhereappropriate.Neitherthe publishernorauthorshallbeliableforanylossofprofitoranyothercommercialdamages,including, butnotlimitedtospecial,incidental,consequential,orotherdamages. ForgeneralinformationonourotherproductsandservicespleasecontactourCustomerCare DepartmentwithintheU.S.at877-762-2974or,outsidetheU.S.at317-572-3993orfax 317-572-4002. Wileyalsopublishesitsbooksinavarietyofelectronicformats.Somecontentthatappearsinprint, however,maynotbeavailableinelectronicformat. LibraryofCongressCataloging-in-PublicationData: Duggan,Dominic. Enterprisessoftwarearchitectureanddesign:entities,services,andresources applications/DominicDuggan. p.cm.—(Quantitativesoftwareengineeringseries;10) ISBN978-0-470-56545-2(hardback) 1. EnterpriseSoftwareArchitectureandDesign(Computerscience)I.Title. TK5105.5828.D842012 004.6(cid:2)54—dc23 2011031403 PrintedintheUnitedStatesofAmerica. 10987654321 ToMyFather Contents in Brief 1. Introduction 1 2. Middleware 7 3. Data Modeling 59 4. Data Processing 104 5. Domain-Driven Architecture 167 6. Service-Oriented Architecture 207 7. Resource-Oriented Architecture 359 Appendix A: Introduction to Haskell 416 Appendix B: Time in Distributed Systems 437 vii Contents List of Figures xv Acknowledgements xxiii 1. Introduction 1 References / 6 2. Middleware 7 2.1 Enterprise Information Systems / 7 2.2 Communication / 12 2.3 System and Failure Models / 21 2.4 Remote Procedure Call / 34 2.5 Message-Oriented Middleware / 42 2.6 Web Services and Service-Oriented Architecture (SOA) / 46 2.7 Cloud Computing / 52 2.8 Naming and Discovery / 55 2.9 Further Reading / 56 References / 57 ix x CONTENTS 3. Data Modeling 59 3.1 Entities and Relationships / 60 3.1.1 Concepts and Entities / 60 3.1.2 Attributes and Relationships / 61 3.1.3 Properties of Relationship Types / 65 3.1.4 Special Relationship Types / 69 3.2 XML Schemas / 74 3.3 Defining New Types / 79 3.3.1 Defining Simple Types / 79 3.3.2 Defining Complex Types / 82 3.4 Derived Types / 85 3.4.1 Derived Simple Types / 86 3.4.2 Derived Complex Types / 87 3.5 Document Hierarchies / 94 3.6 Relationship Types in XML Schemas / 98 3.7 Metaschemas and Metamodels / 100 3.8 Further Reading / 102 References / 102 4. Data Processing 104 4.1 Processing XML Data / 104 4.1.1 Tree Processing / 105 4.1.2 Schema Binding / 109 4.1.3 Stream Processing / 114 4.1.4 External Processing / 119 4.2 Query Languages and XQuery / 122 4.3 XML Databases / 134 4.3.1 Storage as Relational Tables / 135 4.3.2 Storage as Large Strings / 137 4.3.3 Native XML Storage / 137 4.4 Web Services / 138 4.4.1 SOAP: (not so) Simple Object Access Protocol / 139 4.4.2 WSDL: Web Services Description Language / 145 4.4.3 Web Service Policy / 155 CONTENTS xi 4.5 Presentation Layer: JSON and JQUERY / 159 References / 166 5. Domain-Driven Architecture 167 5.1 Software Architecture / 167 5.2 Domain-Driven Design / 168 5.3 Application Frameworks / 175 5.4 Domain-Specific Languages (DSLs) / 180 5.5 An Example API for Persistent Domain Objects / 188 5.6 Domain-Driven Architecture / 197 5.7 Further Reading / 205 References / 205 6. Service-Oriented Architecture 207 6.1 Services and Procedures / 207 6.2 Service-Oriented Architecture (SOA) / 211 6.3 Service Design Principles / 216 6.4 Service-Oriented Architecture (SOA) Governance / 218 6.5 Standardized Service Contract / 221 6.5.1 Operations Contract / 222 6.5.2 Data Contract / 223 6.5.3 Policy Contract / 224 6.5.4 Binding Contract / 226 6.5.5 Contract Versioning / 231 6.6 Service Loose Coupling / 237 6.6.1 Motivation for Loose Coupling / 237 6.6.2 Contract Development / 239 6.6.3 Loose Coupling Patterns / 242 6.6.4 Cost of Loose Coupling / 246 6.7 Service Abstraction / 248 6.7.1 Platform Abstraction / 248 6.7.2 Protocol Abstraction / 249 6.7.3 Procedural Abstraction / 261
Description: