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

February 13. 2013 09:37 AM

Saeed Neamati

This is one of the most useful articles I've recently read. Code quality is something which is usually ignored in small-teams (even large-teams) and would result in higher costs in maintenance phase.

Saeed Neamati

April 25. 2013 01:42 AM

Mark D.

I like this article! Congratulations!

Mark D.

April 25. 2013 04:56 PM

Tasos

Very good article my friend! I was very happy to discover this great site.

Tasos

April 27. 2013 12:43 AM

Dimitris

Do you really need to eat every few hours, in order to lose weight? The notion that frequent meals boost the metabolism and prevent the loss of muscle mass has never been proven.

Dimitris

April 27. 2013 02:25 PM

Mike

Keep in mind that spikes in blood sugar increase insulin secretion that triggers the fat deposit and especially abdominal or deep visceral fat.

Mike

April 28. 2013 04:56 PM

John William

Fat Loss Tko was created by Chad Howse and is based on the ‘old school’ principles that give boxers such impressive physiques. Chad Howse has modernized these old school workouts, so as to fit in our current lifestyle.

John William

April 29. 2013 03:34 PM

Maria

Sex God Blueprint is one of the most successful guides on the internet that can help you improve your power in bed and turn you into a Sex God!

Maria

April 29. 2013 09:43 PM

Denis

The Gastric Band Hypnotherapy program by Jon Rhodes attempts to simulate gastric band surgery.

Denis

April 30. 2013 03:08 PM

Dimis

I like this site! Very good jobs! Congratulations!

Dimis

May 14. 2013 01:34 AM

Malena

Beautiful post!

Malena

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