Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is the storage of the Book attributes redundant? #66

Open
Michael1024-CJX opened this issue Nov 22, 2021 · 1 comment
Open

Is the storage of the Book attributes redundant? #66

Michael1024-CJX opened this issue Nov 22, 2021 · 1 comment

Comments

@Michael1024-CJX
Copy link

The values of some fields of BookDatabaseEntity are always the same, such as "available_at_branch" and "on_hold_at_branch" and "checked_out_at_branch", "on_hold_by_patron" and "checked_out_by_patron".

I can understand that these attributes have different meanings in the domain. but in terms of storage, is it feasible to map attributes with the same value to the same field, so that the number of fields can be reduced? For example, use "branch_id" and "patron_id".

class BookDatabaseEntity {
    UUID book_id;
    BookType book_type;
    BookState book_state;
    Instant on_hold_till;
    UUID branch_id;
    UUID patron_id;
    int version;
}

We can still judge the meaning of branch_id and patron_id through book_state.

@Michael1024-CJX
Copy link
Author

Can you explain the benefits of this redundant field design, there are many scenarios where this same value can be expressed as an attribute of different domain concepts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant