Skip to content

Commit d78cf98

Browse files
committed
feat: write README and LICENSE
1 parent f33084d commit d78cf98

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 Makery, Kft.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Kotlin Composable Architecture
2+
3+
[![Kotlin](https://img.shields.io/badge/kotlin-1.3.72-orange)](https://kotlinlang.org/docs/tutorials/getting-started.html)
4+
[![@wearemakery](https://img.shields.io/badge/contact-@wearemakery-blue)](https://twitter.com/wearemakery)
5+
6+
The Kotlin Composable Architecture is a companion library for the amazing [Swift Composable Architecture](https://github.com/pointfreeco/swift-composable-architecture) created by [Point-Free](https://www.pointfree.co/). This implementation tries to mimic the original version's patterns and techniques, but because Swift and Kotlin have some fundamental differences, there are a few alternative design decisions. Eventually, we are aiming to provide the same ergonomics as the Swift implementation and full feature parity.
7+
8+
⚠️ **Please note that this repository is a work in progress; there is no stable release available.**
9+
10+
## What is the Composable Architecture?
11+
12+
This library provides a few core tools that can be used to build applications of varying purpose and complexity. It provides compelling stories that you can follow to solve many problems you encounter day-to-day when building applications, such as:
13+
14+
* **State management**
15+
<br> How to manage the state of your application using simple value types, and share state across many screens so that mutations in one screen can be immediately observed in another screen.
16+
17+
* **Composition**
18+
<br> How to break down large features into smaller components that can be extracted to their own, isolated modules and be easily glued back together to form the feature.
19+
20+
* **Side effects**
21+
<br> How to let certain parts of the application talk to the outside world in the most testable and understandable way possible.
22+
23+
* **Testing**
24+
<br> How to not only test a feature built in the architecture, but also write integration tests for features that have been composed of many parts, and write end-to-end tests to understand how side effects influence your application. This allows you to make strong guarantees that your business logic is running in the way you expect.
25+
26+
* **Ergonomics**
27+
<br> How to accomplish all of the above in a simple API with as few concepts and moving parts as possible.
28+
29+
## Alternative approaches compared to Swift
30+
31+
### Lack of value types
32+
33+
For now, the JVM doesn't have the concept of value types (this might change in the future with [Project Valhalla](https://openjdk.java.net/projects/valhalla/)). Thus, we cannot provide the reducer a mutable state safely, so it is required to return new copies of the state in case of any mutation. Kotlin's `data class` feature comes handy, as a `.copy()` methods get generated with named arguments for all properties.
34+
35+
### Less powerful enums
36+
37+
In Kotlin, enums cannot function as algebraic data types. We get to define a single type wrapped inside an enum, but each case cannot have an individual associated type. Instead, we can model actions with `sealed class` hierarchies.
38+
39+
### Lack of KeyPaths and CasePaths
40+
41+
The Swift compiler has a powerful feature: it generates `KeyPath`s for each struct in our application. Point-Free has implemented a companion library called [swift-case-paths](https://github.com/pointfreeco/swift-case-paths), which provides the same ergonomics for enums. The Swift Composable Architecture uses these two tools to abstract over getters and setters for state and action. In Kotlin, we don't have similar tools, so we rely on code generation through the [Arrow Meta](https://github.com/arrow-kt/arrow) library. Arrow has a module called Optics, which can be utilized to define `Lens`es and `Prism`s to substitute `KeyPath`s and `CasePath`s.
42+
43+
### Combine vs Coroutines
44+
45+
The Swift Composable Architecture is powered by Combine, which comes bundled with iOS SDK 13. The Kotlin Composable Architecture is relying on the Kotlinx Coroutines library. Stores are powered by `MutableStateFlow`, and effects are wrappers for coroutine `Flow`s.
46+
47+
## More info
48+
49+
For more information please visit the [Swift Composable Architecture repository](https://github.com/pointfreeco/swift-composable-architecture).
50+
51+
## License
52+
53+
This library is released under the MIT license. See [LICENSE](LICENSE) for details.

0 commit comments

Comments
 (0)