3 ms·
> only pass arguments that function needs to do the job. Why would users of that function bother to know what data it needs to do its job? It seems you'll end
by Udik 7y ago
> only pass arguments that function needs to do the job.
Why would users of that function bother to know what data it needs to do its job? It seems you'll end up polluting your whole code with the implementation details of one of its components. What happens of you want to change those implementation details?
- keymone 7y agoBecause the two alternatives we’re talking about here are ‘foo(bar, baz)’ where foo, bar and baz convey meaning and ‘object.doWork()’ which means nothing and explains nothing. Yes, it’s a spectrum and there’s a lot of space in between those alternatives, I simply believe being closer to the first option is better than to the second. Pure functions are conductive to transparency, objects, methods and class hierarchies are conductive to obscurity.