Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Naming in DDD

Naming in DDD

Naming is one of the hardest things to do when coding. It helps us to make the code more readable and comprehensible. When you try to make code readable there are some existing rules but are they compatible with DDD ?

DDD and Naming share a common goal of helping communication between team members. In this Lighting Talk we will explain some concepts like Supple Design and Naming as a Process (@arlobelshee) to achieve this goal.

Khaled Souf

March 24, 2023
Tweet

More Decks by Khaled Souf

Other Decks in Technology

Transcript

  1. ‘There are only two hard things in Computer Science: cache

    invalidation and naming things.’ Phil Karlton @SepNamdar @KhaledSouf
  2. What is the naming? ‘specify (a sum, time, or place)

    as something desired, suggested, or decided on’ Oxford languages @SepNamdar @KhaledSouf
  3. Naming is @SepNamdar @KhaledSouf • A team activity • A

    set of rules • A tool to communicate Collaborative Modeling
  4. “A specification / title / index for a thing to

    understand what it does without going deep inside it.” our humble definition Naming is @SepNamdar @KhaledSouf
  5. Why naming? ‘Programs are meant to be read by humans

    and only incidentally for computers to execute.’ Donald Knuth @SepNamdar @KhaledSouf
  6. What is the intent, now ? What is the intent

    of the system (expressed as names) What are the use cases (expressed as verbs) All technical stuff @SepNamdar @KhaledSouf
  7. Repository BookRepository BookCollection 1 2 Books 3 Suffix Repository Suffix

    Collection Plural Library 4 Domain term @SepNamdar @KhaledSouf
  8. Repository BookRepository BookCollection 1 2 Books 3 Suffix Repository Suffix

    Collection Plural Library 4 Domain term @SepNamdar @KhaledSouf “Intention-Revealing Interfaces”
  9. Repository Implementation BookRepositoryImpl MongoBooks 1 2 BookData 3 Suffix Impl

    Prefix Type Plural FakeBooks InMemoryBooks HttpBooks FileBooks @SepNamdar @KhaledSouf
  10. Infrastructure Service RecruiterInfra or RecruiterMapping or RecruiterXXX Recruiters 1 2

    RecruitersCalendar 3 Technical Suffix Plural Domain Term @SepNamdar @KhaledSouf
  11. Infrastructure Service RecruiterInfra or RecruiterMapping or RecruiterXXX Recruiters 1 2

    RecruitersCalendar 3 Technical Suffix Plural Domain Term @SepNamdar @KhaledSouf “Intention-Revealing Interfaces”
  12. 3 - Technical names in Domain - class AbstractCar -

    List<String> carList - class PlayerImpl @SepNamdar @KhaledSouf
  13. 4 - Mixing contexts Sourcing - Skills - Source of

    Contact Candidate @SepNamdar @KhaledSouf
  14. 4 - Mixing contexts Sourcing - Skills - Source of

    Contact Interview - Skills - Name - Experiences - Soft Skills @SepNamdar @KhaledSouf Candidate
  15. 4 - Mixing contexts Sourcing - Skills - Source of

    Contact Interview - Skills - Name - Experiences - Soft Skills Contracting - Name - Address - Social Number - Salary @SepNamdar @KhaledSouf Candidate
  16. 4 - Mixing contexts Sourcing - Skills - Source of

    Contact Interview - Skills - Name - Experiences - Soft Skills Contracting - Name - Address - Social Number - Salary @SepNamdar @KhaledSouf Candidate Candidate Candidate
  17. 4 - Mixing contexts Sourcing Someone found on a recruitment

    network with a CV that matches search criteria Interview Someone who should be evaluated by a technical recruiter Contracting Someone who passed his interview successfully and will be integrated to the company @SepNamdar @KhaledSouf Candidate Candidate Candidate
  18. 4 - Mixing contexts Sourcing - Skills - Source of

    Contact Interview - Skills - Name - Experiences - Soft Skills Contracting - Name - Address - Social Number - Salary Prospect Candidate Employee @SepNamdar @KhaledSouf Prospect Candidate Employee
  19. Domain Model Final word @SepNamdar @KhaledSouf Ubiquitous Language Expressed as

    Documentation Expressed as Conversation Expressed as Diagram Expressed as Code The Truth
  20. ‘if you want me to talk for 60 minutes, give

    me 5 minutes to prepare; if you want me to talk for 5 minutes, give me a few hours to prepare’ Vaughn Vernon - Domain-Driven Design Distilled @SepNamdar @KhaledSouf Final word