viamgr / trainingapp

trainingapp
0 stars 0 forks source link

Clean Architecture #24

Open ms-dehghani opened 9 months ago

ms-dehghani commented 9 months ago

We have "Forget password" page; in this page we have some of logic from "Register" page. In this topic we discuss about how to reuse our code and remove code duplicate.

pariami commented 9 months ago

I think we should do the ui section of the Forget Password page first and test it. Then, to add the data section, we can do each section in turn

ms-dehghani commented 9 months ago

Ok, let's talk about view model and page functionality. We should use multi view model with same functionality? I think we must separate functionality into classes and each class has their own functionality and use them in view models; for instance we separate validate email from view model and create single class for this function, this class get MutableStateFlow as parameter and after check, set value; i think with this we can use check email in any places without code duplication.

ms-dehghani commented 9 months ago

another solution is, separate individual function to class and create interface for them, out view model get this interfaces as parameter and work with them without any direct connection. I thin this tow options are same as some ways. maybe another solution exist and we must find that :)

pariami commented 9 months ago

In MVVM, with clean architecture, we create a use case for each function. This is the same as you said, meaning we have a separate class for each function. It is better to use the second method, which has a cleaner structure.

pariami commented 9 months ago

What should we do in order to be able to handle all cases in one issue? Should we make smaller issues and wait for the previous person to complete his work and then continue, or should we sync together at the same time?

ms-dehghani commented 9 months ago

With interfaces we don't need to wait until some one complete her/his work. after interfaces completed every one can start at same time.