Live data from Hacker News

Writing Rules to Disregard

theparisreview.org

11–16 of 16 posts

Re: Writing Rules to Disregard

#11

Wonder what the equivalent "Coding Rules to Disregard" might be.

If 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.

Only wimps consider goto harmful.

Re: Writing Rules to Disregard

#12
I've rarely seen those three rules followed by anyone in normal writing.

Usually when I see someone strictly adhering to those rules (particularly not ending a sentence with a preposition), it sets of a warning flag that the writer is trying too hard to follow imaginary rules, and maybe isn't someone whose opinion I want to take much stock in.

Re: Writing Rules to Disregard

#13
post #9

This is an example of how the HN rule about stripping out the "Three" in the title has resulted in ambiguity: I thought the term "writing rules" was present-participle verb + object, but it turned out to be gerund-as-adjective + noun. (I might have the grammatical labels wrong.)

True - you were hoping for advice in the construction of rules that everyone would ignore. (A bit masochistic.)

Re: Writing Rules to Disregard

#14
post #3

Wonder what the equivalent "Coding Rules to Disregard" might be.

Single point of return from a function? No more than X lines of code in a function? Object oriented programming?

I'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.

Re: Writing Rules to Disregard

#15

Wonder what the equivalent "Coding Rules to Disregard" might be.

If 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.

Oftentimes 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.
Post reply on HN