Hello ranchers,
I would really appreciate your input on this one.
I've been assigned to maintain a somewhat large project. As fantastic as that is, my predecessors left me practically no comments and big (huge?) files and methods to maintain. Files span 4k+ lines, with methods ranging up to few hundred lines. After about a month of work and 723 cups of
coffee, files are mostly under 3k and methods are almost readable.
Now I've started to wonder what is the 'optimal' number of lines for a method (I know there is no exact number ...). Does it make sense to put larger blocks of code in own methods even if that method only gets called in one place? I'm talking of big if blocks, nested loops etc.
I'm thinking that on one hand it must be as bothersome to be jumping up and down the file just to figure out what an if statement does. On the other hand, if that method is properly documented and has a good, self explaining name it might save some time and coffee from extinction.
Please share any experience you might have in such issues and if possible, point me to some literature.
Thank you!
p.s. if anyone cares, I've switched to green tea.