← Back to context

Comment by mejutoco

8 hours ago

> What would be a good example of the kinds of things a 100 line function would be doing?

If you have a shopping list with 100 items, that does not mean the complexity of that is high.

Longer functions are worse, everything else being equal, but sometimes they have very low complexity.

To answer your question: if you have, for example, a function that returns for a key a certain value (basically a dictionary) for example for some translations that can be a very long function. Of course you could take the data out of the code into a data file, etc. but there is nothing wrong on principle about a function like that. A function like that is closer to extract state into data than one where that gets refactored into many small functions.