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

Data: FileDao #57

Open
1 of 3 tasks
lhaze opened this issue Aug 21, 2019 · 1 comment
Open
1 of 3 tasks

Data: FileDao #57

lhaze opened this issue Aug 21, 2019 · 1 comment

Comments

@lhaze
Copy link
Collaborator

lhaze commented Aug 21, 2019

Create a simple DAO, which can be a little enhancement to InMemoryDao:

  • loads its contents from a file serialization, e.g. yaml, json, ini
  • returns immutables (which is good, right?)
  • don't allow to mutate the data (LSP abuse?)
@lhaze lhaze added this to the 0.1 milestone Aug 21, 2019
@lhaze lhaze self-assigned this Aug 21, 2019
lhaze added a commit that referenced this issue Aug 25, 2019
* FileDao basic implementation
* pca/data/dao refactorization, split into a package
* pca/utils/serialization refactorization, split into a package and some
  additional coverage
lhaze added a commit that referenced this issue Aug 26, 2019
lhaze added a commit that referenced this issue Aug 26, 2019
... & a loophole inside `sget` structure get found
@lhaze
Copy link
Collaborator Author

lhaze commented Aug 27, 2019

Ok, being rightful to Liskov Substitution Principle (LSP), we shouldn't make FileDao a subclass of InMemoryDao in spite of all the similarities between them. If FileDao is to represent immutable contents of a config file, all the mutating methods of IDao/IQueryChain are becoming fruitless and should be turned into raise NotImplementedError. On the other hand, this solution makes subclassing breaking the LSP -- you can't use any method that would update the DAO contents, which as a result would force the developer of the Repository to know what type of DAO will be used and that is contrary to the DI pattern.

One can conclude that either FileDao entries as mutable, or we have to make IReadOnlyDao/IReadOnlyQueryChain and to make sure that DI pattern recognizes subclassing between fields:

dao: IReadOnlyDao == TinyDbDao()  # or sth like that

Acceptance criteria for this issue are to be described later.

@lhaze lhaze modified the milestones: 0.1, 0.2, 0.3 Dec 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant