Google's 'Construct with Collaborators, Call with Work' guideline advises separating constructor parameters from method parameters based on their role. Collaborators — dependencies that define an object's identity and persist for its lifetime (e.g., a database or formatter) — belong in the constructor. Work — inputs that vary per operation (e.g., a date range or file path) — should be passed to methods. This pattern improves reusability, testability, code clarity, and behavioral predictability, as demonstrated with a ReportGenerator example.
Sort: