coding-standards

Is there anything like code taste?

I believe there is, but I can't put the right words to it...bear with me I have worked with a lot of developers and I think there is basically a few personalities and they will produce very different things. Cowboy - a loner, often good but hard to get on track Follower - lacks ideas Anarchist - NIHS Orthodox - doing ev...

Is Programming Style important? How Important?

Last year I was troubleshooting a team member's code and it was lacking indents and comments. I was talking to him about it telling him it was not a good idea but he got offended. He was/is smarter than me or certainly more educated. Since then I found out he applied to Microsoft and when they had him do a doubly linked list implementa...

What is a sensible maximum number of characters per line of code?

Everybody's screen size and font are different, so while my code fits on my screen, it might scroll off the right edge of your screen. What should be the maximum length of a line of code? ...

Responsibility without Authority is Meaningless - a technical-based solution?

My dad always says "Responsibility without Authority is meaningless". However, I find that as developers, we get stuck in situations all the time where we are: Responsible for ensuring the software is "bug free", but don't have the authority to implement a bug tracking system Responsible for hitting project deadlines, but can't influe...

What open source C++ static analysis tools are available?

Java has some very good open source static analysis tools such as FindBugs, Checkstyle and PMD. Those tools are easy to use, very helpful, runs on multiple operating systems and free. Commercial C++ static analysis products are available from vendors Klocwork, Gimpel and Coverity. Although having such products are great, the cost is ju...

Coding for high reliability/availability/security - what standards do I read?

I've heard that the automotive industry has something called MISRA C. What are the relevant standards for other high reliability/availability/security industries, such as Space Aircraft Banking/financial Automotive Medical Defense/Military ??? ...

What are your "hard rules" about commenting your code?

I have seen the other questions but I am still not satisfied with the way this subject is covered. I would like to extract a distiled list of things to check on comments at a code inspection. I am sure people will say things that will just cancel each other. But hey, maybe we can build a list for each camp. For the guys who don't comm...

Unobtrusive javascript : <script> at the top or the bottom of the html code ?

I've recently read the Yahoo manifesto Best Practices for Speeding Up Your Web Site. They recommend to put the javascript inclusion at the bottom of the HTML code when we can. But where exactly and when ? Should we put it before closing </html> or after ? And above all, when should we still put it in the <head> section ? ...

Refactoring Code: When to do what?

Ever since I started using .NET, I've just been creating Helper classes or Partial classes to keep code located and contained in their own little containers, etc. What I'm looking to know is the best practices for making ones code as clean and polished as it possibly could be. Obviously clean code is subjective, but I'm talking about ...

Why are try blocks expensive?

I've heard the advice that you should avoid try catch blocks if possible since they're expensive. My question is specifically about the .NET platform: Why are try blocks expensive? Summary of Responses: There are clearly two camps on this issue: those that say that try blocks are expensive, and those that say "maybe a tiny little bit...

Should a project manager enforce coding standards?

Running a team of about 10 developers, mostly working in their own components, is it absolutely needed to force certain coding standards? Example 1 in function names: perform_action vs performAction vs PerformAction Example 2 in Using hungarian notation vs not. The reason I would not like to force coding standards is because each ...

Best Practices : Where to place required files

I'm working with a number of 'helper' classes, which affectively have a bunch of static functions which allow the controllers and actions have access to chunks of shared functionality. Problem is that these files have been used as a dumping ground for any functionality which is required across the modules/application and as a result the...

How do you document your coding standards?

What have you found to be the best way to publish your coding standards and why? ...

What are the naming guidelines for ASP.NET controls?

We are in the process of nutting out the design guidelines we would like to use in our development team and got into a discussion today around how ASP.NET controls should be named. I am talking about our good friends Label, TextBox, Button etc. We came up with the following three possibilities that we voted on: (Example is a TextBox to ...

Are there any style guides for HTML?

I have found that my HTML is, to be honest, very clunky. Small, simple pages are OK. But there comes a point when between indenting and the kinds of tags I have, it's impossible to keep lines short. Is there a W3C (or otherwise "official" or well accepted) formatting guide for clean, maintainable HTML? If not, what suggestions can the co...

Idiomatic use of std::auto_ptr or only use shared_ptr?

Now that shared_ptr is in tr1, what do you think should happen to the use of std::auto_ptr? They both have different use cases, but all use cases of auto_ptr can be solved with shared_ptr, too. Will you abandon auto_ptr or continue to use it in cases where you want to express explicitly that only one class has ownership at any given poin...

What conventions exist for ordering arguments in methods?

A colleague and I are discussing best practices regarding ordering method parameters. The goal is to establish a standard in our organization to improve readability and productivity by giving our methods common signatures. We are merely establishing guidelines for the recent grads we are hiring. Example (userId is always passed in t...

Are there any coding standards for JavaScript?

What are the established coding standards for JavaScript? ...

C++ Coding Guideline 102

If you were allowed to add another coding guideline to the 101 guidelines of the "C++ coding standards" (Herb Sutter and Andrei Alexandrescu), which would you add? ...

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

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