SlideShare une entreprise Scribd logo
J'ai mis du DDD et du BDD
dans ma marmite
Présentation
●

Florent Chardonnereau

●

Ingénieur Logiciel depuis 12 ans

●

Agile depuis 6 ans

●

DDD depuis 1,5 ans

●

Twitter : @fchardon
Domain Driven Design
●

Orienté sur le domaine

●

Ubuquitus Language

●

Entity = Identité + Etat + Comportement

●

Value Object = Immutable
Domain Driven Design :
Architecture en Oignon
Service

Domain

Test

e
ur
ct
ru
st
fra
In

Web
Domain Driven Design
Exemple : Projet eBiblio
●

User Stories :
–

●

En tant qu'adhérent, je veux louer un livre.

Identification des concepts
–
–

Adhérent, nom, prenom, numéroAdherent
Livre, auteur, titre, référence,etat
Domain Driven Design
Exemple : Entity
public class Adherent implements Entity {
private String nom;
private String prenom;
private NoAdherent noAdherent;
public Adherent(String nom, String prenom, NoAdherent noAdherent) {
super();
this.nom = nom;
this.prenom = prenom;
this.noAdherent = noAdherent;
}
Domain Driven Design
Exemple : ValueObject
// Le NoAdherent doit être du format [0-9]{3}
public class NoAdherent implements ValueObject {
private String numero;
public NoAdherent(String numero) {
if (new RegleValidationNoAdherent(numero).valider()) {
this.numero = numero;
}
}
}
Oui et maintenant !
Comment rendre mes spécifications
exécutables ?
Behavior Driven Developement
●

TDD Orienté sur le comportement

●

Utilise le DDD

●

Basé sur le principe du Given, When Then
BDD avec JBehave
Story :
Louer_un_livre.story
Story launcher :
eBiblioStoryEmbedder.java
Step :
GererLivreSteps.java
BDD :
Projet eBiblio
●

User Story :
–

●

En tant qu'adhérent, je veux louer un livre

Louer_un_livre.story
–
–
–
–
–

Etant donné que l'adhérent 123 existe.
Etant donné que le livre aaa est disponible.
Quand l'adhérent 123 loue le livre aaa
Alors le livre est en état LOUE.
Alors l'adhérent à loué 1 livre.
public class GererLivreSteps {

BDD et JBehave
Projet eBiblio

@Given("mon adhérent %noAdherent existe.")
@Pending
public void givenMonAdherentExiste(String noAdherent) {
}
@Given("mon livre référence %reference est disponible.")
@Pending
public void givenMonLivreReferenceEstDisponible(String reference) {
}
@When("l'adhérent loue le livre.")
@Pending
public void whenLadherentLoueLeLivre() {
}
@Then("le livre est loué.")
public void thenLeLivreEstLoue() {
}

}

@Then("l'adhérent a loué %nombre livre.")
public void thenLadherentALoueLivres(int nombre) {
}
DDD et BDD
Retour d'expérience
●

Les plus
●
●

Prise de conscience du métier de la complexité

●

Rapproche les devs du métiers

●

Test d'acceptance (test fonctionnels)

●

Robustesse vis à vis du changement

●

●

Facilité de mise en œuvre d'un métier complexe

Facilité du code à prendre en main

Les moins
●

Change la manière de coder (finit le CRUD)

●

Besoin de bons développeurs

●

On peut lâcher facilement

●

Besoin d'une organisation « Agile »
Références
●

Site
●
●

●

DDDSample : http://dddsample.sourceforge.net/
Projet eBiblio : https://github.com/fchardon/eBiblio

Livre
●
●

●

Domain Driven Design Quickly
Domain Driven Design : Tackling Complexity in the Heart of Software
(Eric Evans)
Implementing Domain-Driven Design (Vaughn Veron)
Et maintenant y a plus qu'a...

Contenu connexe

Dernier

Newsletter SPW Agriculture en province du Luxembourg du 12-06-24
Newsletter SPW Agriculture en province du Luxembourg du 12-06-24Newsletter SPW Agriculture en province du Luxembourg du 12-06-24
Newsletter SPW Agriculture en province du Luxembourg du 12-06-24
BenotGeorges3
 
Formation Intelligence Artificielle pour dirigeants- IT6-DIGITALIX 24_opt OK_...
Formation Intelligence Artificielle pour dirigeants- IT6-DIGITALIX 24_opt OK_...Formation Intelligence Artificielle pour dirigeants- IT6-DIGITALIX 24_opt OK_...
Formation Intelligence Artificielle pour dirigeants- IT6-DIGITALIX 24_opt OK_...
cristionobedi
 
Burkina Faso library newsletter May 2024
Burkina Faso library newsletter May 2024Burkina Faso library newsletter May 2024
Burkina Faso library newsletter May 2024
Friends of African Village Libraries
 
Iris van Herpen. pptx
Iris            van        Herpen.     pptxIris            van        Herpen.     pptx
Iris van Herpen. pptx
Txaruka
 
Cycle de Formation Théâtrale 2024 / 2025
Cycle de Formation Théâtrale 2024 / 2025Cycle de Formation Théâtrale 2024 / 2025
Cycle de Formation Théâtrale 2024 / 2025
Billy DEYLORD
 
Formation M2i - Onboarding réussi - les clés pour intégrer efficacement vos n...
Formation M2i - Onboarding réussi - les clés pour intégrer efficacement vos n...Formation M2i - Onboarding réussi - les clés pour intégrer efficacement vos n...
Formation M2i - Onboarding réussi - les clés pour intégrer efficacement vos n...
M2i Formation
 
Iris van Herpen. pptx
Iris         van         Herpen.      pptxIris         van         Herpen.      pptx
Iris van Herpen. pptx
Txaruka
 
Iris van Herpen. pptx
Iris         van        Herpen.      pptxIris         van        Herpen.      pptx
Iris van Herpen. pptx
Txaruka
 

Dernier (8)

Newsletter SPW Agriculture en province du Luxembourg du 12-06-24
Newsletter SPW Agriculture en province du Luxembourg du 12-06-24Newsletter SPW Agriculture en province du Luxembourg du 12-06-24
Newsletter SPW Agriculture en province du Luxembourg du 12-06-24
 
Formation Intelligence Artificielle pour dirigeants- IT6-DIGITALIX 24_opt OK_...
Formation Intelligence Artificielle pour dirigeants- IT6-DIGITALIX 24_opt OK_...Formation Intelligence Artificielle pour dirigeants- IT6-DIGITALIX 24_opt OK_...
Formation Intelligence Artificielle pour dirigeants- IT6-DIGITALIX 24_opt OK_...
 
Burkina Faso library newsletter May 2024
Burkina Faso library newsletter May 2024Burkina Faso library newsletter May 2024
Burkina Faso library newsletter May 2024
 
Iris van Herpen. pptx
Iris            van        Herpen.     pptxIris            van        Herpen.     pptx
Iris van Herpen. pptx
 
Cycle de Formation Théâtrale 2024 / 2025
Cycle de Formation Théâtrale 2024 / 2025Cycle de Formation Théâtrale 2024 / 2025
Cycle de Formation Théâtrale 2024 / 2025
 
Formation M2i - Onboarding réussi - les clés pour intégrer efficacement vos n...
Formation M2i - Onboarding réussi - les clés pour intégrer efficacement vos n...Formation M2i - Onboarding réussi - les clés pour intégrer efficacement vos n...
Formation M2i - Onboarding réussi - les clés pour intégrer efficacement vos n...
 
Iris van Herpen. pptx
Iris         van         Herpen.      pptxIris         van         Herpen.      pptx
Iris van Herpen. pptx
 
Iris van Herpen. pptx
Iris         van        Herpen.      pptxIris         van        Herpen.      pptx
Iris van Herpen. pptx
 

En vedette

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
Christy Abraham Joy
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
Vit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
MindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
GetSmarter
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
Alireza Esmikhani
 

En vedette (20)

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 

J'ai mis du DDD et du BDD dans ma marmite.

  • 1. J'ai mis du DDD et du BDD dans ma marmite
  • 2. Présentation ● Florent Chardonnereau ● Ingénieur Logiciel depuis 12 ans ● Agile depuis 6 ans ● DDD depuis 1,5 ans ● Twitter : @fchardon
  • 3. Domain Driven Design ● Orienté sur le domaine ● Ubuquitus Language ● Entity = Identité + Etat + Comportement ● Value Object = Immutable
  • 4. Domain Driven Design : Architecture en Oignon Service Domain Test e ur ct ru st fra In Web
  • 5. Domain Driven Design Exemple : Projet eBiblio ● User Stories : – ● En tant qu'adhérent, je veux louer un livre. Identification des concepts – – Adhérent, nom, prenom, numéroAdherent Livre, auteur, titre, référence,etat
  • 6. Domain Driven Design Exemple : Entity public class Adherent implements Entity { private String nom; private String prenom; private NoAdherent noAdherent; public Adherent(String nom, String prenom, NoAdherent noAdherent) { super(); this.nom = nom; this.prenom = prenom; this.noAdherent = noAdherent; }
  • 7. Domain Driven Design Exemple : ValueObject // Le NoAdherent doit être du format [0-9]{3} public class NoAdherent implements ValueObject { private String numero; public NoAdherent(String numero) { if (new RegleValidationNoAdherent(numero).valider()) { this.numero = numero; } } }
  • 9. Comment rendre mes spécifications exécutables ? Behavior Driven Developement ● TDD Orienté sur le comportement ● Utilise le DDD ● Basé sur le principe du Given, When Then
  • 10. BDD avec JBehave Story : Louer_un_livre.story Story launcher : eBiblioStoryEmbedder.java Step : GererLivreSteps.java
  • 11. BDD : Projet eBiblio ● User Story : – ● En tant qu'adhérent, je veux louer un livre Louer_un_livre.story – – – – – Etant donné que l'adhérent 123 existe. Etant donné que le livre aaa est disponible. Quand l'adhérent 123 loue le livre aaa Alors le livre est en état LOUE. Alors l'adhérent à loué 1 livre.
  • 12. public class GererLivreSteps { BDD et JBehave Projet eBiblio @Given("mon adhérent %noAdherent existe.") @Pending public void givenMonAdherentExiste(String noAdherent) { } @Given("mon livre référence %reference est disponible.") @Pending public void givenMonLivreReferenceEstDisponible(String reference) { } @When("l'adhérent loue le livre.") @Pending public void whenLadherentLoueLeLivre() { } @Then("le livre est loué.") public void thenLeLivreEstLoue() { } } @Then("l'adhérent a loué %nombre livre.") public void thenLadherentALoueLivres(int nombre) { }
  • 13. DDD et BDD Retour d'expérience ● Les plus ● ● Prise de conscience du métier de la complexité ● Rapproche les devs du métiers ● Test d'acceptance (test fonctionnels) ● Robustesse vis à vis du changement ● ● Facilité de mise en œuvre d'un métier complexe Facilité du code à prendre en main Les moins ● Change la manière de coder (finit le CRUD) ● Besoin de bons développeurs ● On peut lâcher facilement ● Besoin d'une organisation « Agile »
  • 14. Références ● Site ● ● ● DDDSample : http://dddsample.sourceforge.net/ Projet eBiblio : https://github.com/fchardon/eBiblio Livre ● ● ● Domain Driven Design Quickly Domain Driven Design : Tackling Complexity in the Heart of Software (Eric Evans) Implementing Domain-Driven Design (Vaughn Veron)
  • 15. Et maintenant y a plus qu'a...