{"id":17248949,"url":"https://github.com/pakoito/functionalandroidreference","last_synced_at":"2025-05-10T21:14:55.553Z","repository":{"id":39617532,"uuid":"68816982","full_name":"pakoito/FunctionalAndroidReference","owner":"pakoito","description":"Showcase project of Functional Reactive Programming on Android, using RxJava.","archived":false,"fork":false,"pushed_at":"2019-08-05T08:54:54.000Z","size":489,"stargazers_count":274,"open_issues_count":0,"forks_count":17,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-03-31T21:42:46.054Z","etag":null,"topics":["android","functional-reactive-programming","kotlin","rxjava"],"latest_commit_sha":null,"homepage":"http://tinyurl.com/RxDroidcon16","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pakoito.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-09-21T12:58:22.000Z","updated_at":"2024-11-22T20:03:45.000Z","dependencies_parsed_at":"2022-09-16T14:01:59.743Z","dependency_job_id":null,"html_url":"https://github.com/pakoito/FunctionalAndroidReference","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pakoito%2FFunctionalAndroidReference","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pakoito%2FFunctionalAndroidReference/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pakoito%2FFunctionalAndroidReference/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pakoito%2FFunctionalAndroidReference/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pakoito","download_url":"https://codeload.github.com/pakoito/FunctionalAndroidReference/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253316125,"owners_count":21889473,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","functional-reactive-programming","kotlin","rxjava"],"created_at":"2024-10-15T06:42:31.705Z","updated_at":"2025-05-09T19:49:01.198Z","avatar_url":"https://github.com/pakoito.png","language":"Kotlin","readme":"# FunctionalAndroidReference\n\nFunctionalAndroidReference is a showcase project of Functional Reactive Programming on Android, using RxJava.\n\nIt's a companion app to the presentation [\"Fully Reactive Apps\"](https://speakerdeck.com/pakoito/fully-reactive-apps-extended) at Droidcon UK 2016.\n\n[![Build Status](https://travis-ci.org/pakoito/FunctionalAndroidReference.svg?branch=master)](https://travis-ci.org/pakoito/FunctionalAndroidReference) [![codecov](https://codecov.io/gh/pakoito/FunctionalAndroidReference/branch/master/graph/badge.svg)](https://codecov.io/gh/pakoito/FunctionalAndroidReference)\n\nIt is not meant to be a canonical reference, but as an example of how far functional programming can be taken. It's also a collection of patterns and ideas about how to express use cases, business features, and UX on a FRP paradigm.\n\nThe project has multiple self-imposed limitations:\n\n### Full separation between UI and business logic.\n\nThe project is split into several modules. Every module has its own README file.\n\n#### app\n\nThe UI layer is written purely in Java 7 with Android dependencies.\n\nIt depends on all modules below.\n\n#### liblogic\n\nThe business logic that controls the views. It doesn't contain any Android dependency.\n\nIt is written in Kotlin for convenience, but it could be rewritten in Java 7 with ease, although it will be a bit verbose without lambdas (see [retrolambda](https://github.com/orfjackal/retrolambda)).\n\nIt depends on the modules below.\n\n#### libservices\n\nAny network services, POJOs, and communications that aren't in the Android framework. Again, it's not dependent on any Android.\n\nWritten in Kotlin too.\n\nIt depends on the module below.\n\n#### libcore\n\nHelpers and common general types. No Android.\n\nWritten in Kotlin, with no Android dependencies.\n\n### Pragmatically functional\n\n* liblogic and libservices must contain as few classes as pragmatically possible. Favour functions instead.\n\n* Every function must be written as an expression body.\n\n* Every function must be as pure as possible.\n\n* Every parameter in a function must be passed explicitly. No globals, no fields.\n\n* Prefer encapsulating variables in closures rather than fields. If using fields, final fields will be mandated whenever possible.\n\n* Collections must be immutable.\n\n* No nullable types outside the UI and service layers.\n\n* Use functional patterns like unions, laziness, or higher order functions, instead of classic OOP Gang of Four patterns.\n\n### Fully reactive\n\nThe architecture is reminiscent of [Flux](https://facebook.github.io/flux/docs/overview.html), [Redux](http://redux.js.org/), or [Elm](https://guide.elm-lang.org/architecture/). This is no coincidence.\n\nEvery method in the **UI layer** is either:\n\n* a stream/signal, represented by a method returning an `rx.Observable`.\n\n* a new UI state: new text value, new element on a RecyclerView, show a dialog... represented by a void/`Unit` method.\n\nEvery function in the **business layer** is:\n\n* a `rx.Subscription` encompassing all the behaviour for one or many use cases.\n\n### Testable\n\nEvery use case must be accompanied of a test suite covering its complete behaviour.\n\n### Moderately documented\n\nEvery public function must be documented.\n\nInlined comments only when intent isn't clear.\n\n### No lifecycle\n\nSeparate the business logic from the Android lifecycle at the earliest layer possible.\n\n### No magic\n\nAvoid DI frameworks like Dagger, and hand-roll injection instead.\n\nAvoid code generation outside Kotlin helpers.\n\n## License\n\nCopyright (c) pakoito 2016\n\nThe Apache Software License, Version 2.0\n\nSee LICENSE.md\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpakoito%2Ffunctionalandroidreference","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpakoito%2Ffunctionalandroidreference","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpakoito%2Ffunctionalandroidreference/lists"}