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

Use class in /core models #100

Open
6 tasks
snamiki1212 opened this issue Jul 16, 2021 · 2 comments
Open
6 tasks

Use class in /core models #100

snamiki1212 opened this issue Jul 16, 2021 · 2 comments

Comments

@snamiki1212
Copy link
Owner

snamiki1212 commented Jul 16, 2021

Overview

In terms of the model of core logic in Plangoab, we implemented using not a class but plain JS object because of reason as part of some experiment.
However, I finally realized this way is absolutely inferior so going to replace it.
https://github.com/snamiki1212/plangoab/blob/main/doc/ARCHITECTURE.md#no-class-but-function

Packages

Choosing below pkg because of handling with Object immutably.

State of Redux

The state of redux can only plain js object so need to convert instance and plain js object when to input/output.

Persist of Redux

  • Plangoab keeps state persistently with redux-persist so I need to make an adjustment of stakeholders before going on this task or deploy.

Targets

  • ARCHITECTURE.md
  • /calendar
  • /event
  • /resource
  • /story
@snamiki1212 snamiki1212 pinned this issue Jul 16, 2021
@snamiki1212
Copy link
Owner Author

snamiki1212 commented Jul 21, 2021

Once I tried to replace Plain JavaScript Object to Class but it didn't work because we need to think more and a ready for replacing it. I'm listing below what we have to do before going on.

1. Transformer Layer

Redux cannot handle instances of the class so has to use Plain JavaScript Object. UI layer will use Class so we have to create Transform Layer between UI Layer and Redux Layer.

2. Refactor reducer to be a pure function

To begin with, as best practice, reducer should be a pure function( at least should be referential transparency). But, some reducer has a dependency of Model that's meaning we need refactor before replacing tasks. Otherwise, I need to handle complicated tasks when replacing tasks so I want to split each task into small and tackling before going on.


Transformer

@snamiki1212
Copy link
Owner Author

  1. Refactor reducer to be a pure function

#99 Done through developing test, as well as fixed to be referencial transparency at least.
So we can start this task whenever.

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