Alex Rivera | Logout

Besides "treat warnings as errors" and fixing memory leaks, what other ideas should we implement as part of our coding standards?

Asked 2009-11-05T15:13:30.947
11

First let me say, I am not a coder but I help manage a coding team. No one on the team has more than about 5 years experience, and most of them have only worked for this company.. So we are flying a bit blind, hence the question.

We are trying to make our software more stable and are looking to implement some "best practices" and coding standards. Recently we started taking this very seriously as we determined that much of the instability in our product could be linked back to the fact that we allowed Warnings to go through without fixing when compiling. We also never bothered to take memory leaks seriously enough.

In reading through this site we are now quickly fixing this problem with our team but it begs the question, what other practices can we implement team wide that will help us?

Edit: We do fairly complex 2D/3D Graphics Software that is cross-platform Mac/Windows in C++.

Edit
Report

3 Answers

3

Code reviews have been shown to provide significant benefits to code quality, even more so than traditional testing. I would suggest getting in the habit of performing routine design and code reviews; the number of stages at which reviews are performed, the formality and detail of the reviews, and the percentage of work subject to review can all be set according to your business requirements. Coding standards can be useful when done right (and if everyone's code looks similar, it is also easier to review), but where you put your braces and how far you indent blocks isn't really going to affect defect rates.

Also, it's worth familiarizing yourself and your peers with the concept of technical debt and working bit by bit to redesign and improve parts of the system as you come in contact with them. However, unless you have comprehensive unit testing and/or processes in place to ensure high code quality, this may not help things.

answered 2009-11-05T16:42:49.837
2

These basics are good for most any industry or team size:

  1. Use Agile methodology (scrum is a good example). http://www3.software.ibm.com/ibmdl/pub/software/rational/web/whitepapers/2003/rup_bestpractices.pdf
  2. Use Test-driven development. http://www.agiledata.org/essays/tdd.html
  3. Use consistent coding standards. Here is an example document: http://www.dotnetspider.com/tutorials/BestPractices.aspx
  4. Get your team familiar with good design patterns. http://www.dofactory.com/Patterns/Patterns.aspx

You can't go wrong with these basics. Build from there with new team members who have been there and done that. I'd strongly suggest pair programming once you've got those guys on the team. It is the best way to infect people with best practices.

Best of luck to you!

answered 2009-11-05T16:08:11.350
0

I really like: MISRA C standard (it's a little strict tho' but the ideas hold for C++) and Hi-Integrity's http://www.codingstandard.com/HICPPCM/index.html C++ standard which borrows heavily from MISRA

LDRA (a static analysis tool) uses these standards to grade your work (this I don't use as it's expensive) but I can vouch for running cppcheck as a good 'free/libre' static analysis checker.

answered 2009-11-06T15:27:18.650

Your Answer