The advantage of the original approach is that later, when you need it, you can just add more methods to a class that are private to them. In your approach, if you need a new function, you add it at the global level, which can totally be fine for one or two functions, but with any more you end up with a bunch of functions all at the same level that is no longer obvious the dependency between them.
remram|1 year ago
heisenzombie|1 year ago
But if you have functions that only need to be called from one calling function then I why not just inline the code and eschew having a function at all. Long function bodies for the win!
notfish|1 year ago
When you write the initial code to figure out bar, just throw that code in a unit test so you can run it any time. Stop throwing tests away!