3 ms·
I worked on a massive codebase once many years ago (C#/.NET) which had been built by a relatively competent outsourced team. Somewhere along the way some consul
by kingrolo 13y ago
I worked on a massive codebase once many years ago (C#/.NET) which had been built by a relatively competent outsourced team. Somewhere along the way some consultant on the UK side of the business had insisted that each function could be no more than 5 lines long. It was horrible to work with - it took so long to find the place you actually needed to make changes, and it seems like they'd just started inventing layer names in order to facilitate it.
So yeah, small functions good, but you can take it to extremes.
- sigmaml 13y agoI worked on a similar project; the US consultant insisted that each method should be less than 25 lines. The code involved several decision trees. This rigid limit made the code quite inconvenient to follow and enhance. After much sweat and swearing on both sides, the limit was increased to 40 lines!
- lostcolony 13y agoI've run into that. Compounding that issue, I've run into cases where people pulled out code into functions, realized that in two places the behavior was ~slightly~ different, and they addressed it by adding a variable, 'shouldThing' or something, that serves just as a boolean flag as to which bit(s) of logic you should fire. So now rather than just have to focus on the code that needs changing, I've got to go to an entirely different section/file, and wade through code that doesn't even relate to what I'm trying to fix.