React-App-Clean-Architecture icon indicating copy to clipboard operation
React-App-Clean-Architecture copied to clipboard

What the folder di means?

Open eltranseunteurbano opened this issue 2 years ago • 1 comments

Hi. I checked it out, your project. Looks good, but I don't understand what the folder "di" means? Why you decide to create that folder?

eltranseunteurbano avatar Oct 23 '22 20:10 eltranseunteurbano

Hello, thank you for your interest in this project.

"di" means dependency injection, so all use cases and data sources need to be inisilized with the correct instance.

For example, in the constructor of src/business/datasource/network/MainNetworkDataSourceImpl, there is an argument of type MainNetworkService, which is an interface; therefore, each time we need to call MainNetworkDataSourceImpl, we must feed it with the correct class that implements MainNetworkService; as a result, I created a di folder to initialize once with the correct instance in src/di/NetworkDataSource.

I hope it is clear. If not, I am here.

Abouelyatim avatar Oct 23 '22 21:10 Abouelyatim