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

Fix hierarchy of CommonDataEntity #113

Closed
vestrel00 opened this issue Nov 29, 2021 · 1 comment · Fixed by #114
Closed

Fix hierarchy of CommonDataEntity #113

vestrel00 opened this issue Nov 29, 2021 · 1 comment · Fixed by #114
Assignees
Labels
breaking change This may break integration of the library for some consumers refactor This may involve a refactor

Comments

@vestrel00
Copy link
Owner

vestrel00 commented Nov 29, 2021

While working on fixing #109, I noticed that there is no dedicated interface for immutable data.

For example, for Contacts the hierarchy is as follows,

ContactEntity
Contact : ContactEntity
MutableContact : ContactEntity

The MutableContact does NOT extend the immutable Contact. This allows a concrete distinction between mutable and immutable contacts. Consumers can do the following;

val contactEntity: ContactEntity
when (contactEntity) {
    is Contact -> handleImmutableContact()
    is MutableContact -> handleMutableContact()
}

However, for data, the hierarchy is as follows,

CommonDataEntity
MutableCommonDataEntity : CommonDataEntity

The MutableCommonDataEntity extends CommonDataEntity. We have no reliable way to know if a reference to a CommonDataEntity is actually immutable! This is prone to bugs such as #109 🤦

This needs to be fixed 🔥 🔥🔥🔥🔥🔥

@vestrel00 vestrel00 added the refactor This may involve a refactor label Nov 29, 2021
@vestrel00 vestrel00 self-assigned this Nov 29, 2021
@vestrel00 vestrel00 added the breaking change This may break integration of the library for some consumers label Dec 5, 2021
@vestrel00
Copy link
Owner Author

This is a part of v0.1.9 Release Checklist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change This may break integration of the library for some consumers refactor This may involve a refactor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant