Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • thanks, I find it a bit strange to have some DTO/container to hold just repository reference, but yes I agree it's a good way to reduce number of parameters in constructor. What do you think about my 2nd approach? To be honest, I quite like the idea of the 2nd approach, since it looks clean to me, although there are some drawbacks as I mentioned Commented Oct 10, 2014 at 16:09
  • It might not only just hold it. Imagine credentials. In a simple form, they consist only of a userId and a password. Same goes for a simple geo-coordinate(s) class. But they has to fit together by business logics / semantics. It's not good to put 2 things into a class just to pass only one argument. Actually your 2nd approach is exactly what I suggested but instead of putting together what fits together it is putting everything together. That hides what your method really needs to work and is like giving the method all 3 IRepository arguments (in grouped form) but it uses only few of them. Commented Oct 10, 2014 at 18:57