2006 aw applying domain driven design and patterns wit

923 98 0
2006   aw   applying domain driven design and patterns   wit

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Applying Domain-Driven Design and Patterns: With Examples in C# and NET, 1/e By Jimmy Nilsson Publisher: Addison Wesley Professional Pub Date: May 08, 2006 Print ISBN-10: 0-321-26820-2 Print ISBN-13: 978-0-321-26820-4 Pages: 576 Table of Contents | Index "[This] is a book about design in the NET world, driven in an agile manner and infused with the products of the enterprise patterns community [It] shows you how to begin applying such things as TDD, object relational mapping, and DDD to NET projects techniques that many developers think are the key to future software development As the technology gets more capable and sophisticated, it becomes more important to understand how to use it well This book is a valuable step toward advancing that understanding." Martin Fowler, author of Refactoring and Patterns of Enterprise Application Architecture Patterns, Domain-Driven Design (DDD), and Test-Driven Development (TDD) enable architects and developers to create systems that are powerful, robust, and maintainable Now, there's a comprehensive, practical guide to leveraging all these techniques primarily in Microsoft NET environments, but the discussions are just as useful for Java developers Drawing on seminal work by Martin Fowler (Patterns of Enterprise Application Architecture) and Eric Evans (Domain-Driven Design), Jimmy Nilsson shows how to create real-world architectures for any NET application Nilsson illuminates each principle with clear, wellannotated code examples based on C# 1.1 and 2.0 His examples and discussions will be valuable both to C# developers and those working with other NET languages and any databaseseven with other platforms, such as J2EE Coverage includes · Quick primers on patterns, TDD, and refactoring · Using architectural techniques to improve software quality · Using domain models to support business rules and validation · Applying enterprise patterns to provide persistence support via NHibernate · Planning effectively for the presentation layer and UI testing · Designing for Dependency Injection, Aspect Orientation, and other new paradigms Applying Domain-Driven Design and Patterns: With Examples in C# and NET, 1/e By Jimmy Nilsson Publisher: Addison Wesley Professional Pub Date: May 08, 2006 Print ISBN-10: 0-321-26820-2 Print ISBN-13: 978-0-321-26820-4 Pages: 576 Table of Contents | Index Copyright Praise for Applying Domain-Driven Design and Patterns About the Author Forewords Preface: Bridging Gaps Acknowledgments Part I: Background Chapter 1 Values to Value: Or Embarrassing Ramblings When Self-Reflecting on the Last Few Years Overall Values Architecture Styles to Value Process Ingredients to Value Continuous Integration Don't Forget About Operations Summary Chapter 2 A Head Start on Patterns A Little Bit About Patterns Design Patterns Architectural Patterns Design Patterns for Specific Types of Applications Domain Patterns Summary Chapter 3 TDD and Refactoring Test-Driven Development (TDD) Mocks and Stubs Refactoring Summary Part II: Applying DDD Chapter 4 A New Default Architecture The Basis of the New Default Architecture A First Sketch Making a First Attempt at Hooking the UI to the Domain Model Yet Another Dimension Summary Chapter 5 Moving Further with Domain-Driven Design Refining the Domain Model Through Simple TDD Experimentation Fluent Interface Summary Chapter 6 Preparing for Infrastructure POCO as a Lifestyle Dealing with Save Scenarios Let's Build the Fake Mechanism Database Testing Querying Summary Chapter 7 Let the Rules Rule Categorization of Rules Principles for Rules and Their Usage Starting to Create an API Requirements for a Basic Rules API Related to Persistence Focus on Domain-Related Rules Extending the API Refining the Implementation Binding to the Persistence Abstraction Generics and Anonymous Methods to the Rescue What Others Have Done Summary Part III: Applying PoEaa Chapter 8 Infrastructure for Persistence Requirements on the Persistence Infrastructure Where to Store Data Approach Classification Another Classification: Infrastructure Patterns Summary Chapter 9 Putting NHibernate into Action Why NHibernate? A Short Introduction to NHibernate Requirements of the Persistence Infrastructure Classification Another Classification: Infrastructure Patterns NHibernate and DDD Summary Part IV: What's Next? Chapter 10 Design Techniques to Embrace Context Is King An Introduction to SOA Inversion of Control and Dependency Injection Aspect-Oriented Programming (AOP) Summary Chapter 11 Focus on the UI A Prepilogue The Model-View-Controller Pattern Test-Driving a Web Form Mapping and Wrapping Summary Epilogue Part V: Appendices Appendix A Other Domain Model Styles Object-Oriented Data Model, Smart Service Layer, and Documents The Database Model Is the Domain Model Pragmatism and the Nontraditional Approach Summary Appendix B Catalog of Discussed Patterns Abstract Factory [GoF Design Patterns] Aggregate [Evans DDD] Bounded Context [Evans DDD] Chain of Responsibility [GoF Design Patterns] Class Table Inheritance [Fowler PoEAA] Coarse-Grained Lock [Fowler PoEAA] Collecting Parameter Pattern [Beck SBPP] Concrete Table Inheritance [Fowler PoEAA] Data Mapper [Fowler PoEAA] Data Transfer Objects [Fowler PoEAA] Decorator [GoF Design Patterns] Dependency Injection Domain Model [Fowler PoEAA] Embedded Value [Fowler PoEAA] Entity [Evans DDD] Factory [Evans DDD] Factory Method [GoF Design Patterns] Foreign Key Mapping [Fowler PoEAA] Generation Gap [Vlissides Pattern Hatching] Identity Field [Fowler PoEAA] Identity Map [Fowler PoEAA] Implicit Lock [Fowler PoEAA] Layer Supertype [Fowler PoEAA] Layers [POSA] Lazy Load [Fowler PoEAA] Metadata Mapping [Fowler PoEAA] Model View Controller [Fowler PoEAA] Model View Presenter [Fowler PoEAA2] Notification [Fowler PoEAA2] Null Object [Woolf Null Object] Optimistic Offline Lock [Fowler PoEAA] Party Archetype [Arlow/Neustadt Archetype Patterns] Pessimistic Offline Lock [Fowler PoEAA] Pipes and Filters [POSA] Presentation Model [Fowler PoEAA2] Proxy [GoF Design Patterns] Query Object [Fowler PoEAA] Recordset [Fowler PoEAA] Reflection [POSA] Registry [Fowler PoEAA] Remote Faỗade [Fowler PoEAA] Repository [Evans DDD] Separated Presentation [Fowler PoEAA2] Service Layer [Fowler PoEAA] Service Locator [Alur/Crupi/Malks Core J2EE Patterns] Services [Evans DDD] Single Table Inheritance [Fowler PoEAA] Singleton [GoF Design Patterns] Specification [Evans DDD] State [GoF Design Patterns] Table Module [Fowler PoEAA] Template Method [GoF Design Patterns] Transaction Script [Fowler PoEAA] Unit of Work [Fowler PoEAA] Value Object [Evans DDD] References Index Copyright Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed with initial capital letters or in all capitals The author and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein The publisher offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales, which may include electronic versions and/or custom covers and content particular to your business, training goals, marketing focus, and branding interests For more information, please contact: U.S Corporate and Government Sales (800) 382-3419 corpsales@pearsontechgroup.com For sales outside the United States please contact: International Sales international@pearsoned.com Visit us on the Web: www.awprofessional.com Library of Congress Cataloging-in-Publication Data Nilsson, Jimmy Applying domaindriven design and patterns with examples in C# and NET / Jimmy Nilsson p cm Includes bibliographical references ISBN 0-321-26820-2 Computer software-Development C# (Computer program language) 3 Microsoft NET I QA76.76.D47N645 2006 005.1 dc22 2006004371 Copyright © 2006 Pearson Education, Inc All rights reserved Printed in the United States of America This publication is protected by copyright, and permission must be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise For information regarding permissions, write to: Pearson Education, Inc Rights and Contracts Department 75 Arlington Street, Suite 300 Boston, MA 02116 Fax: (617) 848-7047 Text printed in the United States on recycled paper at R R Donnelley in Crawfordsville, Indiana First printing, May 2006 Dedication To Lotta, Tim, and Leo: the centers of my universe mechanisms TDD problems self-shunting Seovi´c, Aleksandar Separated Presentation 2nd server-side databases versus clientside databases Service Layer 2nd example Service Locator 2nd 3rd versus Dependency Injection Inversion of Control Service Orientation (SO) Services SOA design of interations with other services policy scaling schema unavailable services versioning Web services service validation, domain-related rules SessionFactory set-based processing methods locating SetController() SetFieldWhenReconstitutingFromPersistence() 2nd Setter Dependency Injection shared nothing cluster sharing instances Single Responsibility Principle (SRP) 2nd 3rd Single Table Inheritance single-entity-oriented Business Logic singletons 2nd Skjoldborg, Christoffer MVC pattern SnapDAL snapshots SO (Service Orientation) partitioning Domain Model SOA 2nd client server and complex messaging processes one-way asynchronous messaging OO Rich Client applications scalability scaling services services design of interactions with other services policy schema unavailable services Web services Web Service Software Factories, up-front architecture design Specification 2nd complex rules generics queries speed, PI (cost for) Spolsky, Joel Spring.NET, Dependency Injection SQL, O/R Mapper SrcPanel SRP (Single Responsibility Principle) 2nd 3rd StashPanel State 2nd adding to existing classes application state user state stateful Domain Model instantiation stateless Domain Model instantiation StateModifier State pattern states location, principles for rules principles for rules savable states, creating APIs storing data (persistence infrastructure) 2nd choosing how to store data file system object database RAM relational database resource managers Strategy, Design Patterns strings stubs 2nd test stubs styles sub-results, TDD subclassing sublists submitting data, example subset Domain Model instantiation Szyperski Index [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] Table Module 2nd tables, mapping classes onto tables versus mappting tables onto classes TakeOrder() TDD (Test-Driven Development) 2nd 3rd API compilers demonstration design effects client control coupling interfaces/factories sub-results documentation Domain Models flow 2nd independence maintenance mock objects problems losing the overview maintaining code persistent data security UI reasons for using refactoring 2nd reusability testing stubs unit testing GUI display dynamics displaying object types picking objects unit tests working with difficult components Template Method testing data access database testing evolving schemas maintaining the state of the database during the run resetting data used by a test before the test resetting database before each test separating the testing of the unit from the testing of the call to the problems doing small scale integration testing, Repositories problems testing Repositories unit testing domain model example GUI mocking with NMock TDD of GUI testing stubs consequences tests, naming test stub timeout watchers tools, cleaning tools (refactoring) ToString() TotalAmount TotalCredit TotalCreditService totals for each order tracing mechanisms no tracing tradeoffs transaction abstraction Transaction Script 2nd 3rd transactions 2nd NHibernate transitions domain-related rules incorrect transitions, APIs two-way rules checking type explosion Index [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] ubiquitous language UI (user interface) Domain Model adding orders list orders for customers Separated Presentation pattern reusing rules TDD problems testing UML (Unified Modeling Language) 2nd Unit of Work pattern 2nd 3rd NHibernate save scenarios saving orders unit testing domain model example displaying candy types handling display dynamics picking objects GUI mocking:with NMock TDD of GUI display dynamics displaying object types picking objects unit tests Fake structure of Repositoryrelated tests TDD up-front architecture design consistency MDA reusing ideas Software Factories UpdateOrderStatus() use cases, model focus UserBC UserDao UserDaoStub UserInfo 2nd user interface (UI) Domain Model adding orders list orders for customers Separated Presentation pattern reusing rules TDD problems testing user numbers user state Index [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] validation, reactive validation validation hooks, NHibernate validation interfaces, making pluggable Value Objects 2nd PI values model focus DDD use cases VariationPoint() variations VB6 (Visual Basic 6) VB6, filtering in databases with huge parameters versioning Aggregates services, SOA versions, NHibernate view interfaces, simplifying through adapters (MVC pattern) viewMock Views combining with Controllers (MVC pattern) decoupling Controllers Visual Basic 6 (VB6) Index [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] waterfall process web forms domain model example GUI implementing mocking with NMock TDD of GUI unit testing Web Service how fine-grained? SOA Web services Windsor WinForms Application Server and without an Application Server wrapping considerations for using Domain Model with Presentation Model Index [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] XML, Metadata Mapping pattern XP (Extreme Programming) 2nd Index [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] YAML Young, Gregory 2nd code smells snapshots ...· Designing for Dependency Injection, Aspect Orientation, and other new paradigms Applying Domain- Driven Design and Patterns: With Examples in C# and NET, 1/e By Jimmy Nilsson... A Head Start on Patterns A Little Bit About Patterns Design Patterns Architectural Patterns Design Patterns for Specific Types of Applications Domain Patterns Summary Chapter 3 TDD and Refactoring... I am certain that Applying Domain- Driven Design and Patterns will become a mandatory title in the enterprise bookshelf." Mikael Freidlitz, vice president of Content and Knowledge Programs at IASA "Domain- Driven Design is an important technique that can

Ngày đăng: 25/03/2019, 17:10

Mục lục

  • Applying Domain-Driven Design and Patterns: With Examples in C# and .NET, 1/e

  • Table of Contents

  • Copyright

  • Praise for Applying Domain-Driven Design and Patterns

  • About the Author

  • Forewords

    • Preface: Bridging Gaps

  • Acknowledgments

  • Part I: Background

    • Chapter 1. Values to Value: Or Embarrassing Ramblings When Self-Reflecting on the Last Few Years

      • Overall Values

      • Architecture Styles to Value

      • Process Ingredients to Value

      • Continuous Integration

      • Don't Forget About Operations

      • Summary

    • Chapter 2. A Head Start on Patterns

      • A Little Bit About Patterns

      • Design Patterns

      • Architectural Patterns

      • Design Patterns for Specific Types of Applications

      • Domain Patterns

      • Summary

    • Chapter 3. TDD and Refactoring

      • Test-Driven Development (TDD)

      • Mocks and Stubs

      • Refactoring

      • Summary

  • Part II: Applying DDD

    • Chapter 4. A New Default Architecture

      • The Basis of the New Default Architecture

      • A First Sketch

      • Making a First Attempt at Hooking the UI to the Domain Model

      • Yet Another Dimension

      • Summary

    • Chapter 5. Moving Further with Domain-Driven Design

      • Refining the Domain Model Through Simple TDD Experimentation

      • Fluent Interface

      • Summary

    • Chapter 6. Preparing for Infrastructure

      • POCO as a Lifestyle

      • Dealing with Save Scenarios

      • Let's Build the Fake Mechanism

      • Database Testing

      • Querying

      • Summary

    • Chapter 7. Let the Rules Rule

      • Categorization of Rules

      • Principles for Rules and Their Usage

      • Starting to Create an API

      • Requirements for a Basic Rules API Related to Persistence

      • Focus on Domain-Related Rules

      • Extending the API

      • Refining the Implementation

      • Binding to the Persistence Abstraction

      • Generics and Anonymous Methods to the Rescue

      • What Others Have Done

      • Summary

  • Part III: Applying PoEaa

    • Chapter 8. Infrastructure for Persistence

      • Requirements on the Persistence Infrastructure

      • Where to Store Data

      • Approach

      • Classification

      • Another Classification: Infrastructure Patterns

      • Summary

    • Chapter 9. Putting NHibernate into Action

      • Why NHibernate?

      • A Short Introduction to NHibernate

      • Requirements of the Persistence Infrastructure

      • Classification

      • Another Classification: Infrastructure Patterns

      • NHibernate and DDD

      • Summary

  • Part IV: What's Next?

    • Chapter 10. Design Techniques to Embrace

      • Context Is King

      • An Introduction to SOA

      • Inversion of Control and Dependency Injection

      • Aspect-Oriented Programming (AOP)

      • Summary

    • Chapter 11. Focus on the UI

      • A Prepilogue

      • The Model-View-Controller Pattern

      • Test-Driving a Web Form

      • Mapping and Wrapping

      • Summary

      • Epilogue

  • Part V: Appendices

    • Appendix A. Other Domain Model Styles

      • Object-Oriented Data Model, Smart Service Layer, and Documents

      • The Database Model Is the Domain Model

      • Pragmatism and the Nontraditional Approach

      • Summary

    • Appendix B. Catalog of Discussed Patterns

      • Abstract Factory [GoF Design Patterns]

      • Aggregate [Evans DDD]

      • Bounded Context [Evans DDD]

      • Chain of Responsibility [GoF Design Patterns]

      • Class Table Inheritance [Fowler PoEAA]

      • Coarse-Grained Lock [Fowler PoEAA]

      • Collecting Parameter Pattern [Beck SBPP]

      • Concrete Table Inheritance [Fowler PoEAA]

      • Data Mapper [Fowler PoEAA]

      • Data Transfer Objects [Fowler PoEAA]

      • Decorator [GoF Design Patterns]

      • Dependency Injection

      • Domain Model [Fowler PoEAA]

      • Embedded Value [Fowler PoEAA]

      • Entity [Evans DDD]

      • Factory [Evans DDD]

      • Factory Method [GoF Design Patterns]

      • Foreign Key Mapping [Fowler PoEAA]

      • Generation Gap [Vlissides Pattern Hatching]

      • Identity Field [Fowler PoEAA]

      • Identity Map [Fowler PoEAA]

      • Implicit Lock [Fowler PoEAA]

      • Layer Supertype [Fowler PoEAA]

      • Layers [POSA]

      • Lazy Load [Fowler PoEAA]

      • Metadata Mapping [Fowler PoEAA]

      • Model View Controller [Fowler PoEAA]

      • Model View Presenter [Fowler PoEAA2]

      • Notification [Fowler PoEAA2]

      • Null Object [Woolf Null Object]

      • Optimistic Offline Lock [Fowler PoEAA]

      • Party Archetype [Arlow/Neustadt Archetype Patterns]

      • Pessimistic Offline Lock [Fowler PoEAA]

      • Pipes and Filters [POSA]

      • Presentation Model [Fowler PoEAA2]

      • Proxy [GoF Design Patterns]

      • Query Object [Fowler PoEAA]

      • Recordset [Fowler PoEAA]

      • Reflection [POSA]

      • Registry [Fowler PoEAA]

      • Remote Façade [Fowler PoEAA]

      • Repository [Evans DDD]

      • Separated Presentation [Fowler PoEAA2]

      • Service Layer [Fowler PoEAA]

      • Service Locator [Alur/Crupi/Malks Core J2EE Patterns]

      • Services [Evans DDD]

      • Single Table Inheritance [Fowler PoEAA]

      • Singleton [GoF Design Patterns]

      • Specification [Evans DDD]

      • State [GoF Design Patterns]

      • Table Module [Fowler PoEAA]

      • Template Method [GoF Design Patterns]

      • Transaction Script [Fowler PoEAA]

      • Unit of Work [Fowler PoEAA]

      • Value Object [Evans DDD]

  • References

  • Biblio

  • Index

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • H

    • I

    • J

    • K

    • L

    • M

    • N

    • O

    • P

    • Q

    • R

    • S

    • T

    • U

    • V

    • W

    • X

    • Y

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan