Your SlideShare is downloading. ×

Introduction to-ddd

4,371

Published on

An introductory talk on Domain Driven Development. …

An introductory talk on Domain Driven Development.

Published in: Technology, Business
1 Comment
10 Likes
Statistics
Notes
  • Is there any recorded video available?
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total Views
4,371
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
119
Comments
1
Likes
10
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Domain Driven Designsoftware that reflects the business domain John Ferguson Smart
  • 2. So who is this guy, anyway? Consulta nt Trainer Mentor Author Speaker Coder John Fer guson S mar t
  • 3. What is Domain-Driven Design?
  • 4. Domain-driven design is not atechnology or a methodology.
  • 5. It’s a set of principles and patternsfor focusing design effort where itmatters most.
  • 6. Basic principles
  • 7. Basic principles Focus on the domain Domain design is based on a model
  • 8. Basic principlesA Ubiquitous Language... ...and a shared vision
  • 9. So what’s a model?
  • 10. How do you represent your domain model?
  • 11. How do you represent your domain model? Customer Account (UML) Diagrams? Branch
  • 12. How do you represent your domain model? Detailed specifications?
  • 13. How do you represent your domain model?Account Holder withdraws cashAs an account holderI want to withdraw cash from an ATMso that I can get money out when the bank is closed Scenario 1: Account has sufficient funds Given the account balance is $100 And the card is valid And the machine contains enough money Free text? When the Account Holder requests $20 Then the ATM should dispense $20 And the account balance should be $80 And the card should be returned Scenario 2: Account has insufficient funds Given the account balance is $10 And the card is valid And the machine contains enough money When the Account Holder requests $20 The ATM should not dispense any money
  • 14. How do you represent your domain model? @Test public void aCashWithdrawalShouldDeductSumFromBalance() { Account account = new Account(); account.makeDeposit(100); account.makeCashWithdraw(60); assertThat(account.getBalance(), is(40)); } Automated tests?
  • 15. How do you represent your domain model? class Account(val owner : Customer, val accountNumber : String, val accountType : AccountType, var balance : Double) { def deposit(amount : Double) { balance += amount } def withdraw(amount : Double) { balance -= amount } } Code? class Customer(val firstName : String, val lastName : String) { createAccount(accountType : AccountType) : Account } class AccountType extends Enumeration { val Current = value("CURRENT") val Savings = value("SAVINGS") }
  • 16. The model is the mental representation Everything else is just a communication tool
  • 17. Elaborating the model
  • 18. Elaborating the modelA collaborative exercise
  • 19. Elaborating the model...based on a common language
  • 20. Elaborating the modelAccount Holder withdraws cashAs an account holderI want too withdraw cash from an ATMso that I can get money out when the bank is closed @Test public void aCashWithdrawalShouldDeductSumFromBalance() { Account account = new Account(); account.makeDeposit(100); account.makeCashWithdraw(60); assertThat(account.getBalance(), is(40)); } ...and expressed at all levels
  • 21. Elaborating the modelAn evolutionary process
  • 22. Elaborating the model So testing is essential
  • 23. Elaborating the model Test...automated testing is essential
  • 24. Domain-Driven Design practices
  • 25. Domain-Driven Design architecture User Interface Presenta(on  Layer Service layer Applica(on  Layer Stateless domain knowledge and Domain  Layer business logic supporting libraries Infrastructure  Layer persistence messaging
  • 26. Domain-Driven Design architecture Entities • Identify and state • Persistence
  • 27. Domain-Driven Design architecture Value  Objects • No conceptual identity • Immutable
  • 28. Domain-Driven Design architecture Services • Domain-level services • Stateless
  • 29. Domain-Driven Design architecture Repositories • Data retrieval • Abstraction of the persistence layer
  • 30. Domain-Driven Design architecture Factories • Creation of complex entities
  • 31. Application code should be areflection of the business domain John  Ferguson  Smart Email:  john.smart@wakaleo.com Web:  hAp://www.wakaleo.com TwiAer:  wakaleo

×