2 ms·
If the methods have a clear purpose with well-defined inputs and outputs and no side effects, then I think the trade-off is generally in favor of smaller method
by sofal 18y ago
If the methods have a clear purpose with well-defined inputs and outputs and no side effects, then I think the trade-off is generally in favor of smaller methods. Once you introduce side effects, longer methods then have the advantage of showing you all the side effects in one place.
- stewiecat 18y agoGreat point. I've seen that developers that really understand OO tend towards smaller, more encapsulated classes/methods w/o side-effects whereas developers with a procedural background tend towards longer 'void' methods that lump side-effects into one place.