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 20:53

When I started working at one place, and started entering my code into the source control, my boss suddenly came up to me, and asked me to stop committing so much. He told me it is discouraged to do more than 1 commit per-day for a developer because it litters the source control. I simply gaped at him...

Later I understood that the reason he even came up to me about it is because the SVN server would send him (and 10 more high executives) a mail for each commit someone makes. And by littering the source control I guessed he ment his mailbox.

查看更多
疯言疯语
3楼-- · 2019-01-09 20:54

Back in the 80's/90's, I worked for an aircraft simulator company that used FORTRAN. Our FORTRAN compiler had a limit of 8 characters for variable names. The company's coding standards reserved the first three of them for Hungarian-notation style info. So we had to try and create meaningful variable names with just 5 characters!

查看更多
我欲成王,谁敢阻挡
4楼-- · 2019-01-09 20:54

Doing all database queries via stored procedures in Sql Server 2000. From complex multi-table queries to simple ones like:

select id, name from people

The arguments in favor of procedures were:

  • Performance
  • Security
  • Maintainability

I know that the procedure topic is quite controversial, so feel free to score my answer negatively ;)

查看更多
Deceive 欺骗
5楼-- · 2019-01-09 20:55

Totally useless database naming conventions. Every table name has to start with a number. The numbers show which kind of data is in the table.

  • 0: data that is used everywhere
  • 1: data that is used by a certain module only
  • 2: lookup table
  • 3: calendar, chat and mail
  • 4: logging

This makes it hard to find a table if you only know the first letter of its name. Also - as this is a mssql database - we have to surround tablenames with square brackets everywhere.

-- doesn't work
select * from 0examples;

-- does work
select * from [0examples];
查看更多
Lonely孤独者°
6楼-- · 2019-01-09 20:58

Not being able to use Reflection as the manager claimed it involved too much 'magic'.

查看更多
等我变得足够好
7楼-- · 2019-01-09 21:00

We were doing a C++ project and the team lead was a Pascal guy.

So we had a coding standard include file to redefine all that pesky C and C++ syntax:

#define BEGIN {
#define END }

but wait there's more!

#define ENDIF }
#define CASE switch

etc. It's hard to remember after all this time.

This took what would have been perfectly readable C++ code and made it illegible to anyone except the team lead.

We also had to use reverse Hungarian notation, i.e.

MyClass *class_pt  // pt = pointer to type

UINT32 maxHops_u   // u = uint32

although oddly I grew to like this.

查看更多
登录 后发表回答