Answer the question
In order to leave comments, you need to log in
Correct architecture of Android applications?
Please tell me where to learn how to write extensible, maintainable, and reliable code for android. It seems to me that there should be a universal approach that will allow you to effectively write 90% of applications, but for some reason I don’t see it in the Google documentation (Apple has such guidelines!). In order for the functionality to be divided into independent modules, and the modules to be divided by tasks (model, display, level of obtaining data from the cache, etc.), all data would need to be immutable, but there would be difficulties with storing the state.
Looking for:
- ready-made large open-source applications with maintainable and secure code (very lacking, with Rx - it would be great)
- courses, books on application architecture - but specifically in relation to android. It is clear that there are 100500 options, but I only need a few that effectively solve 99% of typical android problems.
Typical questions for which there are not enough answers:
- in which class to send network requests to display the list? And then transfer the data to the correct activity.
- where to cache the response - by means of retrofit / valley, in memory or in the model with handles?
- what will be the controller if the approach is MVC, and in practice should the activity only forward requests from the view to the correct custom controller? Where to store the state of which fragments are currently displayed?
Where is the right place to store constants? For example, a tag that contains data in the intent. When there are many classes, confusion already arises with these constants.
- If the model is not a singleton, then when, where and how should it be deleted from memory?
I know about Fernando , it is very useful, but not enough, there are no answers to many questions.
Answer the question
In order to leave comments, you need to log in
There is not enough information in your question to answer.
There will always be a question: the right architecture for what exactly?
IMHO, you should always keep in stock (and maintain) a pack of your architectural template projects, be aware of the pros / cons of this or that approach and apply it depending on the specifics of the project.
In most cases, the decision on architecture dances from the specific tasks of the project.
PS By the way, if you post your sub-questions here individually, you're more likely to get less abstract answers.
extensible, maintainable, and reliable code
Robert Martin - Clean code
Well, I can only advise you to read Fernando more carefully. He answers all the questions that you have given
. There is also a link to the project in which it is very clear how to use the Fernando architecture
I will add a couple more links:
https://medium.com /@dmilicic/a-detailed-guide-on-d...
From Habr article about VIPER for android with RX:
https://habrahabr.ru/company/rambler-co/blog/277003/
Try to stick to SOLID and your code will be modular, extensible and testable.
It will also be great if you break the application into modules (layers). For example, if you package all the work with network requests in a separate module (including work with Retrofit, for example), and provide interfaces for interacting with this module, then you can easily test it later. And if your code is testable, then your code will be easy to expand. Try to create a loosely coupled application architecture.
To summarize useful links:
A good parsing app is googleio schedule 2015 https://github.com/google/iosched. It is useful to study as an example.
An architecture example from Google is also useful https://github.com/yigit/dev-summit-architecture-demo
And an example from a free testing course https://github.com/googlecodelabs/android-testing
DI examples on Dagger2 https: //github.com/prolificinteractive/u2020 and https://github.com/LiveTyping/u2020-mvp
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question