Andrew Duncan I really enjoyed your article, it’s something I find myself frequently doing.
Trent Jones

Hey Trent Jones, I use 3–4 constructor parameters as a guide to identify potential places to encapsulate clustered coded. This can manifest in various ways in different code bases.

As the number of constructor parameters grow, you’ll start to notice that they are used in clusters. This clustering is what can be extracted and encapsulated into it’s own class. You can then inject the newly created class and remove the clustered code and its dependencies from the constructor in the dependent class. These new classes can be reused. This is beneficial as many times they represent domain concepts. If you’re a fan of domain driven design, you will be able to name these classes using the ubiquitous language, further clarifying their true meaning to the domain within the larger codebase.

Here is a fantastic, more in-depth blog post regarding this topic. It does a better job of explaining this and is what I used to help my understanding of this concept.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.