SlideShare une entreprise Scribd logo
1  sur  10
Télécharger pour lire hors ligne
Layered Expression Trees: una
terza via (idiomatica) verso il DDD
 Andrea Saltarello
 Software Architect @ Managed Designs
 andysal@gmail.com
 http://twitter.com/andysal74
 http://blogs.ugidotnet.org/pape

    http://creativecommons.org/licenses/by-nc-nd/2.5/   managed/designs
Agenda
 DDD recap
 Layered Expression Trees (LET idiom)




                                         managed/designs
Architettura di DDD




                      managed/designs
Architettura di DDD

 è una layered architecture
 i layer Presentation e Infrastructure compaiono
  «per sport» nel diagramma
 i layer Application e Domain costituiscono quella
  che tipicamente chiamiamo «business logic»
     Domain: logica invariante per i casi d’uso
     Application: logica specifica ai casi d’uso




                                                    managed/designs
Application Layer: in teoria

Application Layer: defines the jobs the software is
supposed to do and directs the expressive domain
objects to work out problems. The tasks this layer is
responsible for are meaningful to the business or
necessary for interaction with the application layers
of other systems. This layer is kept thin. It does not
contain business rules or knowledge, but only
coordinates tasks and delegates work to
collaborations of domain objects in the next layer
down. It does not have state reflecting the business
situation, but it can have state that reflects the
progress of a task for the user or the program.
                                                 managed/designs
Application Layer: in pratica

E’ un catalogo di servizi in grado di effettuare il mesh
della logica presente nel domain layer esponendola
alla applicazione (es: presentation layer) in una
forma ad… alta digeribilità




                                                  managed/designs
Real world DDD

Avere a disposizione un domain layer «smart» è
bello, ma costoso:
    Materializzazione degli oggetti
    Mesh della business logic


Tipicamente, si finisce per passare la vita a «fare
DTO»:
    Domain Layer <-> Application Layer
    Application Layer <-> Presentation Layer



                                                  managed/designs
Layered Expression Trees (LET idiom)


Facciamo un gioco: invece di definire un «botto» di DTO,
facciamo che layer e servizi si scambino degli
IQueryable<YourFavouriteDomainEntity>, facendo
«emergere» la query e specificando la proiezione solo
all’ultimo momento?

L’espressione «Capra e cavoli» vi dice niente? 




                                                     managed/designs
Demo
Layered Expression Trees
Books & Publications
[DDD] Domain Driven Design, Eric Evans , Addison-
   Wesley
[P of EAA] Pattern of Enterprise Application
   Architecture, Martin Fowler, Addison-Wesley
[NSK] NSK, http://nsk.codeplex.com




                                            managed/designs

Contenu connexe

Similaire à Layered Expression Trees: una terza via (idiomatica) verso il DDD

Enterprise Spring and Flex applications
Enterprise Spring and Flex applicationsEnterprise Spring and Flex applications
Enterprise Spring and Flex applicationsmarcocasario
 
Approccio Pratico al Domain Driven Design
Approccio Pratico al Domain Driven DesignApproccio Pratico al Domain Driven Design
Approccio Pratico al Domain Driven DesignLuca Milan
 
Never Mind the Bollocks: here's the Domain Driven Design
Never Mind the Bollocks: here's the Domain Driven DesignNever Mind the Bollocks: here's the Domain Driven Design
Never Mind the Bollocks: here's the Domain Driven DesignAndrea Saltarello
 
Panorama necto, la business intelligence collaborativa mr v02
Panorama necto, la business intelligence collaborativa mr v02Panorama necto, la business intelligence collaborativa mr v02
Panorama necto, la business intelligence collaborativa mr v02Mauro Ruffino
 
La rivoluzione 3.0: l'integrazione tra le social e le business practices
La rivoluzione 3.0: l'integrazione tra le social e le business practicesLa rivoluzione 3.0: l'integrazione tra le social e le business practices
La rivoluzione 3.0: l'integrazione tra le social e le business practicesSMAU
 
Tesi Marco Ventura
Tesi Marco VenturaTesi Marco Ventura
Tesi Marco Venturaguest335584
 
Loosely Coupled Complexity - Unleash the power of your domain model
Loosely Coupled Complexity - Unleash the power of your domain modelLoosely Coupled Complexity - Unleash the power of your domain model
Loosely Coupled Complexity - Unleash the power of your domain modelFrancesca1980
 
Introduzione ai Design Pattern
Introduzione ai Design PatternIntroduzione ai Design Pattern
Introduzione ai Design PatternRiccardo Cardin
 
Case study: un approccio modulare in un progetto legacy
Case study: un approccio modulare in un progetto legacyCase study: un approccio modulare in un progetto legacy
Case study: un approccio modulare in un progetto legacyMariano Fiorentino
 
Build a LINQ-enabled Repository
Build a LINQ-enabled RepositoryBuild a LINQ-enabled Repository
Build a LINQ-enabled RepositoryAndrea Saltarello
 
Design Patterns - Enterprise Patterns (part 2)
Design Patterns - Enterprise Patterns (part 2)Design Patterns - Enterprise Patterns (part 2)
Design Patterns - Enterprise Patterns (part 2)Fabio Armani
 
Uno sguardo a CQRS ed EventSourcing
Uno sguardo a CQRS ed EventSourcingUno sguardo a CQRS ed EventSourcing
Uno sguardo a CQRS ed EventSourcingAlessandro Melchiori
 
WPF & LINQ: VB T&T Community After Hour @ Microsoft Days 08
WPF & LINQ: VB T&T Community After Hour @ Microsoft Days 08WPF & LINQ: VB T&T Community After Hour @ Microsoft Days 08
WPF & LINQ: VB T&T Community After Hour @ Microsoft Days 08Alessandro Del Sole
 
Silverlight in Action
Silverlight in ActionSilverlight in Action
Silverlight in ActionDotNetMarche
 

Similaire à Layered Expression Trees: una terza via (idiomatica) verso il DDD (20)

Enterprise Spring and Flex applications
Enterprise Spring and Flex applicationsEnterprise Spring and Flex applications
Enterprise Spring and Flex applications
 
Approccio Pratico al Domain Driven Design
Approccio Pratico al Domain Driven DesignApproccio Pratico al Domain Driven Design
Approccio Pratico al Domain Driven Design
 
Never Mind the Bollocks: here's the Domain Driven Design
Never Mind the Bollocks: here's the Domain Driven DesignNever Mind the Bollocks: here's the Domain Driven Design
Never Mind the Bollocks: here's the Domain Driven Design
 
Panorama necto, la business intelligence collaborativa mr v02
Panorama necto, la business intelligence collaborativa mr v02Panorama necto, la business intelligence collaborativa mr v02
Panorama necto, la business intelligence collaborativa mr v02
 
La rivoluzione 3.0: l'integrazione tra le social e le business practices
La rivoluzione 3.0: l'integrazione tra le social e le business practicesLa rivoluzione 3.0: l'integrazione tra le social e le business practices
La rivoluzione 3.0: l'integrazione tra le social e le business practices
 
ORM - Introduzione
ORM - IntroduzioneORM - Introduzione
ORM - Introduzione
 
Slides marcosabatini
Slides marcosabatiniSlides marcosabatini
Slides marcosabatini
 
Diagrammi di Attività
Diagrammi di AttivitàDiagrammi di Attività
Diagrammi di Attività
 
Tesi Marco Ventura
Tesi Marco VenturaTesi Marco Ventura
Tesi Marco Ventura
 
Diagrammi delle Classi
Diagrammi delle ClassiDiagrammi delle Classi
Diagrammi delle Classi
 
Loosely Coupled Complexity - Unleash the power of your domain model
Loosely Coupled Complexity - Unleash the power of your domain modelLoosely Coupled Complexity - Unleash the power of your domain model
Loosely Coupled Complexity - Unleash the power of your domain model
 
Introduzione ai Design Pattern
Introduzione ai Design PatternIntroduzione ai Design Pattern
Introduzione ai Design Pattern
 
Cesvip 20110124
Cesvip 20110124Cesvip 20110124
Cesvip 20110124
 
Case study: un approccio modulare in un progetto legacy
Case study: un approccio modulare in un progetto legacyCase study: un approccio modulare in un progetto legacy
Case study: un approccio modulare in un progetto legacy
 
Build a LINQ-enabled Repository
Build a LINQ-enabled RepositoryBuild a LINQ-enabled Repository
Build a LINQ-enabled Repository
 
Design Patterns - Enterprise Patterns (part 2)
Design Patterns - Enterprise Patterns (part 2)Design Patterns - Enterprise Patterns (part 2)
Design Patterns - Enterprise Patterns (part 2)
 
Uno sguardo a CQRS ed EventSourcing
Uno sguardo a CQRS ed EventSourcingUno sguardo a CQRS ed EventSourcing
Uno sguardo a CQRS ed EventSourcing
 
WPF & LINQ: VB T&T Community After Hour @ Microsoft Days 08
WPF & LINQ: VB T&T Community After Hour @ Microsoft Days 08WPF & LINQ: VB T&T Community After Hour @ Microsoft Days 08
WPF & LINQ: VB T&T Community After Hour @ Microsoft Days 08
 
Silverlight in Action
Silverlight in ActionSilverlight in Action
Silverlight in Action
 
Ddive Xpage852
Ddive Xpage852Ddive Xpage852
Ddive Xpage852
 

Plus de Andrea Saltarello

Da Rotor a .NET Core ed indietro: Microsoft &lt;3 Open Source
Da Rotor a .NET Core ed indietro: Microsoft &lt;3 Open SourceDa Rotor a .NET Core ed indietro: Microsoft &lt;3 Open Source
Da Rotor a .NET Core ed indietro: Microsoft &lt;3 Open SourceAndrea Saltarello
 
The Fine Art of Time Travelling: implementing Event Sourcing
The Fine Art of Time Travelling: implementing Event SourcingThe Fine Art of Time Travelling: implementing Event Sourcing
The Fine Art of Time Travelling: implementing Event SourcingAndrea Saltarello
 
Implementing Event Sourcing in .NET
Implementing Event Sourcing in .NETImplementing Event Sourcing in .NET
Implementing Event Sourcing in .NETAndrea Saltarello
 
Idiomatic Domain Driven Design: implementing CQRS
Idiomatic Domain Driven Design: implementing CQRSIdiomatic Domain Driven Design: implementing CQRS
Idiomatic Domain Driven Design: implementing CQRSAndrea Saltarello
 
Architecting an ASP.NET MVC Solution
Architecting an ASP.NET MVC SolutionArchitecting an ASP.NET MVC Solution
Architecting an ASP.NET MVC SolutionAndrea Saltarello
 
Code Contracts and Generics: implementing a LINQ-enabled Repository
Code Contracts and Generics: implementing a LINQ-enabled RepositoryCode Contracts and Generics: implementing a LINQ-enabled Repository
Code Contracts and Generics: implementing a LINQ-enabled RepositoryAndrea Saltarello
 
From relational data to object spaces
From relational data to object spacesFrom relational data to object spaces
From relational data to object spacesAndrea Saltarello
 

Plus de Andrea Saltarello (10)

Da Rotor a .NET Core ed indietro: Microsoft &lt;3 Open Source
Da Rotor a .NET Core ed indietro: Microsoft &lt;3 Open SourceDa Rotor a .NET Core ed indietro: Microsoft &lt;3 Open Source
Da Rotor a .NET Core ed indietro: Microsoft &lt;3 Open Source
 
The Fine Art of Time Travelling: implementing Event Sourcing
The Fine Art of Time Travelling: implementing Event SourcingThe Fine Art of Time Travelling: implementing Event Sourcing
The Fine Art of Time Travelling: implementing Event Sourcing
 
ASP.NET Core essentials
ASP.NET Core essentialsASP.NET Core essentials
ASP.NET Core essentials
 
Implementing Event Sourcing in .NET
Implementing Event Sourcing in .NETImplementing Event Sourcing in .NET
Implementing Event Sourcing in .NET
 
Idiomatic Domain Driven Design: implementing CQRS
Idiomatic Domain Driven Design: implementing CQRSIdiomatic Domain Driven Design: implementing CQRS
Idiomatic Domain Driven Design: implementing CQRS
 
Architecting an ASP.NET MVC Solution
Architecting an ASP.NET MVC SolutionArchitecting an ASP.NET MVC Solution
Architecting an ASP.NET MVC Solution
 
ASP.NET MVC: Full Throttle
ASP.NET MVC: Full ThrottleASP.NET MVC: Full Throttle
ASP.NET MVC: Full Throttle
 
Code Contracts and Generics: implementing a LINQ-enabled Repository
Code Contracts and Generics: implementing a LINQ-enabled RepositoryCode Contracts and Generics: implementing a LINQ-enabled Repository
Code Contracts and Generics: implementing a LINQ-enabled Repository
 
From relational data to object spaces
From relational data to object spacesFrom relational data to object spaces
From relational data to object spaces
 
MVC2: non solo tecnologia
MVC2: non solo tecnologiaMVC2: non solo tecnologia
MVC2: non solo tecnologia
 

Layered Expression Trees: una terza via (idiomatica) verso il DDD

  • 1. Layered Expression Trees: una terza via (idiomatica) verso il DDD Andrea Saltarello Software Architect @ Managed Designs andysal@gmail.com http://twitter.com/andysal74 http://blogs.ugidotnet.org/pape http://creativecommons.org/licenses/by-nc-nd/2.5/ managed/designs
  • 2. Agenda  DDD recap  Layered Expression Trees (LET idiom) managed/designs
  • 3. Architettura di DDD managed/designs
  • 4. Architettura di DDD  è una layered architecture  i layer Presentation e Infrastructure compaiono «per sport» nel diagramma  i layer Application e Domain costituiscono quella che tipicamente chiamiamo «business logic»  Domain: logica invariante per i casi d’uso  Application: logica specifica ai casi d’uso managed/designs
  • 5. Application Layer: in teoria Application Layer: defines the jobs the software is supposed to do and directs the expressive domain objects to work out problems. The tasks this layer is responsible for are meaningful to the business or necessary for interaction with the application layers of other systems. This layer is kept thin. It does not contain business rules or knowledge, but only coordinates tasks and delegates work to collaborations of domain objects in the next layer down. It does not have state reflecting the business situation, but it can have state that reflects the progress of a task for the user or the program. managed/designs
  • 6. Application Layer: in pratica E’ un catalogo di servizi in grado di effettuare il mesh della logica presente nel domain layer esponendola alla applicazione (es: presentation layer) in una forma ad… alta digeribilità managed/designs
  • 7. Real world DDD Avere a disposizione un domain layer «smart» è bello, ma costoso:  Materializzazione degli oggetti  Mesh della business logic Tipicamente, si finisce per passare la vita a «fare DTO»:  Domain Layer <-> Application Layer  Application Layer <-> Presentation Layer managed/designs
  • 8. Layered Expression Trees (LET idiom) Facciamo un gioco: invece di definire un «botto» di DTO, facciamo che layer e servizi si scambino degli IQueryable<YourFavouriteDomainEntity>, facendo «emergere» la query e specificando la proiezione solo all’ultimo momento? L’espressione «Capra e cavoli» vi dice niente?  managed/designs
  • 10. Books & Publications [DDD] Domain Driven Design, Eric Evans , Addison- Wesley [P of EAA] Pattern of Enterprise Application Architecture, Martin Fowler, Addison-Wesley [NSK] NSK, http://nsk.codeplex.com managed/designs

Notes de l'éditeur

  1. Abbiamo il nostro splendido Domain Model, e possiamo passare la vita a definire DTO per usarlo in modo “sostenibile”. Oppure possiamo metterlo (un po’) in disparte ed adottare CQRS, ammesso che non ci venga mai da dire: “che spreco”. Oppure possiamo optare per una terza via idiomatica: LayeredExpressionTrees. Parliamone.