4 ms·
Wonder what the equivalent "Coding Rules to Disregard" might be.
by geoelectric 8y ago
Wonder what the equivalent "Coding Rules to Disregard" might be.
- mcguire 8y agoSingle point of return from a function? No more than X lines of code in a function? Object oriented programming?
- deleted 8y ago[deleted]
- Klathmon 8y agoI'd say all the rules about code complexity are like this. Recommended function/class/file size, when to abstract vs when to copy, even size/names of function arguments. There are "rules" about all of these, but the best codebases have tons and tons of violations. Not because they are bad, but because the devs working on it know when to break those rules, and know that they are mostly guidelines.
- sametmax 8y agoI really hate the "don't comment, good code is self explicit rule" personnaly. It's self explicit for the person who wrote it 10 years ago and had the spec and the client at hand, surely.
- perigrin 8y agoIf it was hard to write, it should be hard to understand. /s
- marcosdumay 8y agoIf you know of any coding rule that is universally true, I'd like to hear. Maybe... Don't use goto to jump to the middle of a different block of code? I don't know any exception to this one, but it's also prohibited on all modern languages, so I don't think it's a "coding rule" anymore.
- ghtrytttttnsa 8y agoOnly wimps consider goto harmful.
- SamReidHughes 8y agoOftentimes if you have some hairy code, the best option is to use a goto, make a commit or leave a note, and then clean it up later, in a separate commit. It's more bisectable and leaves a more readable diff. I'm pretty sure I've had occasion to jump into the middle of a loop as the point of entry. Duff's device is a case of this.
- hathawsh 8y agoThe coding equivalent would be overzealous linter rules. For example, sometimes linters demand that all variable and function names follow a project-specific capitalization convention, but I find that type of consistency is often counterproductive.