DEV Community

Discussion on: Code readability metrics?

Collapse
 
stereobooster profile image
stereobooster • Edited

Not readability metrics

Length of text

I agree that 1000 LOC code is easier to read than 100,000 LOC code. But if the size of code samples comparable than length says nothing. I can easily imagine 500 LOC that is harder to read than 1000 LOC 🤷‍♀️.

Nobody reads code from cover to cover. Most of the time people read relevant pieces in small chunks, from that point of view length doesn't help to measure readability. Structure and "predictability" is more important.

Code formatting

I agree that homogeneously formatted code is easier to read. But on the other side, I don't think we need to measure instead we can use auto formatter, like Prettier, etc.