From System Design
Data Modeling
Data Modeling
Data Representations
Imagine you’ve been hired by a library to design their digital system. A library lends physical books to members. This system as one feature, and we want to build a data representation of this system.
What are the objects?
All objects have attributes, and optionally actions.
Entirely subjective, one example of objects here are members, books, and the library itself. Objects become tables. Columns must’t contain collections. (if there is a many <-> many relationship, create a new table)
Member
Attributes:
- name: string
- member_id: string
Actions:
- Can borrow a book
- Can return a book
Book
- book_id: string
- title: string
- author: string
- available: Boolean
Loan
- loan_id: string
- member_id: string
- book_id: string
- date_borrowed: Date
- date_due: Date
- date_returned: Optional(Date)