https://kotlinlang.org logo
#android-architecture
Title
# android-architecture
m

Madalin Valceleanu

03/18/2020, 8:20 AM
📚 Android Sample App using modular, clean, scalable, testable Architecture written in Kotlin that presents modern 2019 approach to Android application development, latest tech-stack and best practices. Application is based, apply and strictly complies with each of the following 5 points: • A single-activity architecture, using the Navigation component to manage fragment operations. • Android architecture components, part of Android Jetpack give to project a robust design, testable and maintainable. • Pattern Model-View-ViewModel (MVVM) facilitating separation of development of the graphical user interface. • S.O.L.I.D design principles intended to make software designs more understandable, flexible and maintainable. • Modular app architecture allows being developed features in isolation, independently from other features. For more technical details please check the project readme. Project link: https://github.com/VMadalin/kotlin-sample-app
a

Ahmed Ibrahim

03/18/2020, 9:10 AM
I'm wondering what's the difference between spotless, ktlint and detekt, ain't they're all doing the same job in formatting the code?
m

Madalin Valceleanu

03/18/2020, 11:32 AM
Under my point of view the most complete is spotless because it’s like a wrapper where you can integrate different tools like detekt.
In my case I use: •  spotless for files copyright • detekt for code style defining rules on config file •  ktlint I use for formatting, it have rules by default but it’s complete like detekt
a

Ahmed Ibrahim

03/18/2020, 11:36 AM
For me I use detekt primarily because it catches code smells along with code-formatting errors.
m

Madalin Valceleanu

03/18/2020, 11:39 AM
Of course the most complete it’s detekt but you can combine it with spotless having more file options like copyright and etc..
a

Ahmed Ibrahim

03/18/2020, 11:39 AM
I see, thanks for the insights 👍
😉 2
i

Ianmedeiros

03/18/2020, 9:03 PM
do you have a circular dependency between the app and the features?
Another thing: doesn’t your BaseFragment crashes when restoring from onSaveIntanceState ? Can you pass the layoutId as a parameter in the constructor like this? As far as I know, this constructor will not be invoked when the system restores the state. Maybe if you store it when onSaveInstanceState is called.. but this seems odd to me.
m

Madalin Valceleanu

03/22/2020, 2:27 PM
Thanks for your questions @Ianmedeiros my apologise for the delay. Regard the circular dependency isn’t exist because by default when you declare on
:app
gradle the
dyncamic-feature
the android create a tipe of relationship between these modules but is not considered as a direct dependency because in opposite case the project don’t compile
About the possibility to crash because I used the constructor to get the layoutId that isn’t true. Remember that
onCreate
is invoked only one time following the
lifecycle
and for the application it’s irelevand how you provide it (as constant, from another class, or etc..)
i

Ianmedeiros

03/23/2020, 8:45 PM
This is not true for process death when android claims memory.
It will call onCreate again with savedInstanceState != null
v

Vishal Choudhary

03/31/2020, 6:41 PM
@Madalin Valceleanu You are using dynamic features throughout the app, Official documentations says you shouldn't ship more than 10 dynamic features as 'available at install time'. what to do if there are more than 10 features?
m

Madalin Valceleanu

03/31/2020, 6:49 PM
Thanks for your question @Vishal Choudhary, I think that it’s so important to know how to divide them and that it’s for you/business a feature. For example login implies also the register part ? . In any case you have a option to declare a feature as non-dynamic
v

Vishal Choudhary

03/31/2020, 9:42 PM
Thanks for the answer, @Madalin Valceleanu. 🙂 and Thanks for the sample project, it's really helpful. also I wanted to clarify, would it be wrong if I wrote some home module related code in app module followed by other secondary code as features module, will it be anti-pattern?
3 Views