Archive | CODE

Projects Drop Down

Adding Code Metrics To Your TeamCity Build

Posted on 03 September 2010 by simon.crozier

Introduction

In our last blog posts we’ve been looking at code coverage reports and how to improve code coverage. We’ve been doing on the assumption that fully tested code is good code. While that assumption is true to an extent it’s not the full picture. A 100% coverage score tell us that all the code is visited by at least test, even putting aside that the tests may be flawed or incomplete does this even ensure good quality code. Indeed what is good quality code ? Its more than possible to write a 100 line “God” method that just does everything using various control structures such as “if /else” and “for / do”. It’s entirely possible to make this code functionally correct then fully and properly test it giving it a 100%  coverage score . But that doesn’t get round the fact the code is difficult to understand and deal with thus making edits hard. Even if your test highlight inaccuracies and regression your not exactly helping the developer that has to work on the code after you.

How – Code-Metrics

This is where code-metrics step in, using certain key indicators we detect and track “code quality”.  Now I’m sure that will have raised a few eyebrows, how can you detect and track something so unquantifiable as quality if its not described purely by functional correctness. First of all this is not an exact science, these are indicators they highlight possible areas to look at they don’t define or guarantee quality. Secondly they’re not boolean, they don’t give you yes or no that’s good quality code, broadly speaking the metrics are calculated and then there is a recommended range that the value should fall in.

Now metrics are a funny game, they seem like a very coarse tool trying to give information on what appears to be  a very complex problem but choosing the right ones and interpreting correctly with reference to historic figures provides a surprisingly accurate “health check” of your code-base.

What’s The Plan?

Over the course of this post we’re going to look at using a freeware tool called SourceMonitor to  automatically build-up a code-base metrics report for each build triggered by TeamCity. Then in a very similar manner to our coverage reports we’re going to feed these metric valves back into TeamCity for evaluation. Later we’ll look at getting TeamCity graph each of these metrics allowing us a quick per build health check on the code base. Hopefully allowing us to target our “bad” on a per method basis and gradually improve our scores, overtime improving the code quality making it easier to understand and  simpler edited which has to be good for everyone.

Continue Reading

Comments (0)

Realtime analytics for Twitter coming soon?

Realtime analytics for Twitter coming soon?

Posted on 13 July 2010 by bomski

Over at the engineering blog at Twitter; an interesting mention of  ‘Cassandra’ has appeared; Reading further into this; it would appear that the guys at Twitter are proposing to use Apache Cassandra for their new realtime analytics product. It remains to be seen whether or not Twitter will be charging for this service, as part of their “monetisation strategy”.

Cassandra is a second-generation distributed database that was open-sourced by Facebook back in 2008.

Comments (0)

Microsoft’s new Web Development Suite – WebMatrix

Microsoft’s new Web Development Suite – WebMatrix

Posted on 13 July 2010 by bomski

Microsoft has announced a complete web development package called WebMatrix.

WebMatrix is everything you need to build a static or dynamic website – the package encompasses IIS Developer Express (a dev webserver), ASP.NET (web framework) and SQL Server Compact (embedded database).

The package integrates code editor, database editor, web server management, SEO, and FTP publishing, allowing you to seamlessly build, develop and deploy your web project.

WebMatrix provides an easy way to get started with Web development. With an integrated code editor and a database editor, Web site and server management, search optimization, FTP publishing, and more, WebMatrix provides a fresh, new Web site development experience which seamlessly bridges all the key components you need in order to create, run, and deploy a Web site.

WebMatrix is currently in Beta testing; however it is freely available for Windows users – Give it a spin!

Comments (0)

absolut

jQuery Validation

Posted on 09 July 2010 by admin

The code sample below is using the plugin ‘syntaxhighlighter’; Usage as follows:

[codetype] – where codetype is language (i.e. javascript, c#, etc)

//code sample

[codetype]

Working example follows (check the source of the post in HTML view for more info:


$("#CustomerForm").validate({
rules: {
FirstNameEdit: { required: true },
LastNameEdit: { required: true },
EmailEdit: { required: true, email:true }
}
});

Comments (0)