This repository contains sample code.
Its purpose being, to quickly demonstrate Android, Kotlin and software development in general. More so and amongst others, the main focus of this project is:
- Setup and Gradle configuration,
- Gradle modules,
- Clean architecture,
- Clean code,
- Best practices,
- Testing and
- All those other must know goodies.
Below is a list of goodies that are being showcased:
- Architectural Pattern
- Clean Architecture
(By employing clean architecture, you can design applications with very low coupling and independent of technical implementation details, such as databases and frameworks. That way, the application becomes easy to maintain and flexible to change. It also becomes intrinsically testable.)
- MVVM
(Model View ViewModel)
- ViewModel
(Architecture Components ViewModel Class)
- LivaData
(Architecture Components LiveData Class)
- Clean Architecture
- Libraries
- Dagger
(A fast dependency injector for Android and Java)
- RxJava
(RxJava – Reactive Extensions for the JVM – a library for composing asynchronous and event-based programs using observable sequences for the Java VM)
- Retrofit
(Type-safe HTTP client for Android and Java by Square, Inc.)
- GSON
(A Java serialization/deserialization library to convert Java Objects into JSON and back)
- Timber
(A logger with a small, extensible API which provides utility on top of Android's normal Log class)
- Dagger
- Android Support
- Constraint Layout
(A ConstraintLayout is a ViewGroup which allows you to position and size widgets in a flexible way)
- Card View
(A FrameLayout with a rounded corner background and shadow)
- Recycler View
(A flexible view for providing a limited window into a large data set)
- Constraint Layout
- Code Quality
- Android Lint
(The lint tool checks your Android project source files for potential bugs and optimization improvements for correctness, security, performance, usability, accessibility, and internationalization)
- Detekt
(Static code analysis for Kotlin)
- Android Lint
- Tests
- JUnit
(A programmer-oriented testing framework for Java)
- AssertJ
(AssertJ is a library providing easy to use rich typed assertions)
- Mockito Kotlin
(Using Mockito with Kotlin)
- Robolectric
(Android Unit Testing Framework)
- JUnit
- Debug
- LeakCanary
(A memory leak detection library for Android and Java)
- Strict Mode
(StrictMode is a developer tool which detects things you might be doing by accident and brings them to your attention so you can fix them)
- LeakCanary
- Plugin
- Gradle Versions
(Gradle plugin to discover dependency updates)
- Dexcount Gradle
(A Gradle plugin to report the number of method references in your APK on every build)
- Gradle Versions
Use the below command to build the project in order to install it on an Android device for demonstration:
gradlew clean build -x check
Or faster yet and targeting a specific build type (in our case the debug build type):
gradlew clean assembleDebug
Open an emulator or connect a physical device to experiment with the sample app, use the below command, which first uninstalls and then installs the sample app:
gradlew uninstallDebug | gradlew installDebug
Or faster yet, target a specific device (in our case an emulator):
adb -s emulator-5554 uninstall io.petros.reviews |
adb -s emulator-5554 install presentation\build\outputs\apk\debug\presentation-debug.apk
Use this command in order to run the static code analysis for the project:
gradlew check -x test
Or if you want to be more specific, run the below commands to run the code quality tool or your choice (in isolation):
gradlew lintDebug
gradlew detektCheck
Run the project unit tests using this command (this includes Robolectric):
gradlew test
Or if you want to be more specific, run the below commands to run the tests or your choice (per module):
gradlew domain:test
gradlew data:testDebugUnitTest
gradlew presentation:testDebugUnitTest
Below is a list of all those I WISH I HAD MORE TIME TO DO
future technical enhancements:
- Espresso tests (preferable with the Robot pattern). See
MET
comment which stands forMissing Espresso Tests
- Integration tests (preferable with MockWebServer). See
MIT
comment which stands forMissing Integration Tests
- Missing Robolectric tests. See
MRT
comment which stands forMissing Robolectric Tests
- Missing Unit tests. See
MUT
comment which stands forMissing Unit Tests
- Small, medium and large screen considerations.
- UI changes during screen rotations.
- Other lifecycle related edge case events.
Furthermore, below is a wish list of all those I REALLY WANNA DO, AND WILL DO AT SOME POINT
future architecture
and library enhancements:
- Enhance MVVM with MVI. To get an understand of MVI and how it applies to MVVM (or MVP), start with this article
MVI
(Model-View_Intent, is an architecture enhancment that tries to solve the state problem, which most complex application have, especially when the screen complexity grows)
- Replace Dagger with Koin. For more info, see Koin
(A pragmatic lightweight dependency injection framework for Kotlin)
- Replace RxJava with Coroutines. For more info, see Coroutines
(Coroutines simplify asynchronous programming by putting the complications into libraries. The logic of the program can be expressed sequentially in a coroutine, and the underlying library will figure out the asynchrony for us)
- Replace Manual Navigation with the Navigation Architecture Component. For more info, see
Navigation Architecture Component
(The Navigation Architecture Component simplifies the implementation of navigation in an Android app)
- Replace Manual Pagination with the Paging Architecture Component. For more info, see
Paging Architecture Component
(The Paging Library makes it easier for you to load data gradually and gracefully within your app's RecyclerView)
- Add Offline Support with Room. For more info, see Room
(The Room persistence library provides an abstraction layer over SQLite to allow for more robust database access while harnessing the full power of SQLite)
- Upgrade JUnit4 to SPEK Framework and JUnit5. For more info, see SPEK
(A specification framework for Kotlin)
and JUnit5(JUnit 5 is the next generation of JUnit)
- Replace Gradle Groovy with Kotlin DSL. For more info, see Gradle Kotlin DSL
(Kotlin language support for Gradle build scripts)
- Replace Manual Android Extensions with Android KTX. For more info, see
Android KTX
(Android KTX is a set of Kotlin extensions that is part of the Android Jetpack family)
- Replace current package structure to the new AndroidX package structure. For more info, see
AndroidX
(A new package structure to make it clearer which packages are bundled with the Android operating system, and which are packaged with your app's APK)
- Last but not least, convert the whole thing to Flutter!
JUST KIDDING 😛 ...OR AM I!
THANK YOU