r/videos • • Oct 03 '19

Every programming tutorial

https://www.youtube.com/watch?v=MAlSjtxy5ak
33.9k Upvotes

1.4k comments sorted by

View all comments

Show parent comments

9

u/ImpeachTraitorTrump Oct 03 '19

Good code doesn’t need to be loaded with comments. The code base I’m working in has maybe 3 comments per file and it’s perfectly readable.

4

u/[deleted] Oct 03 '19

This is the real key. Don't leave any doubt in your variable or method names and things will be a lot clearer even without comments. Of course document your methods, but you shouldn't need to explain line by line how it works.

3

u/Konrad_EU Oct 03 '19

And if a function become too big you need comment to understand what it does, you probably need to break it down into subfunctions instead.

2

u/modernkennnern Oct 03 '19

The better your code, the more intuitive it is, and the more intuitive it is, the less comments you need.

Generalising of course. Some things can't be intuitive