Today, I am going to explain conceptual design process.
Purposes of this article creation
- To be able to create DB tables in MySQL in Ruby on Rails on my own.
- To be able to do Conceptual Design.
What is Conceptual Design
- An abstraction and representation of the information structure of the target world.
- Simply expressed, it is like “data visualization”.
【Three main levels of conceptual data models】
- BEV(Bird’s-eye view) data model: a model of entities only.
- Skeleton(Bones) data model: A model in which entities and major attributes are described.
- Detailed data model: a model in which all data items are described.
Conceptual Design Process
In this case, I will create Conceptual Data Model for a SNS task management application on Cacoo as a deliverable by using “Top-Down Approach”.
【Methods】
- Top-Down Approach:A method in which the entire database is considered first, and then it is progressively subdivided into smaller and smaller pieces.
- 1.Create ERD(Entity-Relationship Diagrams)
- 2.Identify Attributes
- 3.Normalization
→When new data is added, that is to say, new development, this method may be used more often.
※Originally, the process of “determining the type of database” is included in the first or third step of the top-down approach. In this case, I will use MySQL (RDBMS).
※Then, create a table definition that is converted into a form consistent with the database (Table Definition).
- Bottom-Up Approach:A method of identifying the actual data and gradually integrating it.
- 1.Identify Attributes
- 2.Normalization
- 3.Create ERD(Entity-Relationship Diagrams)
1. Create ERD(Entity-Relationship Diagrams)
- Create a rough ERD by identifying the entities (groups of data) necessary for the system to be created and considering their relationships and cardinality (relationship of numbers), etc.
- In this case, we will describe the ERD using IE notation(Information Engineering notation).
【Deliverables】
※This is for my own use.
2. Identify Attributes
- For each entity, identify necessary attributes (data items).
【Process】
- Identify Attributes
- Determine the primary key
※ Automatically assigns id as primary key in Ruby on Rails. ※Omit id and created_at, updated_at.
【Deliverables】
※This is for my own use. ※In this time, Omit “3. Normalization Process” because it has already been normalized.
3. Normalization
- Normalize the attributes identified (up to the 3NF).
- If there is a many-to-many association in the ERD, make it one-to-many.
【A little explanation of terms】
- About normalization
- Normalization:
- 1NF(First normal form):A method of separating the repeated parts of a table that extend horizontally in unnormalized form, arranging them vertically, and eliminating horizontal overlaps.
- 2NF: Separate duplicated data each time the details are repeated in the 1NF.
- 3NF:Separate the parts that can be further separated (Example:Related entity(Linked entity)).
【Deliverables】
※This is for my own use.
Deliverables(Conceptual Data Model)
※This is for public use.
Notes on the creation of conceptual data models.
- Supertype/Subtype
- Coexisting subtype(Note.)
- Exclusive subtype
- Normalization
- Relational schema should be normalized to 3NF.
- Naming Rules
- Entity type names should be appropriate names that give a concrete image of the entity(As much as possible, use the name as it is actually used.).
- One-to-one and many-to-many relationships
- Create a one-to-many relationship between entity types basically.
- The primary key of the one entity type is set as the foreign key of the many entity type.
- In a one-to-one relationship
- Set the primary key of either entity type as the foreign key of the other entity type.
- In the above, set a foreign key on the side where the instance will occur later, paying attention to the time(period) when the instance will occur basically.
- In a many-to-many relationship
- Since all attributes cannot be managed as they are, break them down into one-to-many relationships using connected(linked) entities.
- Create a one-to-many relationship between entity types basically.
References
[Data Modeling]
- 「データモデリングの技法」:https://ja.wikipedia.org/wiki/%E3%83%87%E3%83%BC%E3%82%BF%E3%83%A2%E3%83%87%E3%83%AA%E3%83%B3%E3%82%B0
- 「実体関連モデル」:https://ja.wikipedia.org/wiki/%E5%AE%9F%E4%BD%93%E9%96%A2%E9%80%A3%E3%83%A2%E3%83%87%E3%83%AB
[Conceptual Design]
- 「徹底攻略 データベーススペシャリスト教科書 令和3年度」:https://www.amazon.co.jp/%E5%85%A8%E6%96%87PDF%E3%83%BB%E5%8D%98%E8%AA%9E%E5%B8%B3%E3%82%A2%E3%83%97%E3%83%AA%E4%BB%98-%E5%BE%B9%E5%BA%95%E6%94%BB%E7%95%A5-%E3%83%87%E3%83%BC%E3%82%BF%E3%83%99%E3%83%BC%E3%82%B9%E3%82%B9%E3%83%9A%E3%82%B7%E3%83%A3%E3%83%AA%E3%82%B9%E3%83%88%E6%95%99%E7%A7%91%E6%9B%B8-%E4%BB%A4%E5%92%8C3%E5%B9%B4%E5%BA%A6/dp/4295009903/ref=tmm_pap_swatch_0?_encoding=UTF8&qid=&sr=
- 「概念・論理・物理データモデルの違いは人によって異なる?データ総研の考え方をご紹介」:https://jp.drinet.co.jp/blog/modeling_dri
- 「概念データモデルとER図って何だろう?」:https://itmanabi.com/conceptual-datamodel-er/
- 「システム企画に役立つ概念データモデル作成の基本」:https://atmarkit.itmedia.co.jp/ait/articles/0906/02/news109.html
※The conceptual data model provides a BEV(bird’s eye view) of the entire business activity.
[How to write ERD]
- 「ER図とは?書き方やテクニックをわかりやすく解説」:https://products.sint.co.jp/ober/blog/create-er-diagram
[Normalization]
- 「【関係データベースの正規化】第1正規形・第2正規形・第3正規形について紹介」:https://breezegroup.co.jp/202005/database-normalization/
- 「第三正規形」:https://www.sophia-it.com/content/%E7%AC%AC%E4%B8%89%E6%AD%A3%E8%A6%8F%E5%BD%A2#:~:text=%E7%AC%AC%E4%B8%89%E6%AD%A3%E8%A6%8F%E5%BD%A2%E3%81%A8%E3%81%AF%E3%80%81%E3%83%AA%E3%83%AC%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%8A%E3%83%AB%E3%83%87%E3%83%BC%E3%82%BF%E3%83%99%E3%83%BC%E3%82%B9%E3%81%AE%E3%83%87%E3%83%BC%E3%82%BF%E3%83%99%E3%83%BC%E3%82%B9,%E3%81%99%E3%82%8B%E3%81%93%E3%81%A8%E3%81%AB%E3%82%88%E3%81%A3%E3%81%A6%E8%A1%8C%E3%82%8F%E3%82%8C%E3%82%8B%E3%80%82
- 「データベースの正規化(第1〜第3正規形)」:https://tech.012grp.co.jp/entry/db_normalization
- 「第4回 データベースの正規化」:https://oss-db.jp/dojo/dojo_info_04
[Others]
- 「【初心者向け】丁寧すぎるRails『アソシエーション』チュートリアル【幾ら何でも】【完璧にわかる】🎸」:https://qiita.com/kazukimatsumoto/items/14bdff681ec5ddac26d1
Summary/What I learned this time
In this study, I learned about conceptual design using a top-down approach. In order to be able to design various systems, I must learn design methods and gain experience in actually designing systems. I want to become an engineer who can think about systems from the design stage, not just write code.