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

6 list persistance #11

Merged
merged 13 commits into from
Mar 13, 2023
Merged

6 list persistance #11

merged 13 commits into from
Mar 13, 2023

Conversation

tycebrown
Copy link
Collaborator

Here is a design overview:

  • Instead of directly storing a List, I've abstracted that into a class called ListModel, which can be directly put into an isar database.
  • Isar database work is abstracted into a static class called ListsDatabaseManager.

Some design questions/concerns:

  • At the current moment, the list model (and its items) are loaded "eagerly", so all the lists and their items are loaded at the start. Should the items and list model's metadata (such as the name of the list model) be loaded separately? Do you think an "eager" loading would seriously slow down the app?
  • All updates are eager (I couldn't find any way to schedule updates to happen at the termination of the app), so a slight change leads to the whole list model being re-put into the database. Would this slow down the app noticeably?
  • Are there any sloppy names that need to be fixed (like ListsDatabaseManager)?

@tycebrown tycebrown linked an issue Feb 22, 2023 that may be closed by this pull request
@Pertempto
Copy link
Owner

Here is a design overview:

  • Instead of directly storing a List, I've abstracted that into a class called ListModel, which can be directly put into an isar database.
  • Isar database work is abstracted into a static class called ListsDatabaseManager.

Some design questions/concerns:

  • At the current moment, the list model (and its items) are loaded "eagerly", so all the lists and their items are loaded at the start. Should the items and list model's metadata (such as the name of the list model) be loaded separately? Do you think an "eager" loading would seriously slow down the app?
  • All updates are eager (I couldn't find any way to schedule updates to happen at the termination of the app), so a slight change leads to the whole list model being re-put into the database. Would this slow down the app noticeably?
  • Are there any sloppy names that need to be fixed (like ListsDatabaseManager)?

I think the current "eager" system should be fine for now. We can optimize later if we need. For ListsDatabaseManager, why not call it just DatabaseManager or DbManager?

Removed createListModel and createItem and replaced by with putListModel and putItem.

add was renamed to addOrUpdate

Finally, I change the remove and addOrUpdate functions in such a way so that they are now responsible for deleting and putting items to the database as well as creating links to them.

Love to hear thoughts.
Copy link
Owner

@Pertempto Pertempto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functionality is still working great! Just a few code-cleanup things I saw.

lib/model/list_model.dart Outdated Show resolved Hide resolved
lib/model/list_model.dart Outdated Show resolved Hide resolved
lib/model/database_manager.dart Outdated Show resolved Hide resolved
lib/model/database_manager.dart Outdated Show resolved Hide resolved
Copy link
Owner

@Pertempto Pertempto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good!

@Pertempto Pertempto merged commit cad167f into main Mar 13, 2023
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

Successfully merging this pull request may close these issues.

List Persistance
2 participants