Hacker News new | ask | show | jobs
by riboflava 3560 days ago
I go back and forth on the singly-called function as a code smell. It really depends. What annoys me are the private method refactors that then can't be unit tested unless the 'private' keyword is removed.

For an instance of how it depends, see the classic Forth example for implementing a washing machine driver:

        ...
    	: RINSE  FAUCETS OPEN  TILL-FULL  FAUCETS CLOSE ;
        ...
    	: WASHER  WASH SPIN RINSE SPIN ;
Then a single call to WASHER is all that happens when the user presses the start button.

Function calls should make things clearer, not less clear because of some other principle (like DRY or single responsibility or testability etc.). That's ultimately where I think the JavaLand culture has gone wrong, all these abstractions (many of them caused by being forced to live in a Kingdom of Nouns) that are sometimes quite useful in the large are always a pain in the small, but many times the small is all that is needed. Big projects are slowly learning they don't need to be so big, they can instead be a set of independent smaller projects, but it'll take more time.