DEV Community

Discussion on: A beginner's guide to writing cleaner code

Collapse
 
samuelfaure profile image
Samuel-Zacharie FAURE • Edited

Good TLDR, I would add two things tho:

  • 80-character lines: There is no good basis for limiting to 80 characters a line.

Historically, this value comes from the fact that IBM punch-cards had 80 holes in a row. Because of this, our first terminal screens could display 80 chars on a line. We have great screens today and 80 chars is just too short, since one often have to sacrifice other principles of readability (i.e good naming) to respect this limit.

I find the sweet spot to be a hard limit of 120 chars a line, with a soft limit at 100.

  • D.R.Y: Good advice for very early beginners, but it should always be said that a little repetition is usually much better than added complexity. D.R.Y should be a very flexible guideline.
Collapse
 
morgenstern2573 profile image
Paul Akinyemi

Thank you for the additions!

I didn't know that about the 80 character rule, nice

A little repetition is much better than unnecessary complexity...fair enough