Skip to main content
added 406 characters in body
Source Link
s-hunter
  • 185
  • 1
  • 4

In an Android project, I am using dagger 2 for dependency injection, applying mvp design pattern, and I am writing interface for almost every class. Although it does achieved the separation of concerns, each individual logic is not coupled with others. But for just making a simple REST call, it involved 20 plus java class files which makes the codebase to become very complex, I start to think is it normal to have 20 plus java classes for just making a simple REST call? Should I be really doing the MVP pattern and writing interfaces for every classes, or I am just doing it wrong?

For Dagger 2, it requires to set up components, modules and scopes, that's 5 files including the parent and child components.

For MVP pattern, there is an interface and an interface implementation class for the Model, View and Presenter, that's 6 files already. For the presenter, there is another layer that does the actual work of REST call, that's 4 files, interfaces and interface implementations for doing the REST call and result handling.

Plus the activity class and it's parent class and some other utility classes and xml files, that's 20 plus files.

If I remove dagger 2, remove the MVP pattern, and remove all the interfaces, I could achieve the same in few java classes or even just one java class. If I give this 20 files to myself a few years ago, I might have no idea how each connect to others, can only do the guess work probably, even now I found it a lot harder to trace through the code compared to the version without the DI, MVP and interfaces.

In an Android project, I am using dagger 2 for dependency injection, applying mvp design pattern, and I am writing interface for almost every class. Although it does achieved the separation of concerns, each individual logic is not coupled with others. But for just making a simple REST call, it involved 20 plus java class files which makes the codebase to become very complex, I start to think is it normal to have 20 plus java classes for just making a simple REST call? Should I be really doing the MVP pattern and writing interfaces for every classes, or I am just doing it wrong?

For Dagger 2, it requires to set up components, modules and scopes, that's 5 files including the parent and child components.

For MVP pattern, there is an interface and an interface implementation class for the Model, View and Presenter, that's 6 files already. For the presenter, there is another layer that does the actual work of REST call, that's 4 files, interfaces and interface implementations for doing the REST call and result handling.

Plus the activity class and it's parent class and some other utility classes and xml files, that's 20 plus files.

In an Android project, I am using dagger 2 for dependency injection, applying mvp design pattern, and I am writing interface for almost every class. Although it does achieved the separation of concerns, each individual logic is not coupled with others. But for just making a simple REST call, it involved 20 plus java class files which makes the codebase to become very complex, I start to think is it normal to have 20 plus java classes for just making a simple REST call? Should I be really doing the MVP pattern and writing interfaces for every classes, or I am just doing it wrong?

For Dagger 2, it requires to set up components, modules and scopes, that's 5 files including the parent and child components.

For MVP pattern, there is an interface and an interface implementation class for the Model, View and Presenter, that's 6 files already. For the presenter, there is another layer that does the actual work of REST call, that's 4 files, interfaces and interface implementations for doing the REST call and result handling.

Plus the activity class and it's parent class and some other utility classes and xml files, that's 20 plus files.

If I remove dagger 2, remove the MVP pattern, and remove all the interfaces, I could achieve the same in few java classes or even just one java class. If I give this 20 files to myself a few years ago, I might have no idea how each connect to others, can only do the guess work probably, even now I found it a lot harder to trace through the code compared to the version without the DI, MVP and interfaces.

added 575 characters in body; edited title
Source Link
s-hunter
  • 185
  • 1
  • 4

Is 20 plus Java classes for just making a REST call too much?

In an Android project, I am using dagger 2 for dependency injection, applying mvp design pattern, and I am writing interface for almost every class. Although it does achieved the separation of concerns, each individual logic is not coupled with others. But for just making a simple REST call, it involved 20 plus java class files which makes the codebase to become very complex, I start to think is it normal to have 20 plus java classes for just making a simple REST call? Should I be really doing the MVP pattern and writing interfaces for every classes, or I am just doing it wrong?

For Dagger 2, it requires to set up components, modules and scopes, that's 5 files including the parent and child components.

For MVP pattern, there is an interface and an interface implementation class for the Model, View and Presenter, that's 6 files already. For the presenter, there is another layer that does the actual work of REST call, that's 4 files, interfaces and interface implementations for doing the REST call and result handling.

Plus the activity class and it's parent class and some other utility classes and xml files, that's 20 plus files.

Is 20 plus Java classes for just making a REST call too much?

In an Android project, I am using dagger 2 for dependency injection, applying mvp design pattern, and I am writing interface for almost every class. Although it does achieved the separation of concerns, each individual logic is not coupled with others. But for just making a simple REST call, it involved 20 plus java class files which makes the codebase to become very complex, I start to think is it normal to have 20 plus java classes for just making a simple REST call? Should I be really doing the MVP pattern and writing interfaces for every classes, or I am just doing it wrong?

Is 20 Java classes for just making a REST call too much?

In an Android project, I am using dagger 2 for dependency injection, applying mvp design pattern, and I am writing interface for almost every class. Although it does achieved the separation of concerns, each individual logic is not coupled with others. But for just making a simple REST call, it involved 20 plus java class files which makes the codebase to become very complex, I start to think is it normal to have 20 plus java classes for just making a simple REST call? Should I be really doing the MVP pattern and writing interfaces for every classes, or I am just doing it wrong?

For Dagger 2, it requires to set up components, modules and scopes, that's 5 files including the parent and child components.

For MVP pattern, there is an interface and an interface implementation class for the Model, View and Presenter, that's 6 files already. For the presenter, there is another layer that does the actual work of REST call, that's 4 files, interfaces and interface implementations for doing the REST call and result handling.

Plus the activity class and it's parent class and some other utility classes and xml files, that's 20 plus files.

Source Link
s-hunter
  • 185
  • 1
  • 4

Is 20 plus Java classes for just making a REST call too much?

In an Android project, I am using dagger 2 for dependency injection, applying mvp design pattern, and I am writing interface for almost every class. Although it does achieved the separation of concerns, each individual logic is not coupled with others. But for just making a simple REST call, it involved 20 plus java class files which makes the codebase to become very complex, I start to think is it normal to have 20 plus java classes for just making a simple REST call? Should I be really doing the MVP pattern and writing interfaces for every classes, or I am just doing it wrong?