DEV Community

Discussion on: Java may be verbose, but who cares?

Collapse
 
yagiz profile image
Yagiz Erkan

More lines equals more effort.

Ah! Not necessarily always true.
Code is written for other people to read, so it needs to be expressive, which may mean more lines sometimes.

Collapse
 
elijahschow profile image
Elijah Schow • Edited

Agreed: varied comments, personal style, and syntax can affect LOC without increasing complexity, so it's silly to make a big deal about tiny differences in program length. A 400-line program probably has the same complexity a 300-line alternative, so saving a few lines probably isn't worth making a program illegible (I'm glaring at you, RegEx). At some point, however, a big difference in size indicates a big increase in complexity. For example, a 1,000,000-line program is definitely more complex than a 100-line one.

relative complexity = round (program A LOC / program B LOC)

Measuring complexity reminds me of Fermi Problems. It's really hard to quantify accurately, so I have to make squishy comparisons based on educated guesses. My rule of thumb: if a program is more than twice as big as another, then it's significantly more complex.

Thus, if switching to a new language would cut my program in half (or more), then it's worth considering.