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

Which should be designed first, the data model or the domain model

Yusuke Tamura
March 20, 2024
60

Which should be designed first, the data model or the domain model

This is the presentation material for the 10th Try English LT! for engineers on Monday, 2024/03/18.

https://try-english-lt.connpass.com/event/308327/

Yusuke Tamura

March 20, 2024
Tweet

Transcript

  1. @ 2024 Novasell, Inc. All Rights Reserved.   Which should be

    designed first,     Data Model or Domain Model? 2024/03/18 Try English LT! for engineers 第10回 NOVASELL.INC Tamtam 1
  2. @ 2024 Novasell, Inc. All Rights Reserved. Introduction GitHub: @tamtam-fitness,

    X: @TamtamFitness, Zenn: Tamtam I’m Tamtam, japan-born-and-raised 💪 Currently working at RAKSUL/NOVASELL📃📺
  3. @ 2024 Novasell, Inc. All Rights Reserved. https://techblog.raksul.com/ RAKSUL TechBlog

    社員インタビュー https://recruit.raksul.com/story/archives/engineer/ RAKSUL Introduction RAKSUL 公式connpass https://raksul.connpass.com/ https://www.youtube.com/channel/UCyihWcvrHmE e-edcqdcJFsQ/ RAKSUL 公式YouTube RAKSUL 公式X https://twitter.com/raksuldev Find out more about RAKSUL
  4. @ 2024 Novasell, Inc. All Rights Reserved. 4 Table Of

    Contents 1. What is Data Model 2. What is Domain Model 3. Relationship between Data Model and Domain Model 4. Which should be designed first, Data Model or Domain Model
  5. @ 2024 Novasell, Inc. All Rights Reserved. 6 What is

    Data Model Model for managing structured records of business activities, within the area of solving problems for the user interest データモデリングでドメインを駆動する ――分散∕疎結合な基幹系システムに向けて
  6. @ 2024 Novasell, Inc. All Rights Reserved. 7 within the

    area of solving problems, not the problem itself Records are used for controlling solutions to problems not just persisting them . データモデリングでドメインを駆動する ――分散∕疎結合な基幹系システムに向けて
  7. @ 2024 Novasell, Inc. All Rights Reserved. 8 Controlling solutions

    to problems not just persisting them example: If you do not merely manage current stock but also future stock numbers, you can make order decisions based on the future.
  8. @ 2024 Novasell, Inc. All Rights Reserved. 9 for the

    user interest Out of the target of what is not in the user's interest. examples of out of target: - Whether surrogate keys are used or not - Whether NoSQL or RDB is used データモデリングでドメインを駆動する ――分散∕疎結合な基幹系システムに向けて
  9. @ 2024 Novasell, Inc. All Rights Reserved. 10 Range of

    Data Modeling compared to DB Design It depends on whether it affects the user or not . Scope of Data Model: - Conceptual model design: creation of the so-called ERD - Design of the conceptual schema of the logical design - Composition of primary keys definition of foreign keys, etc. データモデリングでドメインを駆動する ――分散∕疎結合な基幹系システムに向けて
  10. @ 2024 Novasell, Inc. All Rights Reserved. 12 What is

    Domain Domain is the scope of the business example: - For accounting software, the domain is accounting operations
  11. @ 2024 Novasell, Inc. All Rights Reserved. 13 Domain Model

    ≠ Model of the scope of the business Domain model is a model of tools for solving domain problems example: Git as a tool, cannot be designed simply to copy the domain of source code control. データモデリングでドメインを駆動する ――分散∕疎結合な基幹系システムに向けて
  12. @ 2024 Novasell, Inc. All Rights Reserved. 14 Domain model

    is a mental model      commonly recognised by stakeholders Model as a common understanding, which is realized at each interest of stakeholder. example: - GraphQL schemas, DB schemas, domain layer objects - User, Engineer , etc データモデリングでドメインを駆動する ――分散∕疎結合な基幹系システムに向けて
  13. @ 2024 Novasell, Inc. All Rights Reserved. 15 Only Domain

    layer does not own Domain Model Domain layer object copys the complex calculation processes of the domain model. Do not confuse the domain model involving all stakeholders with the domain layer objects of implementation interest .
  14. @ 2024 Novasell, Inc. All Rights Reserved. 18 Which should

    be designed first Data Model or Domain Model
  15. @ 2024 Novasell, Inc. All Rights Reserved. 19 Better to

    go ahead with the design of the data model which is an early process in the design of the domain model (Imagine Data-centric approach)
  16. @ 2024 Novasell, Inc. All Rights Reserved. 20 Conventional Approach

    DB schema - depends on Class - is susceptible to change データモデリングでドメインを駆動する ――分散∕疎結合な基幹系システムに向けて
  17. @ 2024 Novasell, Inc. All Rights Reserved. 21 Data-centric approach

    Data Model - makes them depend - makes DB schema stable データモデリングでドメインを駆動する ――分散∕疎結合な基幹系システムに向けて
  18. @ 2024 Novasell, Inc. All Rights Reserved. 22 How to

    go ahead with the design of Data Model 1. Understand existing domains and gather solutions 2. Extract main entities from the overall 3. Define Data Model ( as a part of Domain Model ) 4. Organize DB design and other parts of the Domain Model, etc.
  19. @ 2024 Novasell, Inc. All Rights Reserved. 23 Reference •

    データモデリングでドメインを駆動する ――分散∕疎結合な基幹系システムに向けて • 現場で役⽴つシステム設計の原則 〜変更を楽で安全にするオブジェクト指向の実践技法 • エリック‧エヴァンスのドメイン駆動設計