DOMAIN DRIVEN DESIGN AND JPA Cecilio lvarez Caules

  • Slides: 34
Download presentation
DOMAIN DRIVEN DESIGN AND JPA Cecilio Álvarez Caules Java Master Oracle Certified Enterprise Architect

DOMAIN DRIVEN DESIGN AND JPA Cecilio Álvarez Caules Java Master Oracle Certified Enterprise Architect web: www. arquitecturajava. com twitter: @arquitectojava

DOMAIN DRIVEN DESIGN (AGENDA) Problems Create Model Use JPA

DOMAIN DRIVEN DESIGN (AGENDA) Problems Create Model Use JPA

DOMAIN MODEL PROBLEMS

DOMAIN MODEL PROBLEMS

MAIN PROBLEMS Expert Problem Communication Problem Complexibility Problem

MAIN PROBLEMS Expert Problem Communication Problem Complexibility Problem

EXPERTS People General Knowledge You dont know anything All people looks experts

EXPERTS People General Knowledge You dont know anything All people looks experts

COMMUNICATION PROBLEM

COMMUNICATION PROBLEM

EXAMPLE Barça is a great football team Pau Gasol not a football team Barça

EXAMPLE Barça is a great football team Pau Gasol not a football team Barça club Football club with a great team

COMPLEXIBILITY PROBLEM

COMPLEXIBILITY PROBLEM

IT’S NOT SO EASY! Barça club Football club and great team F F senio

IT’S NOT SO EASY! Barça club Football club and great team F F senio club and teams 18 r F F F club and teams senior 18 A B Football senior A women

SUMMARIZING PROBLEMS • There is no easy access to experts • Communication can be

SUMMARIZING PROBLEMS • There is no easy access to experts • Communication can be tricky • Models are more complex than you think • It is your responsibility to create a good model • Knowing your customer proves to be

AGENDA Problems Create Model Use JPA

AGENDA Problems Create Model Use JPA

HOW TO BUILD SOLID MODELS?

HOW TO BUILD SOLID MODELS?

MODELING MY TALK • How does Barcelona Java conferences works? • An expert gives

MODELING MY TALK • How does Barcelona Java conferences works? • An expert gives a talk about a technical subject for Java Developers.

FIRST MODEL Expert name 1 n Talk title duration Developer n name n

FIRST MODEL Expert name 1 n Talk title duration Developer n name n

ANALISYS • Is my model correct? • Case 1 : Your model is bad

ANALISYS • Is my model correct? • Case 1 : Your model is bad , You need to improve your model , you need more concepts. • Case 2: Your model is fine but small, you can go to next meeting • Your model is wrong

ANALISYS PATTERNS Places Things Roles Events Descripti on

ANALISYS PATTERNS Places Things Roles Events Descripti on

VERY OLD BOOKS • Analisys patterns (Martin Fowler) • Java UML in Colour (Peter

VERY OLD BOOKS • Analisys patterns (Martin Fowler) • Java UML in Colour (Peter Coad) • Data Model Patterns (David Hay)

<Role> Expert name 1 <Event> Talk n title duration <Role> Developer n n name

<Role> Expert name 1 <Event> Talk n title duration <Role> Developer n n name

WHAT AN EVENT IS? Point Time. Line Heart of Model Talk? ? ? whats

WHAT AN EVENT IS? Point Time. Line Heart of Model Talk? ? ? whats happens?

WORKING WITH TALK Talk title duration date repeat thing Presentation date event

WORKING WITH TALK Talk title duration date repeat thing Presentation date event

<Role> Expert <Thing> Talk name title duration <Place> Room number <Event> Presentation date <Role>

<Role> Expert <Thing> Talk name title duration <Place> Room number <Event> Presentation date <Role> Developer name

THINKING ABOUT • You have a problem with your customer • Maybe its not

THINKING ABOUT • You have a problem with your customer • Maybe its not the correct person to talk • How we can solve/reduce this problem?

MODELS AND TIME time line

MODELS AND TIME time line

MODELS AND EVENTS before after T T T Enrollment Presentation Survey

MODELS AND EVENTS before after T T T Enrollment Presentation Survey

BEFORE EVENTS <Role> Developer <Role> JUG <Thing> Ticket <Description> Category <Thing> Talk Enrollment Conference

BEFORE EVENTS <Role> Developer <Role> JUG <Thing> Ticket <Description> Category <Thing> Talk Enrollment Conference date Presentatio n date <Place> Web. Site <Place> University

DEEP VIEW Booking Enrollment date Invoice date Payment date

DEEP VIEW Booking Enrollment date Invoice date Payment date

<Place> website <Role> Developer <Description> Category <Thing> Talk <Thing> Ticket <Event> Enrollment <Event> Conference

<Place> website <Role> Developer <Description> Category <Thing> Talk <Thing> Ticket <Event> Enrollment <Event> Conference <Event> Presentation <Role> JUG <Event> Invoice <Event> Payment <Role> Expert <Place> Room <Event> Survey

VIEW AND MODELS unflexible more than you need

VIEW AND MODELS unflexible more than you need

SUMMARIZING MODELS • It´s your model , not the customer´s • Use, don’t show

SUMMARIZING MODELS • It´s your model , not the customer´s • Use, don’t show at first place • Time have no limits , be careful • Understand better your customer • Where does knowledge lie in the company ?

AGENDA Problems Create Model Use JPA

AGENDA Problems Create Model Use JPA

JPA AND DOMAINS n+1 Queries Lazy/ Eager Join. Fetch Graphs

JPA AND DOMAINS n+1 Queries Lazy/ Eager Join. Fetch Graphs

TIME TO CODE

TIME TO CODE

CONCLUSIONS • Use Analysis patterns in your models • Create a good model is

CONCLUSIONS • Use Analysis patterns in your models • Create a good model is hard • Is your responsibility • Know your framework

THANKS • Cecilio Álvarez Caules • contacto@arquitecturajava. com • twitter: @arquitectojava • blog: http:

THANKS • Cecilio Álvarez Caules • contacto@arquitecturajava. com • twitter: @arquitectojava • blog: http: //www. arquitecturajava. com