Comment by exceptione

9 hours ago

That is an important consideration which you should weigh against the clarity gained by breaking up your code in units of logic.

That is precisely the reason why for a function the scope of its container should be constrained. A class with a Singe Responsibility (SRP) would not suffer from several private methods. Breaking up your methods in a God Class brings both a decrease and an increase of mental load.

Also, in functional programming languages one can nest functions, and OOP languages oftentimes can nest classes.

Haskell does function hiding the most elegant imo, by means of `where`:

  foo x = 
    if odd x then
        short x
    else
        reallyLongFunc x
    where 
        short y = y*2
        reallyLongFunc z = z + 2

The point of breaking down the long function in God Classes , is to prepare the code for a second refactoring, which is usually extract class, long params list, etc..

If you were to simply leave it a mess like that, you would be right.