3 ms·
This is why I am a fan of long function names, like openUpgradeDowngradeSubscriptionDialog(). Even though they add a bit of verbosity to the code, I can immedia
by enraged_camel 7y ago
This is why I am a fan of long function names, like openUpgradeDowngradeSubscriptionDialog(). Even though they add a bit of verbosity to the code, I can immediately tell what they do without having to scroll to the function definition, and there is zero astonishment when they are called from elsewhere. To a lesser extent, same with variable names: speaking for myself (and perhaps only myself), I like long variable names -- as the saying goes, code is read many more times than it is written, so saving a few keystrokes just to shorten a variable name tends to carry a high cost that is paid down the line.
- jasonpeacock 7y agoYou're describing self-documenting code. Well written code shouldn't require any "what" comments, only "why" comments. Too often you see code with a generically-named function/variable, and a comment next to it describing what it does. Why not just name the function/variable correctly?! There's a strong cargo-cult idea that "real" programmers use short/abbreviated names, and yet there's absolutely no value to using "idx" over "index", or a more appropriately named "last_name_index".
- jbay808 7y agoNaming is always hard, but sometimes the "what" requires a full paragraph, and even very long variable names shouldn't exceed 80 characters all on their own. torque_aux_motor_braking_only_safety_threshold_nm is a good variable name, but I wouldn't want to let them get much longer than that.
- Ididntdothis 7y agoTotally agree. At least don’t use generic names like “Config”. Call it “”DatabaseConfig” that has some meaning.