Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Why are you trying to build up objects and pass them into places?

Well, that place needs those objects to do its job.

> When / why is that ever a thing that someone needs to do so often that it becomes a concern?

In web applications, at least, you find yourself with a few controllers, which all need a few services which all need a few repositories to access the database... I guess you can see where this is going. Declaring in your class' constructor that instances need an object of `Type` is the less repetitive way of saying that an instance of a class needs something. Writing the code that builds objects and passes them to your constructors would be quite repetitive.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: