How to Increase Code Quality

A while ago we decided on my team that we needed to increase our code quality. We were excited about that and thrilled to get it started with.
Then we looked at each other eyes, saw the passion to write better code but… something was missing!

How to Increase Code Quality - IronShay.com

When you think about it – how do you write better code? how do you increase your code quality?

With the help of the great people on StackOverflow, I managed to gather a list of principles that can take your code to the next level:

Testing

Learn how and write write write tests! you don’t have to go for TDD, but remember to test your code  and make sure it runs as  it is expected to before it leaves the dev environment. Tests include unit and regression tests.
You can use NUnit, TypeMock  for .Net languages or other testing frameworks (every language has some).

Code Reviews

Allow other developers to go through your code before you’re done with it; You and them will learn from that.
There are tools to help you with the code review process like Crucible.
I must say it’s magic! we implemented that on our team immediately (no tools currently, we just sit with each other) and several bugs have already been prevented because of that in only a few weeks!

Standards

Agree on coding standards and stick with them. This will help you understand other developers' code, reduce different code blocks that handle for the same issues and prevent bugs eventually.
Standards include:

  • Coding standards – naming conventions for example.
  • Exception handling standards – how to handle exceptions throughout the application.
  • Logging standards - how and when to write log entries.
  • Whatever you and your team decides on.

You can enforce standards with third party tools like: FxCop, StyleCop or Code Style Enforcer.

Use Tools to Help you Code Better

Like Resharper.

Design Reviews

Design before you start coding and get your design reviewed before implementing it.

Read Related Books

Like Code Complete: A Practical Handbook of Software Construction or other books.

Talk and Meet with your Team

Talking makes wonders. Talk with your colleagues frequently and schedule a weekly meeting where every developer presents one interesting or important piece of code he/she have written during the week.

Coding

  • Try to simplify the problem as much as you can.
  • Try to break the code into small and well defined functional units (folders, files, namespaces, classes, methods) to keep the codebase logically organized and well structured.
  • Document the code. Document it so your colleagues will understand it without your help.

Source Control

Work with a source control system like SubVersion, CVS, Git, Team System or others.

Learn Other Languages

Even if those languages are not appropriate for your production code, you can find ideas in them and you can build your own internal tools with those languages.
My recommendation - learn IronRuby!

Own a Build Machine

A continous integration machine which automates the build process is a life saver. It can automatically build the application after every commit (or whenever you tell it to), run unit tests and create a setup project that people can immidiately go and install. It saves so much time! it also saves you from hitting your head against the wall when doing these repeating tasks youself.
Look here for a list of continuos integration applications.

I liked what Mark has written so I'm going to finish with that: "Quality is Free -- quality is conformance to specification and is built-in, not bolted on".

All the best,
Shay.

kick it on DotNetKicks.com

Shout it


Comments

August 31. 2009 05:26 PM

pingback

Pingback from topsy.com

Twitter Trackbacks for
        
        IronShay | How to Increase Code Quality
        [ironshay.com]
        on Topsy.com

topsy.com

September 1. 2009 10:38 AM

Giorgio

This is a good checklist on applying a methodology to coding.

Giorgio

October 8. 2009 11:44 PM

trackback

.Net Developers Hear Me Out! IronRuby is IN DA HOUSE!

.Net Developers Hear Me Out! IronRuby is IN DA HOUSE!

IronShay

January 18. 2012 08:58 PM

lawn mowing

It has every of the essence news so when I take to mean this site that I have been extremely constructive and I assume it very obligatory all group of people.

lawn mowing

January 24. 2012 08:24 PM

lawn maintenance

I replicate it have supplementary info so it terribly pleasant idea by site owner so appreciation to owner for this conservative understanding.

lawn maintenance

February 3. 2012 08:00 PM

topsoil

I think it have all more info so it very nice idea by site owner so thanks to owner for this thinking.

topsoil

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading



Subscribe Subscribe

That's Me!

Hi! I'm Shay Friedman
I'm Shay Friedman - a Visual C#/IronRuby MVP, a consultant and instructor of .NET technologies, author, speaker and new technologies freak
More about me

Contact Me

> Contact page
> Twitter: @ironshay
> LinkedIn profile

Search

Hosted By

I'm hosting this site on Arvixe and I'm very happy with it.
If you're looking for ASP.NET hosting, I highly recommend it
(and if you order from this link I also get some beer money!)
Web Hosting