Open in app

Sign In

Write

Sign In

Denis Brandi
Denis Brandi

1.1K Followers

Home

About

Aug 31, 2022

Thanks for this article~~.
1

jeonhoeun

Hi Jeonhoeun, thanks for reading the article!

Hi Jeonhoeun, thanks for reading the article! Like I show in the article, in Dagger you have to do the following: ``` @Provides fun provideGetSomeModelUseCase( someModelRepository: SomeModelRepository ): GetSomeModelUseCase { return GetSomeModelUseCase(someModelRepository::getSomeModels) } ```

1 min read

1 min read


Published in Better Programming

·Aug 24, 2022

How To Avoid Use Cases Boilerplate in Android

Exploring four different approaches — Since the dawn of layered architectures, Use Cases have had a controversial reputation. While on the one side, they help you adhere to S.O.L.I.D. principles and improve your code readability; on the other, they are sometimes “useless” (the only thing they do is call a repository method). Because of that…

Programming

4 min read

How To Avoid Use Cases Boilerplate in Android
How To Avoid Use Cases Boilerplate in Android
Programming

4 min read


Published in Better Programming

·Jul 18, 2022

The “Real” Clean Architecture in Android: S.O.L.I.D.

If you think good architecture is expensive, try bad architecture. ~ Brian Foote and Joseph Yoder — Clean Architecture has been probably the hottest topic in the Android community in the past few years and this trend doesn’t seem to go away (thankfully). This series is based on the following books and documentation: Clean Code by Robert C. Martin Clean Architecture by Robert C. Martin Patterns of…

Android

16 min read

The “Real” Clean Architecture in Android: S.O.L.I.D.
The “Real” Clean Architecture in Android: S.O.L.I.D.
Android

16 min read


Oct 30, 2021

I have read that and Uncle Bob's book about Clean Architecture.
1

Bawenang Rukmoko Pardian Putra

Few comments based on your reply:

Few comments based on your reply: 1. Use cases can receive only entities, if they receive DTOs it means they know about the outer layer and so the dependency rule is violated (Dependencies point only inwards never outwards, so framework layer sees interface adapter layer which sees the use case…

2 min read

2 min read


Sep 30, 2021

So if we're talking this in Clean Architecture term, `ProductRepository` is the Use Case, and…
1

Bawenang Rukmoko Pardian Putra

Hi Bawenang, thanks for reading the article!

Hi Bawenang, thanks for reading the article! The repository is the interface adapter of the persistence, where the repository interface is the secondary port of the domain and the repository implementation is the adapter that converts DataStores data (DTOs) into Entities and viceversa. The domain models like Product, User... are the entities. The datastores (api service, preferences) are the framework.

1 min read

1 min read


Jul 7, 2021

DTO usually stands for Data Transfer Object which is not unique to network layer.
1

Eric N

Hi Eric, thanks for reading the article!

Hi Eric, thanks for reading the article! I used `ProductDTO` in the example where both network and database datasources where sharing the same model object rather than having 1 model each (which is, as explained, wrong). I'm using `NetworkProduct` and `DbProduct` instead in the correct example

1 min read

1 min read


May 19, 2021

Great article, thanks!
1

Callum Thomson

Hi Callum, thanks for reading the article!

Hi Callum, thanks for reading the article! 1) If you put @ViewModelScoped in the use case you are coupling the use case with the DI scope, therefore you can't inject your use case in another use case with a different DI scope (Singleton for example). Also importing DI annotations in…

2 min read

2 min read


May 19, 2021

Thanks for a great article. I have a question:
22
1

Minh Nguyen

Hi Kyn, thanks for reading the article!

Hi Kyn, thanks for reading the article! The first approach is the correct one. The job of the repository is isolate and encapsulate persistence logic. Also whenever you come across this scenario, where you have 2 sequential invocations of the same dependency: ``` val result = dependency.getSomething() dependency.saveSomething(result) ``` It means you should just have a single function inside `dependency` which will take care of both actions, because you are basically leaking private implementation details.

1 min read

1 min read


Mar 18, 2021

I respected this and I am using separate models for the Room (DTO) and for retrofit (the actually…
11
1

Razvan Alexandru Sandu

If you are downloading a large amount of data having too many models might be bad for performances.

If you are downloading a large amount of data having too many models might be bad for performances. What you should do in that case, assuming that is the real issue, is to keep the domain model and get read of DTOs. DTOs are usually generated with libraries like Gson…

1 min read

1 min read


Mar 17, 2021

"Model for every layer" is nice but once you implement it in an enterprise app and get 130MB data…
1

Farid Mammadov

Hi Farid, thanks for reading the article!

Hi Farid, thanks for reading the article! Wow 130MB sounds quite a lot! At that point even serializers/deserializers are harmful. Few key points for dealing efficiently with the problem: 1. Remove the remote DTO so you are not getting delayed by the reflection of Gson, Moshi, Jackson... 2. Map JsonObjects/JsonArrays…

1 min read

1 min read

Denis Brandi

Denis Brandi

1.1K Followers
Following
  • Sunil Kumar

    Sunil Kumar

  • Aamir Choksi

    Aamir Choksi

  • Alejandra Stamato

    Alejandra Stamato

  • Kent Beck

    Kent Beck

  • Scott Boring

    Scott Boring

Help

Status

Writers

Blog

Careers

Privacy

Terms

About

Text to speech