Hacker News new | ask | show | jobs
by chrisguitarguy 4086 days ago
If your objects require dependencies to do their jobs, it should be impossible to create objects without those dependencies. The objects' constructors should require them. Having setters is, arguably, fine (but probably unnecessary) as long as invalid objects can't be created.