Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/devrath/NoteApp
ποΈ π²πππππππ π½ππππ πππ πππππππ πππ ππππ. π±ππππ ππ πΌπ
π
πΌ-πππππ πππππ ππππππππππππ π ππππ ππππππππ πππ π²πππ³ ππππππππππ ππ πππ ππππππππ
https://github.com/devrath/NoteApp
abstraction android clean-architecture clean-code coroutines coroutines-flow dagger-hilt jetpack-compose kotlin room-database uncle-bob
Last synced: 3 months ago
JSON representation
ποΈ π²πππππππ π½ππππ πππ πππππππ πππ ππππ. π±ππππ ππ πΌπ π πΌ-πππππ πππππ ππππππππππππ π ππππ ππππππππ πππ π²πππ³ ππππππππππ ππ πππ ππππππππ
- Host: GitHub
- URL: https://github.com/devrath/NoteApp
- Owner: devrath
- License: apache-2.0
- Created: 2023-02-04T07:13:18.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-02-11T04:57:17.000Z (over 1 year ago)
- Last Synced: 2024-07-11T14:46:05.302Z (4 months ago)
- Topics: abstraction, android, clean-architecture, clean-code, coroutines, coroutines-flow, dagger-hilt, jetpack-compose, kotlin, room-database, uncle-bob
- Language: Kotlin
- Homepage:
- Size: 3.47 MB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-list - devrath/NoteApp - ποΈ π²πππππππ π½ππππ πππ πππππππ πππ ππππ. π±ππππ ππ πΌπ π πΌ-πππππ πππππ ππππππππππππ π ππππ ππππππππ πππ π²πππ³ ππππππππππ ππ πππ ππππππππ (Kotlin)
README
![cover](https://github.com/devrath/NoteApp/blob/main/Assets/banner.png)
π½ππππ°ππ
ππππ πππππππ ππ π ππππππ ππππ πππππππππππ, πππππ π ππππ πππ ππππππ πππππ, πΌπππππ’ πππ ππ‘ππππππ πππππ πππ π³πππππ ππ‘ππππππ πππππ ππππππππππ πππ πππ π²πππ³ ππππππππππ. πππ πππππ πππ ππππππ ππ πππ ππππππ, π±ππππ ππ ππ πΌπ π πΌ-πππππ πππππ ππππππππππππ, πππ πππππππ ππ πππ ππππππππππππ πππ’ππ
## **`π²ππππ ππππππππππππ`** π
![architecture](https://github.com/devrath/NoteApp/blob/main/Assets/arc_note.drawio.png)## `ππππ ππ πππππ ππππππππππππ`
* Having one concern per component, Meaning each piece of our architecture does only one thing and nothing else. If one component is doing more than one thing, we need to split them
* It is structured layered dependency. It is not specific to mobile development instead its software development architecture.
* Clean architecture term comes from Uncle bob, He created this methodology for building software products.
* It actually uses existing architectures like `mvvm` and other and additionally uses `use-cases` etc
* It makes your applicaiton scalable majorly involves, how easy it is to replace a layer of application without breaking the other layers.
* A large code base comes with challenge of structuring it which involves how easy it is to extend it, test the functions in it, understand it## `π°πππππππππ ππ πππππ ππππππππππππ`
| **`Advantages`** | **`How its useful`** |
| --------------------- | ----------------------------------------------------------------------------------------------- |
| `Strict architecture` | Because of how the layers of code are organized it is not easy to make mistakes |
| `Encapsulation` | Each layer is organized into its own part having its own responsibility |
| `Parallel development`| If we have each feature in module wise each of the modules are built parallely |
| `Highly scalable` | Once organized properly, we can grow a small project into large one without bumping to problems |
| `Simple and easy` | Due to single responsibility its way easier to understand each snipped of code on what it does |
| `Testing` | Since all the layers are decoupled, we can write unit tests on them easily |## `ππΎπ»πΈπ³ - ππππππππππ`
ππππππ ππππππππππππππ’ πππππππππ
* A class should have only one job.
* A class should have only one reason to change.
* If the class has two reasons to change, Then the class has to be split up into two components.πΎπππ π²πππππ πππππππππ
* It should be open for extension, but closed for modification.
* If new functionality needs to be added, it should be added as an extension of the class.
* This allows us to abstract the stable functionality.
* If functionality is working and stable and we add a new feature on top of the existing feature for it. Now we will have stable functionality always working.
* Thus the volatile functionality will be in the extended classes and the stable functionality in the extended classes.π»πππππ ππππππππππππ πππππππππ
* Lower level classes can be substituted without affecting higher levels.
* This is achieved using abstract classes and interfaces.πΈππππππππ πππππππππππ πππππππππ
* We use an interface to advertise the functionality.
* Many specific interfaces are better than a generic interface.
* Interface just exposes the methods the dependent classes needed and nothing else.π³πππππππππ’ πππππππππ πππππππππ
* Concrete classes depend on abstract classes and not the other way around.
* Volatile and stable functionalities are encapsulated, having the dependency relationship between the two.
* Framework-specific functionality depends on business logic with a dependency between them.## `π»ππ’πππ ππ πππππππ ππππππππππππ`
![architecture-layers](https://github.com/devrath/NoteApp/blob/main/Assets/diagram_Notes.drawio.png)## `πΌπππ π½ππππ`
ππππππππππ’:
* Here in the project we have database, We use the database and call the functions of DAO in our repository.
* The repository directly accesses our datasources, wither API or database.
* The repository takes these datasources and determine which data has to be forwarded to the corrosponding use-cases.
* Say if you have two data sources(API,Cache), The repository needs to determine, do we load the data fro API or the cache.
* The decesion logic of determing the choosing of data source and determining if there is any errors during this.ππππ²ππππ:
* Use-cases shouldn't know where the repository gets the data from.
* They just get the data and thats it.
* Contains the business logic.
* Makes code very redable, Because essentially the use-case is is something that does one thing.
* We can just know what a class does by just reading the name of the class. Ex: `DeleteNoteUseCase` determines this is used to delete a note.
* They make code very re-usable, because in the end the `view-model` call the use-cases.
* If you implement the all the business logic in view-model and say if you need that logic in a different view model its not possible, Using a use-case overcomes this by re-using hte use-case class in a different view-model.ππππππππππ’ ππππππππππ ππ πππ ππππππ πππ’ππ:
* This is useful because we can create fake versions of the repository for testing
* We can pass fake repository to use cases for testing so that use cases won't know where the data is coming from
* Say its from a real repository or a local json file, They just get data and do something from itπ πππ -πΌππππ:
* When we just use a `mvvm` architecture, we have all the business logic in the `view-model`
* But when we use `clean-architecture` in combination with `mvvm`, the business logic is lifted to `use-case` layer.
* So the view model puts some inputs to a use-case and performs some computation based on the input and gets the result and delegates the resut as a state to the presentation(UI) layer.## **`πΏππππππ πππππππππ ππ πππ πππππππ`** :package:
Project Folder
.
βββ app
| |
β βββ> DI
| |
β |ββ> Feature
| | |
| | |ββ-------------> Data
| | | |
| | | |ββ-------------> DataSource
| | | |
| | | βββ-------------> Repository
| | |
| | |ββ-------------> Domain
| | | |
| | | |ββ-------------> Model
| | | |
| | | |ββ-------------> RepositoryDefinition
| | | |
| | | |ββ-------------> UseCase
| | | |
| | | βββ-------------> Util
| | |
| | βββ-------------> Presentation
| | |
| | |ββ-------------> Screen1
| | | |
| | | |
| | | βββ-------------> Components
| | |
| | βββ-------------------------------> MainActivity
| |
| |ββ> UI
| | |
| | βββ--------------------------------------------------> Theme
| |
β βββ-------------------------------------------------------> ApplicationClass
## `Modes`
### `π³πππ πΌπππ`π
| **`π½ππππ π»πππ`** | **`π πππ π½πππ`** | **`π΄πππ ππππ`** |
| ---------------- | --------------- | --------------- |
| | | |### `π»ππππ πΌπππ`π
| **`π½ππππ π»πππ`** | **`π πππ π½πππ`** | **`π΄πππ ππππ`** |
| ---------------- | --------------- | --------------- |
| | | |## **`π³πππ`** πΌ
## **`πππππππ`** β
If you feel like support me a coffee for my efforts, I would greatly appreciate it.## **`π²πππππππππ`** πββοΈ
Read [contribution guidelines](CONTRIBUTING.md) for more information regarding contribution.## **`π΅πππππππ`** βοΈ
Feature requests are always welcome, [File an issue here](https://github.com/devrath/NoteApp/issues/new).## **`π΅πππ ππππ πππππππ ππππππ`** ? β€οΈ
Support it by clicking the β button on the upper right of this page. βοΈ## **`π»ππππππ`** ![Licence](https://img.shields.io/github/license/google/docsy) :credit_card:
This project is licensed under the Apache License 2.0 - see the [LICENSE](https://github.com/devrath/NoteApp/blob/main/LICENSE) file for details