Skip to content

Decouple Dependencies to Improve Testability and Reduce Tight Coupling #3

Description

Dependencies need to be decoupled. Since most of our dependencies are not injected through constructors, the code has tight coupling and is not testable. We can adopt a hybrid approach: if the dependency is not provided through the constructor, create it using a private factory method. This way, we can avoid bloated constructors while achieving highly testable code.

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions