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

docs: policy for writing models #86

Open
Ivshti opened this issue Jul 28, 2019 · 1 comment
Open

docs: policy for writing models #86

Ivshti opened this issue Jul 28, 2019 · 1 comment
Milestone

Comments

@Ivshti
Copy link
Member

Ivshti commented Jul 28, 2019

the business logic should be handled entirely in the model, especially everything including mutability

the more logic we have in the models, the less of a chance there is for a logic mistake in the view code

e.g. notifications: which video is a notification should definitely be handled in the model

some thing are borderline: e.g. whether to expose a is_still_loading property (rather than see if one of the groups is still loading); in this case, we should not add the extra property, cause different views might decide to render a separate loader for each group (e.g. if the UI design gets changed)

when there is data that is closely related to what we have in the model, but can be retrieved from the context, then do so, at the expense of an extra copy; for example, each item in CatalogFiltered should be paired with a Option<LibItem>; even though this can be retrieved by the view (from the context), do not resort to that this is borderline too cause it might cause extra bugs, because we have to keep one additional thing up to date; another case like that is using Notifications model in the library view; also addons, where we sometimes need info from the manifest (addon name, behaviorHints) but the model exposes it's url (through ResourceRequest)


Document Effects and how effects work, and that you can loop a msg back into the system (see #54) by doing Effects::one(futures::ok(msg))

@borasemiz
Copy link

I guess you guys decided not to write documentations after all :)

@Stremio Stremio deleted a comment from rakira73 Jul 15, 2024
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

2 participants