Skip to main content
fix spelling
Source Link
Kilian Foth
  • 111k
  • 45
  • 301
  • 323

I would go as well with Dependency Injection. Remember that DI is not only done through constructorconstructors, but also through Property setters... For example, the logger could be injected as a property.

Also, you may want to use an IoC container that may lift some of the burden for you, for example by keeping the constructor parameters to thingthings that are needed at runtime by your domain logic (keeping the constructor inain a way that reveals the intention of the class and the real domain dependencies) and maybe inject other helper classes through properties.

A step further you may want to go is Aspect Oriented-Oriented Programmnig, which is implemented in many major frameworks. This can allow you to intercept (or "advise" to use AspectJ terminology) the constructor of the class and inject the relevant properties, maybe given a special attribute.

I would go as well with Dependency Injection. Remember that DI is not only done through constructor but also through Property setters... For example the logger could be injected as a property.

Also, you may want to use an IoC container that may lift some of the burden for you, for example by keeping the constructor parameters to thing that are needed at runtime by your domain logic (keeping the constructor ina way that reveals the intention of the class and the real domain dependencies) and maybe inject other helper classes through properties.

A step further you may want to go is Aspect Oriented Programmnig, which is implemented in many major frameworks. This can allow you to intercept (or "advise" to use AspectJ terminology) the constructor of the class and inject the relevant properties, maybe given a special attribute.

I would go as well with Dependency Injection. Remember that DI is not only done through constructors, but also through Property setters. For example, the logger could be injected as a property.

Also, you may want to use an IoC container that may lift some of the burden for you, for example by keeping the constructor parameters to things that are needed at runtime by your domain logic (keeping the constructor in a way that reveals the intention of the class and the real domain dependencies) and maybe inject other helper classes through properties.

A step further you may want to go is Aspect-Oriented Programmnig, which is implemented in many major frameworks. This can allow you to intercept (or "advise" to use AspectJ terminology) the constructor of the class and inject the relevant properties, maybe given a special attribute.

Source Link

I would go as well with Dependency Injection. Remember that DI is not only done through constructor but also through Property setters... For example the logger could be injected as a property.

Also, you may want to use an IoC container that may lift some of the burden for you, for example by keeping the constructor parameters to thing that are needed at runtime by your domain logic (keeping the constructor ina way that reveals the intention of the class and the real domain dependencies) and maybe inject other helper classes through properties.

A step further you may want to go is Aspect Oriented Programmnig, which is implemented in many major frameworks. This can allow you to intercept (or "advise" to use AspectJ terminology) the constructor of the class and inject the relevant properties, maybe given a special attribute.