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

Welcome new Android components and architecture #2351

Open
11 of 19 tasks
davigonz opened this issue Nov 12, 2018 · 0 comments
Open
11 of 19 tasks

Welcome new Android components and architecture #2351

davigonz opened this issue Nov 12, 2018 · 0 comments

Comments

@davigonz
Copy link
Contributor

davigonz commented Nov 12, 2018

Android is getting more mature and modern and it would be great to start using some of the next technologies to make the ownCloud Android app more robust, testable and future-proof:

Besides, we will modularize the app in different layers

You can find all the sections below more widely describe in:

From MVC to MVVM + Android arch components

3 -New-arch-get-public-shares

Modularization with layers approach

4_-ownCloud-Android-app-modularization

ownCloud modularization (updated)

  • Advantages:

    • Scalability: several developers working independently in different modules.
    • Maintainability: gradle can build modules faster since the classes and resources are separated in different modules. CI builds will be accelerated too.
    • Less tests to run when there's a new change: we need to run the tests in the module affected by that change and anything else that depends on it. We do not need to run all the tests if other modules are not impacted by the changes.
    • Reduce dependencies => less coupled code.
    • SWITCH MODULES: if in the future we want an app with a different UI and a different way to handle the information to show, we would just need to replace the :ownCloudApp module. And the same for the rest of modules, if one day we want to handle data differently to the current implementation, replacing the :ownCloudData module should be enough.
  • Key points:

    • Domain should not depend on data layer directly, use repository interfaces created in domain layer.
  • I/0 '19 talk: https://youtu.be/PZBg5DIzNww

New error and data handling

  • RemoteOperationResult object will not longer appear above data layer, the remote datasources will retrieve data or throw new exceptions to upper layers.
  • These new exceptions will be encapsulated in a UseCaseResult object in domain layer.
  • Datasources should retrieve domain model objects, transforming them from data model objects. Example: Data layer working with ShareEntity and transforming it to Share before pushing it to upper layers.
  • ViewModels will handle UseCaseResult objects and transform the information contained there in new UIResult objects.

New data and error handling

Dependency graph

I've found an open source tool called Apk dependency graph that could help us to follow the decoupling process.

This is how the dependency graph for the ownCloud Android app looks like, based on New arch - capabilities branch (I put it live in https://davigonz.github.io/oCAndroidDependencyGraph/ so everyone can play with it) :

Screenshot 2019-04-24 at 18 31 14

Above we can notice some parts of new architecture (OCShareRepository, OCShareViewModel, OCCapabilityRepository, OCCapabilityViewModel...) along with old code.

And below there's an example of a good architecture with low class coupling:

Screenshot 2019-04-24 at 18 33 25

Taking into account this diagram while working on the new architecture would be great and will allow us to have a higher level vision and complete the whole app transformation process.

So we could use this issue as an epic and create possible changes that come to our mind after having a look at the diagram.

Note: the diagram is currently hosted as a webpage in https://davigonz.github.io/oCAndroidDependencyGraph/ and it uses this repo but we could move it with the rest of ownCloud repositories and even update the diagram via some kind of script included in bitrise (not sure if is possible, need to be checked) and have it updated with new arch changes.

Initial tasks

CC / @jesmrec @michaelstingl

Issues to have a look at

#1447

Code enhancements

@davigonz davigonz added this to the 2.10.0 milestone Nov 12, 2018
@davigonz davigonz self-assigned this Nov 20, 2018
@davigonz davigonz mentioned this issue Dec 17, 2018
@davigonz davigonz changed the title Welcome new Android components [WIP] Welcome new Android components Dec 19, 2018
@davigonz davigonz added Epic and removed Epic labels Dec 19, 2018
@davigonz davigonz pinned this issue Jan 8, 2019
@jesmrec jesmrec modified the milestones: 2.10.0, 2.11.0 Jan 22, 2019
@pako81 pako81 unpinned this issue Jan 25, 2019
@davigonz davigonz changed the title Welcome new Android components Welcome new Android components and architecture Feb 21, 2019
@jesmrec jesmrec removed this from the 2.11.0 milestone Mar 5, 2019
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

3 participants