To be clear, a function with zero arguments and no side effects is a constant
-
-
Show this thread
-
So, what the author means by "functions" is "methods". With a method, there's always one implicit "argument", `this`, the object on which the method is being called. What he's actually asserting is that the ideal method only interacts with `this`
Show this thread -
Additionally, he doesn't consider it to be a side-effect when a method call interacts with `this` (sets member variables, for example)
Show this thread -
So, for example, instead of one method passing a Boolean flag `isSuite` into an inner method call, he sets `this.isSuite = isSuite` in the first method and then reads from `this.isSuite` in the inner method
Show this thread -
As we see here: https://github.com/ludwiggj/CleanCode/blob/master/src/clean/code/chapter03/SetupTeardownIncluder.java#L28-L33 …
Show this thread
End of conversation
New conversation -
-
-
In author defense the book is called “Clean code”, not “Useful Clean Code”.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
The ideal program has zero lines of code and no bugs
-
Probably still has a bug.
End of conversation
New conversation -
-
-
the only winning move is to not play
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
To be fair, some of the best functions I’ve been to have had loads of arguments.
-
This tweet is amazing and highly underrated
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.