3 ms·
Sandy Metz, a Ruby lecturer, also advocates 5 line functions. I'm keen to have functions limited to 24 lines, because as someone with significant vision challe
by lcuff 5y ago
Sandy Metz, a Ruby lecturer, also advocates 5 line functions. I'm keen to have functions limited to 24 lines, because as someone with significant vision challenges who uses large fonts, that's as many lines as I can get on a screen, and I want to see the whole function at once.
But I also think it's worth asking "what language are we in"? When I'm writing in C, I'm going to be maxing out that 24 lines, because it's sufficiently low level that seems appropriate. With powerful languages like Python and Ruby, you can accomplish so much with 3 lines of code, maxing at 5 doesn't seem terrible. With Java (yuck, not a fan), one of the problems is there's so much boilerplate for every function that it just seems like the screen is filled with non-informative blah-blah-blah.