tags:

views:

91

answers:

2

When I usually write code I follow some guidelines to ensure that my code has a certain standard and I as any other developer try to ensure that my code and software is of quality.

Try to focus on the programming and not the understanding of the domain or any other pre-programming steps(in the answer that is!).

These are the following steps I live by:

Writing unit tests

  • Make it fail ( no code )
  • Make it Work ( working code )

Analysing abstraction

  • Extracting methods
  • Exteract interfaces

Refactoring

In addition to the above which is a part of refactoring, I also try to refactor the code with good tools such as ReSharper, CodeRush or others.

The question; What is the next step?

Commenting the code is trivial and shouldn't even have to be mentioned, but updated comments and xml-comments where it's needed / everywhere is something that I try to have.

But all the above helps he ensure that other developers might understand my code, that the code has some sort of quality and follows naming standards.

It does however not ensure any product quality.

I am looking for tools for post-development quality ensurance, such as profilers and how one would use these tools to increase product quality.

+6  A: 

The single most-important thing is that you and your colleagues are experienced programmers. No rules or guidelines will make the product better if the programmers are not highly skilled.

According to some sources, code reviews can catch many serious errors, even more than unit tests. Formal code reviews work even better than informal code reviews.

A code review has two goals:

  • Improving the code, by spotting errors and removing them.
  • Improving the developer, by continously providing feedback on his work.

The latter seems to be sometimes forgotten, but is really important in improving the developers skills.

Sjoerd
That's kind of what refactoring does, isn't it? Finding "bad" code and remove it. But +1 for "colleagues are experienced programmers", even though that's (hopefully) what one gets when you work on a software company.. in a perfect world anyways :)
Filip Ekberg
IMHO refactoring is about making code that already works work in a "better" (or more efficient) way. A pure refactoring does not alter the functionality of the code. But it otfen exposes or hightlights parts of the code that would benefit from modified functionality.
MEMark
By definition, refactoring does not change functionality. I am talking about "bad" code in that it contains bugs, which refactoring does not fix. The product quality is not influenced by refactoring, as the end user only sees the functionality, not the code.
Sjoerd
@Sjoerd, Well the question somewhat states that I am looking for tools for this, is there a tool called "code review" which you recommend? Simply looking at the code wont ( in most cases ) find the bugs.
Filip Ekberg
@Filip: we are talking about looking at the code, and this has been proven to catch more bugs than testing, believe it or not. See http://www.basilv.com/psd/blog/2007/strategies-for-effective-code-reviews for one source of this information. Whilst there are tools that aid the review process, they don't do it for you.
Martin
+2  A: 

Filip

I have looking for some kind of tool to help me too but the one very effective way I have found of doing this is:

  1. have another developer develop the unit test
  2. have have short code review meeting within the team where each team member can comment and give their opinion on the code.

I have found that having regular review meeting makes everybody follow the guidelines and also it makes for a great learning environment for new team members.

Shivam
Thanks, do you use TDD? Or when do you write the tests?
Filip Ekberg
TDD all the time. I find it is the best way to get a set of useful test. We also do daily build and we run all our unit test on the daily build. This did not only improve the quality of the code but it also gave the whole team enough confidence to take ownship of the whole project.
Shivam
So, you write your own test ( the driven tests that is ) and someone else creates unit tests / larger functionallity tests?
Filip Ekberg
yes the TDD test are basically my test to see if the code is doing what I think it should be doing and the unit tests are the test that somebody else does to test my code to see if it matches what the specifications mean. This two person testing I think makes for better quality even if it might see as an overkill to have so much testing.
Shivam