Domain-Driven Design Tim McCarthy Principal Engineer, InterKnowlogy

Slides:



Advertisements
Similar presentations
Developing Event Driven State Machine Workflows S1 S2 S3 S4 Adam Calderon Principal Engineer - Interknowlogy Microsoft MVP – C#
Advertisements

SharePoint Forms All you ever wanted to know about forms but were afraid to ask.
Designing, Deploying and Managing Workflow in SharePoint Sites Steve Heaney Product Development Manager OBS
1 Layers Data from IBM-Rational and Craig Larman’s text integrated into these slides. These are great references… Slides from these sources have been modified.
Craig Berntson
Enterprise Smart Clients Architecture, Patterns, Design, Best Practices Keith Elder Manager, Sr. Software Engineer Quicken Loans Blog:
Building Enterprise Applications Using Visual Studio ®.NET Enterprise Architect.
Ganesh Subramanian 22/12/2010
Satzinger, Jackson, and Burd Object-Orieneted Analysis & Design
Database Design Concepts Info 1408 Lecture 2 An Introduction to Data Storage.
Database Design Concepts Info 1408 Lecture 2 An Introduction to Data Storage.
Using Microsoft SharePoint to Develop Workflow and Business Process Automation Ted Perrotte National Practice Manager, Quilogy, Microsoft Office SharePoint.
By Bob Bunson  Simulation of software development project  Fictitious system from Concept to Code  Oriented around the.
UNIT-V The MVC architecture and Struts Framework.
IBM Proof of Technology Discovering the Value of SOA with WebSphere Process Integration © 2005 IBM Corporation SOA on your terms and our expertise WebSphere.
1 Developing Rules Driven Workflows in Windows Workflow Foundation Jurgen Willis COM318 Program Manager Microsoft Corporation.
Creating Business Workflow Using SharePoint Designer 2007 Presented by Tarek Ghazali IT Technical Specialist Microsoft SQL Server MVP Microsoft SQL Server.
DYNAMICS CRM AS AN xRM DEVELOPMENT PLATFORM Jim Novak Solution Architect Celedon Partners, LLC
Presenter - Donn Felker.  Senior Consultant for Microsoft Gold Certified Partner- Statêra.  8 years of experience in developing and architecting enterprise.
Doing Something Useful with Enterprise Library 3.0 Benjamin Day Level: Intermediate.
Domain-Driven Design using the ADO.NET Entity Framework Tim McCarthy Principal Engineer, InterKnowlogy
SednaSpace A software development platform for all delivers SOA and BPM.
What is Architecture  Architecture is a subjective thing, a shared understanding of a system’s design by the expert developers on a project  In the.
1 Keith Vicens, Managing Consultant CRM Housing Solution Extending Your Case Management Capabilities.
Creating Page Layouts using SharePoint Designer or Visual Studio Becky Bertram MVP SharePoint Server, MCSD, MCAD
Todd Snyder Development Team Lead Infragistics Experience Design Group.
ITEC224 Database Programming
Todd Kitta  Covenant Technology Partners  Professional Windows Workflow Foundation.
Building an Offline Smart Client using Domain-Driven Design Principles Tim McCarthy.
RECALL THE MAIN COMPONENTS OF KIM Functional User Interfaces We just looked at these Reference Implementation We will talk about these later Service Interface.
ICINETIC Experts in.NET technologies and architectures.
4/2/03I-1 © 2001 T. Horton CS 494 Object-Oriented Analysis & Design Software Architecture and Design Readings: Ambler, Chap. 7 (Sections to start.
DEV325 Deploying Visual Studio.NET Applications Billy Hollis Author / Consultant.
Composite User Interface Application Block Peter Provost Development Lead – patterns & practices
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 4, Requirements Elicitation.
DEV 303 Visual Studio "Whidbey" Enterprise Tools: Source Control and Work Item Tracking Brian Harry Product Unit Manager Microsoft Visual Studio.
Methodology - Conceptual Database Design. 2 Design Methodology u Structured approach that uses procedures, techniques, tools, and documentation aids to.
Methodology - Conceptual Database Design
10 – 12 APRIL 2005 Riyadh, Saudi Arabia. Visual Studio 2005 : New Features for the Web Services Developer Malek Kemmou CEO Arrabeta Consulting Microsoft.
Domain and Persistence Patterns. Fundamental Pattern Types Design Patterns Business Logic Patterns.
Applying Domain-Driven Design Jimmy Nilsson Webcast with UML China
Object Oriented Software Development
ICINETIC Experts in.NET technologies and architectures.
Design Model Lecture p6 T120B pavasario sem.
Slide 1. Agenda  Introduction to Windows Workflow What is it? What are activities? Hosting  Out of the box Activities  Custom Activities and Dependency.
ARCH-5: Service Interfaces in Practice Christian Stiller Technical Architect.
Component Patterns – Architecture and Applications with EJB copyright © 2001, MATHEMA AG Component Patterns Architecture and Applications with EJB Markus.
Introduction to EJB. What is an EJB ?  An enterprise java bean is a server-side component that encapsulates the business logic of an application. By.
EMEA Beat Schwegler Architect Microsoft EMEA HQ Ingo Rammer Principal Consultant thinktecture
CS223: Software Engineering Lecture 13: Software Architecture.
Biztalk in the field CODit Collaborative integration Platform Ahlers Danny Buysse, Product Manager and Lead architect CODit.
Aggregate In DDD. What makes an ENTITY AGGREGATE root Has global identity. Expected to be directly accessed in typical business scenarios. If it has other.
DOMAIN DRIVEN DESIGN Dave 12 May WHAT IS DDD? Set of principles to aid in building complex systems Enables us to focus on core problem domain NOT.
Domain Driven Design Day 2. DDD | Supple Design Inviting to change Reveals a deep model But … has no formula “… when complexity is holding back progress,
Enterprise Library 3.0 Memi Lavi Solution Architect Microsoft Consulting Services Guy Burstein Senior Consultant Advantech – Microsoft Division.
Introduction ITEC 420.
Building Enterprise Applications Using Visual Studio®
Microsoft Certification Paths
Overview of MDM Site Hub
Beyond the BDC\BCS Model
Chris Menegay Sr. Consultant TECHSYS Business Solutions
SSAS Security Model with Maintenance Plan
Distribution and components
Module 1: Getting Started
Visual Studio 2005 “Personalized productivity”
ApplinX Rod Carlson Senior Technical Lead.
WEB SERVICES DAVIDE ZERBINO.
Microsoft Certification Paths
DAT381 Team Development with SQL Server 2005
Introduction to ASP.NET Parts 1 & 2
Presentation transcript:

Domain-Driven Design Tim McCarthy Principal Engineer, InterKnowlogy MGB 2003 Domain-Driven Design Tim McCarthy Principal Engineer, InterKnowlogy timm@interknowlogy.com © 2003 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

About… InterKnowlogy (www.InterKnowlogy.com) MGB 2003 About… InterKnowlogy (www.InterKnowlogy.com) Tim McCarthy, Principal Engineer Custom App Dev / Consulting / Software Engineering Firm headquartered in Carlsbad, CA Microsoft Gold Partner managed in SoCal and Redmond Design, Architect, Build and Deploy enterprise class applications Industry Experts: 90% of the company is published Microsoft® .NET Application development for 5+ years! Microsoft® .NET Smart Client pioneers / industry leaders Information Worker Solutions Integration / Messaging, B2B / B2C, Wireless / Mobility Microsoft® SharePoint, Microsoft® BizTalk® Web Services, Microsoft® Active Directory®, Security, SSO, Authorization, Authentication Solutions on the emerging Microsoft servers Largest Client: Microsoft © 2003 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

Agenda Organizing Domain Logic What is DDD? Why Domain-Driven Design (DDD)? DDD Definitions/Patterns When is DDD appropriate?

Organizing Domain Logic MGB 2003 Organizing Domain Logic Transaction Script Domain Model Table Module One of the most important, yet often forgot, aspects of enterprise applications is the domain logic. These are the business rules, validations, and calculations that operate on the data as it is brought into an information system or displayed by it. For simple database filing systems there is often little or no domain logic. However for many systems there is often quite complex domain logic, and this logic is subject to regular change as business conditions change. Transaction Script – a procedure that takes the input from the UI, processes it (validations, calculations, etc.), stores data in a data store (usually a database), and invokes operations from other systems. Most business applications can be thought of as a series of transactions. A transaction may view some information as organized in a particular way, another will make changes to it. Each interaction between a client system and a server system contains a certain amount of logic. In some cases this can be as simple as displaying information in the database. In others it may involve many steps of validations and calculations. A Transaction Script organizes all this logic primarily as a single procedure, making calls directly to the database or through a thin database wrapper. Each transaction will have its own Transaction Script, although common subtasks can be broken into sub-procedures. Domain Model – instead of having a routine that has all of the logic for a user action, each object takes a part of the logic that’s relevant to it. Incorporates behavior and data. At its worst business logic can be very complex. Rules and logic describe many different cases and slants of behavior, and it's this complexity that objects were designed to work with. A Domain Model creates a web of interconnected objects, where each object represents some meaningful entity, whether as large as a corporation or as small as a single line on an order form. The advantage of the domain model is that the logic needed for any particular operation is loosely coupled across the objects rather than being contained in a single method. This pattern tends to view the application as a set of interrelated objects. Table Module - A single instance that handles the business logic for all rows in a database table or view. A Table Module organizes domain logic with one class per table in the data-base, and a single instance of a class contains the various procedures that will act on the data. The primary distinction with Domain Model (116) is that, if you have many orders, a Domain Model (116) will have one order object per order while a Table Module will have one object to handle all orders. © 2003 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

Choosing the Right Approach MGB 2003 Choosing the Right Approach Building an object-oriented Domain Model is a popular approach to organizing domain logic. It works particularly well with complex domains. It's downside is that it is difficult to do well. These patterns describe how to think about building and structuring a rich domain model, as well as how to recognize and overcome the real-world obstacles that too-often prevent people from employing the modeling principles they know © 2003 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

Demo: Organizing Domain Logic

MGB 2003 What is DDD? Good-ole object-oriented design, but with some design rules © 2003 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

Why Domain-Driven Design (DDD)? MGB 2003 Why Domain-Driven Design (DDD)? Most development time is still spent writing plumbing code instead of business logic Typically, the UI will change a LOT more than the business logic The model is a great tool for communication between developers and users .NET has good support for it! © 2003 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

Ubiquitous Language Common terms between business experts and development team Use the language in your code Namespaces Class, property, method, variable names

Communicating the Language Create whiteboard drawings Favor whiteboarding over Visio Use digital camera to capture, then paste into Word Use Visual Studio class diagrams for core parts of the domain Code and diagram are kept in sync No wasted time diagramming, your diagram is the code

Definition: Entities An object defined primarily by its identity Not its attributes Could be a person, a customer, an order, etc. Not all objects have meaningful identities… In some systems, a class may be an ENTITY, in others maybe not

Definition: Value Objects Represent an aspect of the domain with NO conceptual identity Use when you care about what something is, not who they are Same thing as a DTO [Fowler PoEAA] Simple, immutable objects

Definition: Aggregates A cluster of associated objects treated as a unit for the purpose of data changes They have a root and a boundary Boundary = what is inside the AGGREGATE Root = single ENTITY inside the AGGREGATE Most important concept to understand in modelling!

Aggregate Rules The root ENTITY has global identity ENTITIES inside the boundary have local identity Nothing outside the AGGREGATE boundary can hold a reference to anything inside, except to the root ENTITY Objects in the AGGREGATE can hold references to other AGGREGATE roots …a few more

Definition: Services An operation offered as an interface that stands alone in the model Does not fit into any of the objects in the model Stateless To be used judiciously (do not turn your app into a Transaction Script) Use when an operation is an important domain concept

Pattern: Repository Provide access to AGGREGATE roots Represents all objects of a certain type as a conceptual set (usually emulated) Behaves like a collection, e.g. Add(), Remove() Persistence Ignorance!

Pattern: Layered Supertype [Fowler 475] Type that acts as the supertype for all types in its layer, i.e. a base class! Factors out common features, such as handling the identity of ENTITIES Example: a common ID property Helps eliminate duplicate code

Demo: Creating a DDD Framework

Pattern: Specifications - Problem You need to select a subset of objects based on some criteria, and to refresh the selection at various times You need to check that only suitable objects are used for a certain role You need to describe what an object might do, without explaining the details of how the object does it, but in such a way that a candidate might be built to fulfill the requirement

Pattern: Specifications - Definition A predicate that determines if an object meets certain criteria Explicitly separates the statement of how to match a candidate from the candidate object that it is matched against States a constraint on the state of another object, which may or may not be present Keeps the rules in the domain layer! The rules themselves become objects

Pattern: Specifications - Solution Create a specification that is able to tell if a candidate object matches some criteria. The specification has a method isSatisfiedBy (candidate) : Boolean that returns "true" if all criteria are met by the candidate.

Pattern: Specifications - Implementation Types Hard-coded Code the selection criteria into the isSatisfied method as a block of code Parameterized Create attributes in the specification for values that commonly vary. Code the isSatisfiedBy method to combine these parameters to make the test Composite Create a particular form of interpreter for the specification. Create leaf elements for the various kinds of tests. Create composite nodes for the and, or, and not operators

Uses of Specifications Validating an object against a constraint Select objects from a collection Specify the creation of a new object to fit some need Building to order – you define the specs, the builders build to your spec!

Demo: Using Specifications

This is DDD…

When is DDD Appropriate “If an unsophisticated team with a simple project decides to try a model-driven design with layered architecture, it will face a difficult learning curve. ... The overhead of managing infrastructure and layers makes very simple tasks take longer. Simple projects come with short time lines and modest expectations.” Domain-Driven Design by Eric Evans, p76

Resources [Evans]: Domain-Driven Design: Tackling Complexity in the Heart of Software, Evans, Addison-Wesley (2003) [Fowler]: Patterns of Enterprise Application Architecture, Fowler, Addison-Wesley (2003) [Nilsson]: Applying Domain Driven Design and Patterns: using .NET

Looking for Outstanding Developers Application Development Practice .NET 2.0 and .NET 3.0 ASP.NET 2.0 and ASP.NET AJAX 1.0 WinForms 2.0 / Windows Presentation Foundation ASMX / Windows Communication Foundation BizTalk Windows Workflow Foundation SQL Server

Looking for Outstanding Developers Information Worker Practice SharePoint 2003 / 2007 Office 2003 / 2007 SQL Analysis Services SQL Reporting Services

Tim McCarthy, InterKnowlogy MGB 2003 Tim McCarthy, InterKnowlogy Get the Demos & PPT at: Blogs.InterKnowlogy.com/TimMcCarthy More info on InterKnowlogy: www.InterKnowlogy.com Contact me: Tim McCarthy E-mail: TimM@InterKnowlogy.com Phone: 760-930-0075 x205 About Tim McCarthy .NET Architect/Dev Lead/Trainer Author / Speaker MCSD, MCSD.NET, MCDBA, MCT, IEEE CSDP © 2003 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.