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 model problems
main Problems Expert Problem Communication Problem Complexibility
Experts People General Knowledge You dont know anything All people looks experts
communication problem
is a great football team example Barça is a great football team Pau Gasol not a football team Barça club Football team club with a great team
Complexibility problem
It’s not so easy! Barça club Football team club and great team Barça senior F 18 club and teams Barça club F senior A F senior B F 18 club and teams Barça club Football senior A men Football senior A women
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 essential
Agenda Create Model Problems Use JPA
How to build solid models?
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 Talk title duration 1 n Developer name n n
analisys Your model is wrong Is my model correct? Case1 :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 Description
very OLD books Analisys patterns (Martin Fowler) Java UML in Colour (Peter Coad) Data Model Patterns (David Hay)
<Role> Expert 1 <Event> Talk n <Role> Developer n name n 1 <Event> Talk title duration <Role> Developer name n
what an event is? Point TimeLine Heart of Model Talk??? whats happens?
working with talk Talk Talk Talk Presentation thing event repeat duration title Talk duration title date Talk duration title Presentation date thing event repeat
<Thing> <Role> Talk Expert <Place> Room name <Thing> Talk title duration <Place> Room number <Event> Presentation date <Role> Developer name
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 events before after T T T Enrollment Presentation Survey
before events Enrollment Presentation Conference <Thing> Talk date Presentation Conference <Thing> Talk <Place> University Ticket WebSite <Role> Developer JUG <Description> Category
Deep view Booking date Enrollment date Payment date Invoice date
<Place> website <Role> Developer <Thing> Talk <Description> Category <Thing> Talk <Place> Room <Thing> Ticket <Event> Enrollment <Event> Conference <Event> Presentation <Event> Survey <Event> Invoice <Role> JUG <Role> Expert <Event> Payment
view and models more than you need unflexible flexible
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 Use JPA Problems Create Model
JPA and Domains n+1 Queries Lazy/ Eager JoinFetch Graphs
time to code
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://www.arquitecturajava.com