SlideShare una empresa de Scribd logo
1 de 17
Descargar para leer sin conexión
Luca Milan
http://fewbit.com
 info@fewbit.com
“ 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
  individual, whether as large as a corporation or as small as
  a single line on an order form”

Io leggo: usiamo tecniche OO per tradurre la complessità del
  dominio applicativo in un modello ad oggetti utile allo
  scopo (nessun virtuosismo concettuale dobbiamo essere
  pragmatici).
   Una disciplina che aiuta lo sviluppatore ad consolidare
    le logiche di business (complesse e in evoluzione) di
    un dominio applicativo in un Modello ad Oggetti grazie
    al paradigma OO .
   Un insieme di regole e principi che pone il Modello ad
    Oggetti come centro del processo di sviluppo.
   Uno stile architetturale che realizza un
    disaccoppiamento tra il Modello ad Oggetti e gli altri
    strati software rendendolo totalmente autonomo e
    indipendente.
   Possiamo farlo quando:
    ◦ Il processo di sviluppo è iterativo. Miglioreremo la conoscenza del
      dominio passo dopo passo grazie all’aiuto degli esperti del dominio.
    ◦ Le logiche di business del domino sono complesse ed evolvono
      continuamente nel tempo.
    ◦ Conosciamo bene la programmazione OO ed abbiamo familiarità
      con concetti come Refactoring, IOC, Persistence Ignorance (PI),
      principi SOLID, ecc..
   Non conviene usare la DDD quando:
    ◦ I progetti sono semplici (un blog, un piccolo e-commerce) e non
      subiscono evoluzioni nel tempo.
    ◦ Applicazioni di pura reportistica o ETL o simili
   Domain Model
    ◦ “An object model of the domain that incorporates both
      behavior and data” da Fowler
Una classe .NET incarna un
                                public class Ordine{
       object model                public string Cliente{get;set;}
                                   public void MarcaComeCompleto(){
    ◦ Attenzione:                     Stato = StatoOrdine.Completo;
                                   }
      Classe != Oggetto            public IList<Linee> {get;set;}
                                }


Una volta creati gli oggetti possiamo collegarli tramite gerarchie
 e relazioni ed assegnarli ruoli e responsabilità. Ciò significa
 formare la rete interconnessa (grafo) del pattern di Fowler.
   Bounded Context (or Context)
    ◦ “The delimited applicability of a particular model.
      BOUNDING CONTEXTS gives team members a clear and
      shared understanding of what has to be consistent and
      what can develop independently” da domaindrivendesign.org

    Rappresentano i confini (variabili) del dominio e devono
     essere ben marcati. Al di fuori di essi dobbiamo lasciare
     tutta la complessità non utile ai nostri scopi (funzionali ed
     applicativi). Non perdiamo la direzione!!!
   Parte di Catalogo di un domain model per un sistema di e-commerce
   Spesso i domain model non seguono le regole indicate
    da Fowler ed Evans, in questo caso Fowler identifica un
    anti-pattern: l’Anemic Domain Model
   I sintomi di un dominio anemico sono a livello di
    classe:
    1. Ad una 1 classe corrisponde una 1 tabella
    2. Non ci sono metodi solo getters e setters
    3. La logica anziché sui metodi viene incapsulata nei setters

    In questi casi dobbiamo rivitalizzare il dominio.
   Ubiquitous Language           Unit Of Work
   Entity                        Inversion Of Control
   Value Object                  Object Relational Mapping
                                  Aspected Oriented
   Repository
                                   Programming
   Service
                                  Contract By Design
   Aggregates                    TDD, BDD
   Factories                     OO tecniques, SOLID
   Specification / Queries        principles
   Context (Boundary / Map)      Refactoring

Attori della DDD               Patterns e tecniche collegate
   Sviluppatori ed esperti del dominio devono collaborare tra
    loro. Per farlo al meglio devono trovare un linguaggio
    comune semplice ed intuitivo con cui poter dialogare (no
    termini tecnici, no termini di business) .
                          Paginare,
                         Schedulare,
                         Indicizzare,
                        Disaccoppiare




                            CGA, Mandato ad
                             Assicurare, ecc..
   Dal libro di Eric Evans:

    1. "An Entity is an Object that represents something with
       continuity and identity. An entity is tracked through
       different states and implementations.“

    2. "An object that represents a descriptive aspect of the
       domain with no conceptual identity“
   Dal libro di Eric Evans

    “First we need an abstraction for encapsulating references
    within the [domain] model. An Aggregate is a cluster of
    associated [domain] objects that we treat as a unit for the
    purpose of [ensuring consistency of] data changes. Each
    Aggregate has a root and a boundary. The root is a single,
    specific Entity contained in the Aggregate”
   E’ uno dei concetti più dibattuti Fowler dice:
    “A Repository mediates between the domain and data mapping layers, acting
    like an in-memory domain object collection. Client objects construct query
    specifications declaratively and submit them to Repository for satisfaction.
    Objects can be added to and removed from the Repository, as they can from a
    simple collection of objects, and the mapping code encapsulated by the
    Repository will carry out the appropriate operations behind the scenes.
    Conceptually, a Repository encapsulates the set of objects persisted in a data
    store and the operations performed over them, providing a more object-
    oriented view of the persistence layer. Repository also supports the objective of
    achieving a clean separation and one-way dependency between the domain
    and data mapping layers”

Parla il linguaggio del domain model (no DTO no DAO) ed è agnostico rispetto ai
  meccanismi di persistenza utilizzati dall’applicazione. Rafforza il concetto di
  uguaglianza per Identità (non by reference), il repository restituisce la stessa
  istanza di oggetto se l’oggetto ha la stessa identità.
   Dal libro di Eric Evans

    “A SERVICE is an operation offered as an interface that stands
    alone in the model, without encapsulating state,
    as ENTITIES and VALUE OBJECTS do.“

Un servizio si occupa di coordinare azioni che coinvolgono uno o più oggetti
  del dominio (entity,value objects,repository). Es. La modifica di un ordine
  non può essere delegata ad un singolo comportamento dell’entità Ordine,
  meglio creare un servizio IOrderModify.Execute(params).
   Possiamo usare l’approccio DDD anche con altri tipi di
    architetture di classe enterprise:
    ◦ Con SOA vedi http://www.udidahan.com/
    ◦ In scenari distribuiti come Distributed DDD vedi
      http://codebetter.com/blogs/gregyoung/
    ◦ Con REST vedi
      http://blogs.msdn.com/jmeier/archive/2009/01/21/applicatio
      n-patterns.aspx
   http://www.infoq.com/presentations/model-to-work-
    evans
   http://domaindrivendesign.org/books
   http://www.infoq.com/interviews/jimmy-nilsson-
    domain-driven-design
   http://domaindrivendesign.org/
   http://download.microsoft.com/download/6/3/D/63D
    A97EC-6B79-42C1-9DAF-D8D00D8C7759/guisa.pdf
Approccio Pratico al Domain Driven Design

Más contenido relacionado

La actualidad más candente

ママ、どうして仮想化が必要なの?
ママ、どうして仮想化が必要なの?ママ、どうして仮想化が必要なの?
ママ、どうして仮想化が必要なの?junichi anno
 
Azure AD の SaaS アプリケーション認証への活用
Azure AD の SaaS アプリケーション認証への活用Azure AD の SaaS アプリケーション認証への活用
Azure AD の SaaS アプリケーション認証への活用Yusuke Kodama
 
Domain driven design
Domain driven designDomain driven design
Domain driven designtatyaso
 
Service Oriented Architecture (SOA)
Service Oriented Architecture (SOA)Service Oriented Architecture (SOA)
Service Oriented Architecture (SOA)Mazhar Ishaq Khokhar
 
Securing enterprise-grade serverless applications - SDD401 - AWS re:Inforce 2...
Securing enterprise-grade serverless applications - SDD401 - AWS re:Inforce 2...Securing enterprise-grade serverless applications - SDD401 - AWS re:Inforce 2...
Securing enterprise-grade serverless applications - SDD401 - AWS re:Inforce 2...Amazon Web Services
 
Azure ad の導入を検討している方へ ~ active directory の構成パターンと正しい認証方式の選択~
Azure ad の導入を検討している方へ ~ active directory の構成パターンと正しい認証方式の選択~Azure ad の導入を検討している方へ ~ active directory の構成パターンと正しい認証方式の選択~
Azure ad の導入を検討している方へ ~ active directory の構成パターンと正しい認証方式の選択~junichi anno
 
今さら聞けない!Active Directoryドメインサービス入門
今さら聞けない!Active Directoryドメインサービス入門今さら聞けない!Active Directoryドメインサービス入門
今さら聞けない!Active Directoryドメインサービス入門Trainocate Japan, Ltd.
 
01.표준프레임워크개요
01.표준프레임워크개요01.표준프레임워크개요
01.표준프레임워크개요Hankyo
 
脱 Excel設計書
脱 Excel設計書脱 Excel設計書
脱 Excel設計書rai
 
Microservices in Practice
Microservices in PracticeMicroservices in Practice
Microservices in PracticeKasun Indrasiri
 
S05 Microsoft Azure 仮想マシンでの Active Directory 活用シナリオ
S05 Microsoft Azure 仮想マシンでの Active Directory 活用シナリオS05 Microsoft Azure 仮想マシンでの Active Directory 活用シナリオ
S05 Microsoft Azure 仮想マシンでの Active Directory 活用シナリオMicrosoft Azure Japan
 
今さら聞けない! Windows Server 2016 Active Directoryドメインサービス入門
今さら聞けない! Windows Server 2016 Active Directoryドメインサービス入門今さら聞けない! Windows Server 2016 Active Directoryドメインサービス入門
今さら聞けない! Windows Server 2016 Active Directoryドメインサービス入門Tetsuya Yokoyama
 
ゼロ・トラストネットワークを実現する、 マイクロソフトの新しいSecurityサービスの全貌 〜 SIEM、SOCの構築をサポートするMicrosoft ...
ゼロ・トラストネットワークを実現する、 マイクロソフトの新しいSecurityサービスの全貌 〜 SIEM、SOCの構築をサポートするMicrosoft ...ゼロ・トラストネットワークを実現する、 マイクロソフトの新しいSecurityサービスの全貌 〜 SIEM、SOCの構築をサポートするMicrosoft ...
ゼロ・トラストネットワークを実現する、 マイクロソフトの新しいSecurityサービスの全貌 〜 SIEM、SOCの構築をサポートするMicrosoft ...ID-Based Security イニシアティブ
 
Microsoft Project Online 活用ガイド
Microsoft Project Online 活用ガイドMicrosoft Project Online 活用ガイド
Microsoft Project Online 活用ガイドkumo2010
 
Office365 および Azure AD 管理者が必ずやっておくべきセキュリティ対策
Office365 および Azure AD 管理者が必ずやっておくべきセキュリティ対策Office365 および Azure AD 管理者が必ずやっておくべきセキュリティ対策
Office365 および Azure AD 管理者が必ずやっておくべきセキュリティ対策Yusuke Kodama
 

La actualidad más candente (20)

ママ、どうして仮想化が必要なの?
ママ、どうして仮想化が必要なの?ママ、どうして仮想化が必要なの?
ママ、どうして仮想化が必要なの?
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
OTRS紹介資料
OTRS紹介資料OTRS紹介資料
OTRS紹介資料
 
Azure AD の SaaS アプリケーション認証への活用
Azure AD の SaaS アプリケーション認証への活用Azure AD の SaaS アプリケーション認証への活用
Azure AD の SaaS アプリケーション認証への活用
 
IBM Security SaaS IaaS and PaaS
IBM Security SaaS IaaS and PaaSIBM Security SaaS IaaS and PaaS
IBM Security SaaS IaaS and PaaS
 
Domain driven design
Domain driven designDomain driven design
Domain driven design
 
Domain Driven Design 101
Domain Driven Design 101Domain Driven Design 101
Domain Driven Design 101
 
Service Oriented Architecture (SOA)
Service Oriented Architecture (SOA)Service Oriented Architecture (SOA)
Service Oriented Architecture (SOA)
 
Securing enterprise-grade serverless applications - SDD401 - AWS re:Inforce 2...
Securing enterprise-grade serverless applications - SDD401 - AWS re:Inforce 2...Securing enterprise-grade serverless applications - SDD401 - AWS re:Inforce 2...
Securing enterprise-grade serverless applications - SDD401 - AWS re:Inforce 2...
 
Azure ad の導入を検討している方へ ~ active directory の構成パターンと正しい認証方式の選択~
Azure ad の導入を検討している方へ ~ active directory の構成パターンと正しい認証方式の選択~Azure ad の導入を検討している方へ ~ active directory の構成パターンと正しい認証方式の選択~
Azure ad の導入を検討している方へ ~ active directory の構成パターンと正しい認証方式の選択~
 
今さら聞けない!Active Directoryドメインサービス入門
今さら聞けない!Active Directoryドメインサービス入門今さら聞けない!Active Directoryドメインサービス入門
今さら聞けない!Active Directoryドメインサービス入門
 
01.표준프레임워크개요
01.표준프레임워크개요01.표준프레임워크개요
01.표준프레임워크개요
 
脱 Excel設計書
脱 Excel設計書脱 Excel設計書
脱 Excel設計書
 
Microservices in Practice
Microservices in PracticeMicroservices in Practice
Microservices in Practice
 
超初心者向けForce.com入門
超初心者向けForce.com入門超初心者向けForce.com入門
超初心者向けForce.com入門
 
S05 Microsoft Azure 仮想マシンでの Active Directory 活用シナリオ
S05 Microsoft Azure 仮想マシンでの Active Directory 活用シナリオS05 Microsoft Azure 仮想マシンでの Active Directory 活用シナリオ
S05 Microsoft Azure 仮想マシンでの Active Directory 活用シナリオ
 
今さら聞けない! Windows Server 2016 Active Directoryドメインサービス入門
今さら聞けない! Windows Server 2016 Active Directoryドメインサービス入門今さら聞けない! Windows Server 2016 Active Directoryドメインサービス入門
今さら聞けない! Windows Server 2016 Active Directoryドメインサービス入門
 
ゼロ・トラストネットワークを実現する、 マイクロソフトの新しいSecurityサービスの全貌 〜 SIEM、SOCの構築をサポートするMicrosoft ...
ゼロ・トラストネットワークを実現する、 マイクロソフトの新しいSecurityサービスの全貌 〜 SIEM、SOCの構築をサポートするMicrosoft ...ゼロ・トラストネットワークを実現する、 マイクロソフトの新しいSecurityサービスの全貌 〜 SIEM、SOCの構築をサポートするMicrosoft ...
ゼロ・トラストネットワークを実現する、 マイクロソフトの新しいSecurityサービスの全貌 〜 SIEM、SOCの構築をサポートするMicrosoft ...
 
Microsoft Project Online 活用ガイド
Microsoft Project Online 活用ガイドMicrosoft Project Online 活用ガイド
Microsoft Project Online 活用ガイド
 
Office365 および Azure AD 管理者が必ずやっておくべきセキュリティ対策
Office365 および Azure AD 管理者が必ずやっておくべきセキュリティ対策Office365 および Azure AD 管理者が必ずやっておくべきセキュリティ対策
Office365 および Azure AD 管理者が必ずやっておくべきセキュリティ対策
 

Similar a Approccio Pratico al Domain Driven Design

How I did it (in .NET): idiomatic Domain Driven Design
How I did it (in .NET): idiomatic Domain Driven DesignHow I did it (in .NET): idiomatic Domain Driven Design
How I did it (in .NET): idiomatic Domain Driven DesignAndrea Saltarello
 
Repository pattern slides v1.1
Repository pattern slides v1.1Repository pattern slides v1.1
Repository pattern slides v1.1Christian Nastasi
 
Idiomatic Domain Driven Design
Idiomatic Domain Driven DesignIdiomatic Domain Driven Design
Idiomatic Domain Driven DesignAndrea Saltarello
 
Introduzione al Domain Driven Design (DDD)
Introduzione al Domain Driven Design (DDD)Introduzione al Domain Driven Design (DDD)
Introduzione al Domain Driven Design (DDD)DotNetMarche
 
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
 
Note di Data Warehouse e Business Intelligence - Tecniche di Naming Conventio...
Note di Data Warehouse e Business Intelligence - Tecniche di Naming Conventio...Note di Data Warehouse e Business Intelligence - Tecniche di Naming Conventio...
Note di Data Warehouse e Business Intelligence - Tecniche di Naming Conventio...Massimo Cenci
 
Slide evento Code Refactoring JavaScript
Slide evento Code Refactoring JavaScriptSlide evento Code Refactoring JavaScript
Slide evento Code Refactoring JavaScriptLuca Pagliaro
 
C#, imparare a programmare e sopravvivere
C#, imparare a programmare e sopravvivereC#, imparare a programmare e sopravvivere
C#, imparare a programmare e sopravvivereMatteo Valoriani
 
Entity Framework 4.0 vs NHibernate
Entity Framework 4.0 vs NHibernateEntity Framework 4.0 vs NHibernate
Entity Framework 4.0 vs NHibernateManuel Scapolan
 
Riuso Object Oriented
Riuso Object OrientedRiuso Object Oriented
Riuso Object OrientedStefano Fago
 
Modelli applicativi per il Cloud Computing - Part 1 - Edition 2014
Modelli applicativi per il Cloud Computing - Part 1 - Edition 2014Modelli applicativi per il Cloud Computing - Part 1 - Edition 2014
Modelli applicativi per il Cloud Computing - Part 1 - Edition 2014Marco Parenzan
 
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
 
Build a LINQ-enabled Repository
Build a LINQ-enabled RepositoryBuild a LINQ-enabled Repository
Build a LINQ-enabled RepositoryAndrea Saltarello
 
Layered Expression Trees: una terza via (idiomatica) verso il DDD
Layered Expression Trees: una terza via (idiomatica) verso il DDDLayered Expression Trees: una terza via (idiomatica) verso il DDD
Layered Expression Trees: una terza via (idiomatica) verso il DDDAndrea Saltarello
 
Java Programming Language
Java Programming LanguageJava Programming Language
Java Programming LanguagePasquale Paola
 
Layered Expression Trees feat. CQRS
Layered Expression Trees feat. CQRSLayered Expression Trees feat. CQRS
Layered Expression Trees feat. CQRSAndrea Saltarello
 

Similar a Approccio Pratico al Domain Driven Design (20)

How I did it (in .NET): idiomatic Domain Driven Design
How I did it (in .NET): idiomatic Domain Driven DesignHow I did it (in .NET): idiomatic Domain Driven Design
How I did it (in .NET): idiomatic Domain Driven Design
 
Repository pattern slides v1.1
Repository pattern slides v1.1Repository pattern slides v1.1
Repository pattern slides v1.1
 
Idiomatic Domain Driven Design
Idiomatic Domain Driven DesignIdiomatic Domain Driven Design
Idiomatic Domain Driven Design
 
Introduzione al Domain Driven Design (DDD)
Introduzione al Domain Driven Design (DDD)Introduzione al Domain Driven Design (DDD)
Introduzione al Domain Driven Design (DDD)
 
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
 
Note di Data Warehouse e Business Intelligence - Tecniche di Naming Conventio...
Note di Data Warehouse e Business Intelligence - Tecniche di Naming Conventio...Note di Data Warehouse e Business Intelligence - Tecniche di Naming Conventio...
Note di Data Warehouse e Business Intelligence - Tecniche di Naming Conventio...
 
ORM - Introduzione
ORM - IntroduzioneORM - Introduzione
ORM - Introduzione
 
Corso UML
Corso UMLCorso UML
Corso UML
 
Slide evento Code Refactoring JavaScript
Slide evento Code Refactoring JavaScriptSlide evento Code Refactoring JavaScript
Slide evento Code Refactoring JavaScript
 
C#, imparare a programmare e sopravvivere
C#, imparare a programmare e sopravvivereC#, imparare a programmare e sopravvivere
C#, imparare a programmare e sopravvivere
 
Entity Framework 4.0 vs NHibernate
Entity Framework 4.0 vs NHibernateEntity Framework 4.0 vs NHibernate
Entity Framework 4.0 vs NHibernate
 
Riuso Object Oriented
Riuso Object OrientedRiuso Object Oriented
Riuso Object Oriented
 
Repository pattern
Repository patternRepository pattern
Repository pattern
 
Modelli applicativi per il Cloud Computing - Part 1 - Edition 2014
Modelli applicativi per il Cloud Computing - Part 1 - Edition 2014Modelli applicativi per il Cloud Computing - Part 1 - Edition 2014
Modelli applicativi per il Cloud Computing - Part 1 - Edition 2014
 
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
 
Build a LINQ-enabled Repository
Build a LINQ-enabled RepositoryBuild a LINQ-enabled Repository
Build a LINQ-enabled Repository
 
Layered Expression Trees: una terza via (idiomatica) verso il DDD
Layered Expression Trees: una terza via (idiomatica) verso il DDDLayered Expression Trees: una terza via (idiomatica) verso il DDD
Layered Expression Trees: una terza via (idiomatica) verso il DDD
 
Java Programming Language
Java Programming LanguageJava Programming Language
Java Programming Language
 
Object Oriented Design
Object Oriented DesignObject Oriented Design
Object Oriented Design
 
Layered Expression Trees feat. CQRS
Layered Expression Trees feat. CQRSLayered Expression Trees feat. CQRS
Layered Expression Trees feat. CQRS
 

Más de Luca Milan

Enabling DevOps for Machine Learning with Azure Pipelines
Enabling DevOps for Machine Learning with Azure PipelinesEnabling DevOps for Machine Learning with Azure Pipelines
Enabling DevOps for Machine Learning with Azure PipelinesLuca Milan
 
"Don't call us, we'll call you" - AngularJS meets Event-Driven Architecture
"Don't call us, we'll call you" - AngularJS meets Event-Driven Architecture"Don't call us, we'll call you" - AngularJS meets Event-Driven Architecture
"Don't call us, we'll call you" - AngularJS meets Event-Driven ArchitectureLuca Milan
 
Azure WebSites for Developers
Azure WebSites for DevelopersAzure WebSites for Developers
Azure WebSites for DevelopersLuca Milan
 
Web Api – The HTTP Way
Web Api – The HTTP WayWeb Api – The HTTP Way
Web Api – The HTTP WayLuca Milan
 
AngularJS – Reinventare le applicazioni web
AngularJS – Reinventare le applicazioni webAngularJS – Reinventare le applicazioni web
AngularJS – Reinventare le applicazioni webLuca Milan
 
Il difficile mestiere dello sviluppatore: un approccio feature oriented.
Il difficile mestiere dello sviluppatore: un approccio feature oriented.Il difficile mestiere dello sviluppatore: un approccio feature oriented.
Il difficile mestiere dello sviluppatore: un approccio feature oriented.Luca Milan
 
What's new in Asp.Net 4.5 (and WebApi)
What's new in Asp.Net 4.5 (and WebApi)What's new in Asp.Net 4.5 (and WebApi)
What's new in Asp.Net 4.5 (and WebApi)Luca Milan
 
Usare le nuove WCF Web Api per creare servizi RESTful
Usare le nuove WCF Web Api per creare servizi RESTfulUsare le nuove WCF Web Api per creare servizi RESTful
Usare le nuove WCF Web Api per creare servizi RESTfulLuca Milan
 
NHibernate Configuration Patterns
NHibernate Configuration PatternsNHibernate Configuration Patterns
NHibernate Configuration PatternsLuca Milan
 
Architetttura Della Soluzione
Architetttura Della SoluzioneArchitetttura Della Soluzione
Architetttura Della SoluzioneLuca Milan
 

Más de Luca Milan (10)

Enabling DevOps for Machine Learning with Azure Pipelines
Enabling DevOps for Machine Learning with Azure PipelinesEnabling DevOps for Machine Learning with Azure Pipelines
Enabling DevOps for Machine Learning with Azure Pipelines
 
"Don't call us, we'll call you" - AngularJS meets Event-Driven Architecture
"Don't call us, we'll call you" - AngularJS meets Event-Driven Architecture"Don't call us, we'll call you" - AngularJS meets Event-Driven Architecture
"Don't call us, we'll call you" - AngularJS meets Event-Driven Architecture
 
Azure WebSites for Developers
Azure WebSites for DevelopersAzure WebSites for Developers
Azure WebSites for Developers
 
Web Api – The HTTP Way
Web Api – The HTTP WayWeb Api – The HTTP Way
Web Api – The HTTP Way
 
AngularJS – Reinventare le applicazioni web
AngularJS – Reinventare le applicazioni webAngularJS – Reinventare le applicazioni web
AngularJS – Reinventare le applicazioni web
 
Il difficile mestiere dello sviluppatore: un approccio feature oriented.
Il difficile mestiere dello sviluppatore: un approccio feature oriented.Il difficile mestiere dello sviluppatore: un approccio feature oriented.
Il difficile mestiere dello sviluppatore: un approccio feature oriented.
 
What's new in Asp.Net 4.5 (and WebApi)
What's new in Asp.Net 4.5 (and WebApi)What's new in Asp.Net 4.5 (and WebApi)
What's new in Asp.Net 4.5 (and WebApi)
 
Usare le nuove WCF Web Api per creare servizi RESTful
Usare le nuove WCF Web Api per creare servizi RESTfulUsare le nuove WCF Web Api per creare servizi RESTful
Usare le nuove WCF Web Api per creare servizi RESTful
 
NHibernate Configuration Patterns
NHibernate Configuration PatternsNHibernate Configuration Patterns
NHibernate Configuration Patterns
 
Architetttura Della Soluzione
Architetttura Della SoluzioneArchitetttura Della Soluzione
Architetttura Della Soluzione
 

Approccio Pratico al Domain Driven Design

  • 2. “ 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 individual, whether as large as a corporation or as small as a single line on an order form” Io leggo: usiamo tecniche OO per tradurre la complessità del dominio applicativo in un modello ad oggetti utile allo scopo (nessun virtuosismo concettuale dobbiamo essere pragmatici).
  • 3. Una disciplina che aiuta lo sviluppatore ad consolidare le logiche di business (complesse e in evoluzione) di un dominio applicativo in un Modello ad Oggetti grazie al paradigma OO .  Un insieme di regole e principi che pone il Modello ad Oggetti come centro del processo di sviluppo.  Uno stile architetturale che realizza un disaccoppiamento tra il Modello ad Oggetti e gli altri strati software rendendolo totalmente autonomo e indipendente.
  • 4. Possiamo farlo quando: ◦ Il processo di sviluppo è iterativo. Miglioreremo la conoscenza del dominio passo dopo passo grazie all’aiuto degli esperti del dominio. ◦ Le logiche di business del domino sono complesse ed evolvono continuamente nel tempo. ◦ Conosciamo bene la programmazione OO ed abbiamo familiarità con concetti come Refactoring, IOC, Persistence Ignorance (PI), principi SOLID, ecc..  Non conviene usare la DDD quando: ◦ I progetti sono semplici (un blog, un piccolo e-commerce) e non subiscono evoluzioni nel tempo. ◦ Applicazioni di pura reportistica o ETL o simili
  • 5. Domain Model ◦ “An object model of the domain that incorporates both behavior and data” da Fowler Una classe .NET incarna un public class Ordine{ object model public string Cliente{get;set;} public void MarcaComeCompleto(){ ◦ Attenzione: Stato = StatoOrdine.Completo; } Classe != Oggetto public IList<Linee> {get;set;} } Una volta creati gli oggetti possiamo collegarli tramite gerarchie e relazioni ed assegnarli ruoli e responsabilità. Ciò significa formare la rete interconnessa (grafo) del pattern di Fowler.
  • 6. Bounded Context (or Context) ◦ “The delimited applicability of a particular model. BOUNDING CONTEXTS gives team members a clear and shared understanding of what has to be consistent and what can develop independently” da domaindrivendesign.org Rappresentano i confini (variabili) del dominio e devono essere ben marcati. Al di fuori di essi dobbiamo lasciare tutta la complessità non utile ai nostri scopi (funzionali ed applicativi). Non perdiamo la direzione!!!
  • 7. Parte di Catalogo di un domain model per un sistema di e-commerce
  • 8. Spesso i domain model non seguono le regole indicate da Fowler ed Evans, in questo caso Fowler identifica un anti-pattern: l’Anemic Domain Model  I sintomi di un dominio anemico sono a livello di classe: 1. Ad una 1 classe corrisponde una 1 tabella 2. Non ci sono metodi solo getters e setters 3. La logica anziché sui metodi viene incapsulata nei setters In questi casi dobbiamo rivitalizzare il dominio.
  • 9. Ubiquitous Language  Unit Of Work  Entity  Inversion Of Control  Value Object  Object Relational Mapping  Aspected Oriented  Repository Programming  Service  Contract By Design  Aggregates  TDD, BDD  Factories  OO tecniques, SOLID  Specification / Queries principles  Context (Boundary / Map)  Refactoring Attori della DDD Patterns e tecniche collegate
  • 10. Sviluppatori ed esperti del dominio devono collaborare tra loro. Per farlo al meglio devono trovare un linguaggio comune semplice ed intuitivo con cui poter dialogare (no termini tecnici, no termini di business) . Paginare, Schedulare, Indicizzare, Disaccoppiare CGA, Mandato ad Assicurare, ecc..
  • 11. Dal libro di Eric Evans: 1. "An Entity is an Object that represents something with continuity and identity. An entity is tracked through different states and implementations.“ 2. "An object that represents a descriptive aspect of the domain with no conceptual identity“
  • 12. Dal libro di Eric Evans “First we need an abstraction for encapsulating references within the [domain] model. An Aggregate is a cluster of associated [domain] objects that we treat as a unit for the purpose of [ensuring consistency of] data changes. Each Aggregate has a root and a boundary. The root is a single, specific Entity contained in the Aggregate”
  • 13. E’ uno dei concetti più dibattuti Fowler dice: “A Repository mediates between the domain and data mapping layers, acting like an in-memory domain object collection. Client objects construct query specifications declaratively and submit them to Repository for satisfaction. Objects can be added to and removed from the Repository, as they can from a simple collection of objects, and the mapping code encapsulated by the Repository will carry out the appropriate operations behind the scenes. Conceptually, a Repository encapsulates the set of objects persisted in a data store and the operations performed over them, providing a more object- oriented view of the persistence layer. Repository also supports the objective of achieving a clean separation and one-way dependency between the domain and data mapping layers” Parla il linguaggio del domain model (no DTO no DAO) ed è agnostico rispetto ai meccanismi di persistenza utilizzati dall’applicazione. Rafforza il concetto di uguaglianza per Identità (non by reference), il repository restituisce la stessa istanza di oggetto se l’oggetto ha la stessa identità.
  • 14. Dal libro di Eric Evans “A SERVICE is an operation offered as an interface that stands alone in the model, without encapsulating state, as ENTITIES and VALUE OBJECTS do.“ Un servizio si occupa di coordinare azioni che coinvolgono uno o più oggetti del dominio (entity,value objects,repository). Es. La modifica di un ordine non può essere delegata ad un singolo comportamento dell’entità Ordine, meglio creare un servizio IOrderModify.Execute(params).
  • 15. Possiamo usare l’approccio DDD anche con altri tipi di architetture di classe enterprise: ◦ Con SOA vedi http://www.udidahan.com/ ◦ In scenari distribuiti come Distributed DDD vedi http://codebetter.com/blogs/gregyoung/ ◦ Con REST vedi http://blogs.msdn.com/jmeier/archive/2009/01/21/applicatio n-patterns.aspx
  • 16. http://www.infoq.com/presentations/model-to-work- evans  http://domaindrivendesign.org/books  http://www.infoq.com/interviews/jimmy-nilsson- domain-driven-design  http://domaindrivendesign.org/  http://download.microsoft.com/download/6/3/D/63D A97EC-6B79-42C1-9DAF-D8D00D8C7759/guisa.pdf