Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I would argue that the self-documenting code in your first example (albeit excessively verbose to suite your argument) is better than having to put a comment above every terse statement one writes?.

Programming with descriptive and meaningful variable / function names that have intrinsic meaning skips this step: 'wait, what was the cg2 again? let me waste time by looking back through the code and figuring that out again'. Particularly for others reading your code later.

But I try to fit somewhere in between the two examples you've shown, meaningful but not too long -> the benefits of longer variable / functions names diminishes when names get too long as variable names tend to blend together (see law of diminishing returns).



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: