building an offline smart client using domain driven design principles n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Building an Offline Smart Client using Domain-Driven Design Principles PowerPoint Presentation
Download Presentation
Building an Offline Smart Client using Domain-Driven Design Principles

Loading in 2 Seconds...

play fullscreen
1 / 37

Building an Offline Smart Client using Domain-Driven Design Principles - PowerPoint PPT Presentation


  • 73 Views
  • Uploaded on

Building an Offline Smart Client using Domain-Driven Design Principles. Tim McCarthy. Agenda. DDD Definitions/Patterns The SmartCA Application Designing the Layered Architecture WPF and the Model-View-ViewModel Pattern Synchronizing the Data. Agenda. DDD Definitions/Patterns

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Building an Offline Smart Client using Domain-Driven Design Principles' - gomer


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
agenda
Agenda
  • DDD Definitions/Patterns
  • The SmartCA Application
  • Designing the Layered Architecture
  • WPF and the Model-View-ViewModel Pattern
  • Synchronizing the Data
agenda1
Agenda
  • DDD Definitions/Patterns
  • The SmartCA Application
  • Designing the Layered Architecture
  • WPF and the Model-View-ViewModel Pattern
  • Synchronizing the Data
why domain driven design ddd
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!

ubiquitous language
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
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
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
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
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
  • Hardest but most important concept to understand in DDD!
aggregate rules
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
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 layered supertype fowler 475
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
pattern repository
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(), FindBy(id), etc.

Persistence Ignorance!

agenda2
Agenda
  • DDD Definitions/Patterns
  • The SmartCA Application
  • Designing the Layered Architecture
  • WPF and the Model-View-ViewModel Pattern
  • Synchronizing the Data
the smartca application
The SmartCA Application
  • Problem – Legacy MS Access Application
    • a.k.a. Smart Client Anti-Pattern
  • New System Requirements
  • Technologies
  • Layered Architecture
new system requirements
New System Requirements

Reliability and Availability

Scalability

Maintainability

Rich client application functionality

Offline Capable

Intelligent installation and auto-update functionality

Additional client device support

the new solution smartca application
The New Solution – SmartCA Application
  • DDD with Layered Architecture
  • UI = WPF Smart Client
  • Data Store
    • Server – behind web services cloud
    • Client – SQL Server Compact Edition 3.5
agenda3
Agenda
  • DDD Definitions/Patterns
  • The SmartCA Application
  • Designing the Layered Architecture
  • WPF and the Model-View-ViewModel Pattern
  • Synchronizing the Data
the layered architecture
The Layered Architecture
  • Application Layer
  • Domain Layer
    • Repository Strategy
    • Layered Supertype Pattern
  • Infrastructure Layer
  • Presentation Layer
demonstration 1
Demonstration #1

Layers represented in the SmartCA Visual Studio Solution

repository framework
Repository Framework

Interfaces

Repository Factory

Unit of Work

Repository Base Classes

demonstration 2
Demonstration #2

Repository Framework Implementation

mapping entity factory framework
Mapping - Entity Factory Framework

Interfaces

Entity Factory Builder

demonstration 3
Demonstration #3

Entity Factory Framework Implementation

agenda4
Agenda
  • DDD Definitions/Patterns
  • The SmartCA Application
  • Designing the Layered Architecture
  • WPF and the Model-View-ViewModel Pattern
  • Synchronizing the Data
windows presentation foundation wpf
Windows Presentation Foundation (WPF)

Declarative Programming (Using XAML)

Built-in Command Pattern

Strong Data Binding Support

model view viewmodel pattern
Model-View-ViewModel Pattern
  • Traditional Presentation Patterns
    • MVP
    • MVC
    • More…
  • Model-View-ViewModel Definition
  • What’s a ViewModel?
demonstration 4
Demonstration #4

Model-View-ViewModel

agenda5
Agenda
  • DDD Definitions/Patterns
  • The SmartCA Application
  • Designing the Layered Architecture
  • WPF and the Model-View-ViewModel Pattern
  • Synchronizing the Data
synchronizing the data some choices
Synchronizing the Data – Some Choices
  • SQL Replication
  • ADO.NET Synchronization Services
  • Message-Based
    • Taking advantage of Unit of Work
    • Can talk to any message-based server
demonstration 5
Demonstration #5

Data Synchronization

resources
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, Addison Wesley 2006

tim mccarthy interknowlogy
Tim McCarthy, InterKnowlogy
  • Get the Demos & PPT at:
    • Slides: http://www.umlchina.com
    • Code: codeplex.com/dddpds
    • .NET Domain-Driven Design with C#: Problem-Design-Solution
  • Contact me: Tim McCarthy
    • E-mail: tmccart1@san.rr.com
  • About Tim McCarthy
    • .NET Architect/Dev Lead/Trainer
    • Author / Speaker
    • MCSD, MCSD.NET, MCDBA, MCT,
    • IEEE CSDP