What was the strangest coding standard rule that y

2019-01-09 20:39发布

When I asked this question I got almost always a definite yes you should have coding standards.

What was the strangest coding standard rule that you were ever forced to follow?

And by strangest I mean funniest, or worst, or just plain odd.

In each answer, please mention which language, what your team size was, and which ill effects it caused you and your team.

30条回答
太酷不给撩
2楼-- · 2019-01-09 21:05

Half of the team favored four-space indentation; the other half favored two-space indentation.

As you can guess, the coding standard mandated three, so as to "offend all equally" (a direct quote).

查看更多
我只想做你的唯一
3楼-- · 2019-01-09 21:07

I hate it when the use of multiple returns is banned.

查看更多
萌系小妹纸
4楼-- · 2019-01-09 21:07

The very strangest one I had, and one which took me quite some time to overthrow, was when the owner of our company demanded that our new product be IE only. If it could work on FireFox, that was OK, but it had to be IE only.

This might not sound too strange, except for one little flaw. All of the software was for a bespoke server software package, running on Linux, and all client boxes that our customer was buying were Linux. Short of trying to figure out how to get Wine (in those days, very unreliable) up and running on all of these boxes and seeing if we could get IE running and training their admins how to debug Wine problems, it simply wasn't possible to meet the owner's request. The problem was that he was doing the Web design and simply didn't know how to make Web sites compliant with FireFox.

It probably won't shock you to know that that our company went bankrupt.

查看更多
5楼-- · 2019-01-09 21:08

Maybe not the most outlandish one you'll get, but I really really hate when I have to preface database table names with 'tbl'

查看更多
冷血范
6楼-- · 2019-01-09 21:09

No ternary operator allowed where I currently work:

int value = (a < b) ? a : b;

... because not everyone "gets it". If you told me, "Don't use it because we've had to rewrite them when the structures get too complicated" (nested ternary operators, anyone?), then I'd understand. But when you tell me that some developers don't understand them... um... Sure.

查看更多
Melony?
7楼-- · 2019-01-09 21:09

At a former job:

  • "Normal" tables begin with T_
  • "System" tables (usually lookups) begin with TS_ (except when they don't because somebody didn't feel like it that day)
  • Cross-reference tables begin with TSX_
  • All field names begin with F_

Yes, that's right. All of the fields, in every single table. So that we can tell it's a field.

查看更多
登录 后发表回答