Campbell Ritchie wrote:How about "not so big that it won't fit onto a JavaRanch screen"? Other people will doubtless have different opinions.
But even that will depend on your screen resolution and font size. holding cntl and scrolling my mouse wheel will quickly and drastically change how many line fit on my screen.
I'd go with something like 'as small as possible to still do something useful'.
I've never thought 1 line per method was even REMOTELY reasonable. All a method could do would be to call another method. You could never have any local variables, because the first one would suck up your one line. You'd never be able to return anything, because the return statement would be your one line. plus, one simple program would have dozens or hundreds or thousands of method calls. You're program would bloat with all the overhead of defining a method. Best case, you'd need twice as many lines - instead of
line 1
line 2
line 3
you'd need
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors