A thought experiment on architecture, object-oriented programming, and composability.

Overview

Journal3

CI Status Badge

There's barely anything special about the features that Journal3 is offering, it's literally yet another journaling application.

What is special about it though (or at least what I think is special about it) is that at the same time it's also a thought experiment; an avenue to explore the what-ifs.

What if there's a way to code an Android application without any architecture? Relying instead on the good ol' software engineering patterns and object-oriented principles?

What if there's a way to bring the power and flexibility of declarative programming to the domain?

What if we treat objects with respect instead of merely thinking of them as dumb containers of data?

Structure

I do not intend to apply any kind of architecture to Journal3 nor am I trying to enforce any patterns within it. However, there is a common structure that you would come to realize when diving deeper into the codebase.

  • UseCase as representation of business requirements/features
  • Event as the dominant way of inter-objects communication
  • Router as the primary enabler for navigation
  • Presenter as the renderer of objects (not to be confused with MVP)

One thing that I hope you'd also notice is that they are not necessarily architecture components, rather merely a byproduct of encapsulation.

Highlights

Contributing

Interested in joining this journey with me? Feel free to open up issues to start a discussion on anything related to Journal3. I also accept any kind of pull-requests that would help push this journey forward.

License

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.
Comments
  • BackgroundExecutingPresenter

    BackgroundExecutingPresenter

    https://github.com/MrHadiSatrio/Journal3/blob/30ff779807a5e171d9b86fb0d8e463836fa27039/app-android-journal3/src/main/kotlin/com/hadisatrio/apps/android/journal3/story/ViewStoriesActivity.kt#L52

    Could we do the same as BackgroundExecutingUseCase for the Presenter?

    enhancement 
    opened by rhmndnt 4
  • Why does BackgroundExecutingUseCase expect client to give Dispatcher.Default?

    Why does BackgroundExecutingUseCase expect client to give Dispatcher.Default?

    https://github.com/MrHadiSatrio/Journal3/blob/30ff779807a5e171d9b86fb0d8e463836fa27039/app-android-journal3/src/main/kotlin/com/hadisatrio/apps/android/journal3/story/ViewStoriesActivity.kt#L48

    This decorator's name suggests something like this:

    class BackgroundExecutingUseCase(
        private val coroutineScope: CoroutineScope,
        private val origin: UseCase
    ) : UseCase {
    
        override fun invoke() {
            coroutineScope.launch(Dispatchers.Default) { origin() }
        }
    }
    
    enhancement 
    opened by rhmndnt 3
  • Fix handling of illegal JSON characters during (de)serialization

    Fix handling of illegal JSON characters during (de)serialization

    What has changed

    We're now depending on JsonPrimitive#content to obtain raw string values within JsonFile.

    Why was it changed

    JsonElement#toString() will attempt to surround content with ", which we don't want. Simply removing those surrounding quotes manually is error-prone.

    opened by MrHadiSatrio 0
  • Enhance the API of coroutine-related decorators

    Enhance the API of coroutine-related decorators

    What has changed

    BackgroundExecutingUseCase is now named CoroutineDispatchingUseCase and explicitly requires the client to pass in a CoroutineDispatcher. Similarly, CoroutineDispatchingPresenter has also been added and replaces MainThreadExecutingPresenter.

    Why was it changed

    BackgroundExecutingUseCase is just misleading. For the rest it's just for the sake of symmetry on the API surface.

    Related issues

    • #1
    • #2
    opened by MrHadiSatrio 0
  • runBlocking

    runBlocking

    https://github.com/MrHadiSatrio/Journal3/blob/30ff779807a5e171d9b86fb0d8e463836fa27039/app-kmm-journal3/src/commonMain/kotlin/com/hadisatrio/apps/kotlin/journal3/story/ShowStoriesUseCase.kt#L50

    Allow me to query more detail about the usage reason of runBlocking here. AFAIK, the official documentation only encourages runBlocking in main functions and tests. It could be dangerous if we run this usecase on a single thread dispatcher like Dispatchers.Main.

    The same document also mentions "should not be used from a coroutine", meanwhile we decorate ShowStoriesUseCase using BackgroundExecutingUsecase that internally launches a coroutine.

    enhancement 
    opened by rhmndnt 1
  • UseCase == God Object

    UseCase == God Object

    As you have stated that UseCase is a representation of business requirements/features, is it necessary that we should only have 1-to-1 mapping between Activity/Screen/Feature and UseCase?

    question 
    opened by rhmndnt 1
  • PURE Architecture

    PURE Architecture

    I know you've clearly stated that you don't intend to apply any kind of architecture to Journal3, but if you do "PURE" would be a great name for this ­čśä Presenter-UseCase-Router-Event.

    documentation 
    opened by rhmndnt 1
Owner
Hadi Satrio
Android developer at Gojek.
Hadi Satrio
Ivy FRP is a Functional Reactive Programming framework for declarative-style programming for Android

FRP (Functional Reactive Programming) framework for declarative-style programming for Andorid. :rocket: (compatible with Jetpack Compose)

null 7 Sep 7, 2022
A repo to experiment with Continuation R, A implementations in Kotlin

A repo to experiment with Continuation R, A implementations in Kotlin

Simon Vergauwen 12 May 15, 2022
ShapeShift´ŞĆ - A Kotlin library for intelligent object mapping and conversion between objects

ShapeShift´ŞĆ A Kotlin library for intelligent object mapping and conversion between objects. Documentation Installation Maven Gradle Groovy DSL Kotlin

KRUD 107 Oct 2, 2022
Kotlin Object Notation - Lightweight DSL to build fluid JSON trees

Kotlin Object Notation Lightweight kotlin MPP DSL for building JSON trees Setup Just drop the dependency in your commonMain sourceSet kotlin { sourc

Martynas Petuška 42 Aug 28, 2022
Kotlin Android object for global applicationContext

ContextProvider Kotlin Android object for global applicationContext Usage In your Aplication class class YourApp : Application() { override fun o

PaulRB 0 Nov 4, 2021
EVMapper: Simple object mapper for Kotlin

EVMapper - Simple object mapper for Kotlin Simple mapping data class AData(val p1: Int, val p2: Int) data class BData(val p1: Int, val p2: Int) val a

Igor 8 Jan 24, 2022
A template that utilizes both Scala and Kotlin because why not (And also because I endorse programming hell)

Fabric-Scala-Kotlin-template A template that utilizes both Scala and Kotlin because why not (And also because I endorse programming hell) I don't care

null 1 Dec 25, 2021
Android utilities for easier and faster Kotlin programming.

Android utilities for easier and faster Kotlin programming. Download Gradle compile 'com.costular:kotlin-utils:0.1' How to use It depends on utilities

Diego Francisco Concepci├│n 50 Feb 8, 2022
Clean Code and Reactive Programming PlayGround for Bangkit 2021

Clean Code and Reactive Programming PlayGround for Bangkit 2021 Hello! This repo contains the IntelliJ project that I use to present my talk, "Clean A

raditya gumay 3 May 16, 2021
An example for who are all going to start learning Kotlin programming language to develop Android application.

Kotlin Example Here is an example for who are all going to start learning Kotlin programming language to develop Android application. First check this

Prabhakar Thota 56 Sep 16, 2022
Exercises for Functional Programming learning in Kotlin with Arrow

Exercises for Functional Programming in Kotlin with Arrow-kt Exercises and practice code for Functional Programming learning in Kotlin with Arrow Requ

Jack Lo 3 Nov 11, 2021
A pair of applications provide a direct means of integrating with one another via application programming interfaces (APIs)

What is a native integration? It's when a pair of applications provide a direct means of integrating with one another via application programming interfaces (APIs). Once integrated, data can flow between the apps and become more readily available to your employees.

Behruz Hurramov 2 Jan 17, 2022
Lambda-snake.kt - Snake Game Implementation for Web using Kotlin programming language compiled for Javascript

Projeto da disciplina de Linguagem de Programa├ž├úo Funcional 2021.1 (jan/2022) ??

Alex Candido 3 Jan 10, 2022
LifecycleMvp 1.2 0.0 Kotlin is MVP architecture implementation with Android Architecture Components and Kotlin language features

MinSDK 14+ Download Gradle Add to project level build.gradle allprojects { repositories { ... maven { url 'https://jitpack.io' }

Robert 20 Nov 9, 2021
Skeleton project for show the architecture of Android project using MVVM, Clean Architecture and Kotlin coroutine Flow

ClearScoreDemo Skeleton project for showing the architecture of Android project using MVVM, Clean architecture and Kotlin coroutine Flow App Architect

Plabon Modak 1 Mar 6, 2022
A fork of our clean architecture boilerplate, this time using the Android Architecture Components

Android Clean Architecture Components Boilerplate Note: This is a fork of our original Clean Architecture Boilerplate, except in this repo we have swi

Buffer 1.3k Sep 15, 2022
FaceTimeClone app that implements Coroutines , mvvm architecture , clean architecture , navigation component , hilt , etc.... using kotlin language

This repository contains a FaceTimeClone app that implements Coroutines , mvvm architecture , clean architecture , navigation component , hilt , etc.... using kotlin language

null 14 Aug 16, 2022
ATH Sample is a sample Authentication and Authorization Application with Kotlin Language and MVVM architecture.

ATH Sample ATH Sample is a sample Authentication and Authorization Application with Kotlin Language and MVVM architecture. Overview ATH Sample is a sa

AbolfaZl RezaEi 4 Jun 8, 2021