Archive for the_time('F Y')


23 June 2008 in .Net & Tools | Comments (4)

Generating code metrics is becoming more and more common with development tools these days – we’ve seen Visual Studio 2008 start to add some basic metrics such as cyclomatic complexity and “maintainability index”. This is all driven by an increased awareness of the difficulties of creating maintainable and reliable software as our software solutions become larger and more complex.

At Mindscape we even published some metrics about an earlier version of LightSpeed. I completely agree with Andrew’s comment that it would be beneficial for commercial software vendors to be more transparent about their code quality – especially when those vendors are providing developer tools. We’ll update our LightSpeed metrics on the Mindscape blog soon.

NDepend logo

When it comes to deep code metrics I think you’d be hard pressed to find a more comprehensive tool than NDepend. NDepend is dedicated to code metrics and because of that dedication you’ll find you can spend days exploring everything this tool can do – I tell you this because this blog post will just scrap the surface of what can be done so I recommend you explore the tool yourself to find what parts you get the most value from.

Getting started

NDepend ships with command line tools and CI integration tools but I’d recommend starting out by playing with the VisualNDepend tool. Here you can easily create a new NDepend project and add assemblies that you want to analyse.

NDepend initial screen with LightSpeed setup

Lets get some analysis done

So how do we start digging into the really meaty analysis? Hit F5, it’s go time!

This generated html file includes data about almost everything you could think of measuring. Basic information such as lines of code are presented first but aren’t off a huge amount of value.

Let’s have a look at a graph of abstractness vs. instability. This helps you quickly identify if your application is in the “Zone of pain” or the “Zone of uselessness”. Ideally you don’t want to be in either and want to ride the fine line between the two. Here’s the break down for LightSpeed and the LightSpeed LINQ provider:

LightSpeed abstract vs stability graph

I’m pretty comfortable with that – we’re in the green zone!

What does this mean?

  • Stability means that there are a lot of dependencies on an assembly.
  • Abstract means that the assembly is very extensible.

So we would end up in the zone of pain if we have a very stable assembly but it’s not extensible. You can imagine working with such a project – any changes have a huge ripple effect and if you’re working with the a project depending on it, you have very little ability to actual alter the behavior of that dependency.

Conversely, we end up in the zone of uselessness when an assembly is very extensible but nobody is actually using it (no dependencies upon it).

LightSpeed assemblies seem not to be depended on by other assemblies (I excluded the 10+ Unit Test libraries for this) and aren’t overly abstract. This is by design – we do have a rich API but you don’t really want to be fiddling in the absolute core of the product so we’ve tucked away some parts to keep the public API simple and easy to use.

The power of CQL

You tend to know that a product is sophisticated when it includes its own query language and NDepend doesn’t let us down here. CQL allows us to write queries for measuring metrics – for example, we might want to display a warning when a method has too many lines of code, or where cyclomatic complexity exceeds certain levels.

NDepend ships with several of these rules already enabled and some of them have been tripped in our LightSpeed analysis. For example, we have several methods with more than 30 lines of code. That can be useful for identifying areas of our code base that might be worth refactoring.

// <Name>Methods too big (NbLinesOfCode)</Name>
WARN IF Count > 0 IN SELECT TOP 10 METHODS WHERE NbLinesOfCode > 30 ORDER BY NbLinesOfCode DESC

I’d recommend having a play with CQL to write your own queries especially if you’re using CI (you are using Continuous Integration right?) as you can hook NDepend to report warnings.

Visual dependency graph

One area that I’ve found useful with NDepend is the ability to more visually see a dependency hierarchy and better see how your projects fit into the software ecosystem in which they have been developed.

Here’s the output for LightSpeed + LightSpeed.Linq

LightSpeed dependency graph

We can see here the usual suspects – System, System.Data etc but we can also identify other assemblies that might not be obvious. For example, LightSpeed provides support for talking to SQL Server, MySQL, PostgreSQL, SQLite, VistaDB and Oracle and the caching can leverage Memcached or the caching provider in System.Web.

I could certainly see this feature being of use to developers picking up an existing project as it would certainly aid understanding the structure more quickly and efficiently.

What else?

There is considerably more information provided by NDepend and I’ve only covered a few areas that I found most interesting in this review. There is a free version for trial/academic/open source users and a professional version also available. I highly recommend grabbing a trial and exploring your projects – you might be a surprise.

The key with any metrics is knowing how to interpret them and understanding the action that you can take to improve them. My suggestion would be to download the trial, run the analyzer over your code and identify some areas of concern, fix them and then recheck. Continue this cycle for the duration of your trial and I’m sure you’ll find you’re producing better code because of it – something we should all be endeavoring to do.

Go and grab NDepend and start improving your code.

John-Daniel

kick it on DotNetKicks.com

Average Rating: 5 out of 5 based on 240 user reviews.


23 June 2008 in Business & Events | Comments (2)

Things have been progressing at a rapid clip lately and while it has been fun it has resulted in more than a few blog posts where I just announce new things I’ve been involved with. I’m going to work on changing that – not by doing less, but by ensuring I post more about general technology and business.

FlightCheck.co.nz logo

First I’d like to announce FlightCheck. FlightCheck is a YouTXT initiative to provide flight information for travelers either online or via text message.

Check out FlightCheck here: flightcheck.co.nz

Currently you can browse for any delays for flights to any NZ airport. You can also text your flight number (e.g. NZ898) to 8808 and get texted back the departure and arrival time (including changes if there are delays). We’re working on adding other helpful information to this service as well so I appreciate any feedback.

KnowledgeCue logo

Second, while not a business connected to me, I’d like to give a shout out to KnowledgeCue.

KnowledgeCue has been setup by local SharePoint MVP, Chan. Chan has spent considerable time working with SharePoint and has worked with top organisations in Wellington as a SharePoint expert.

You can find out more about KnowledgeCue here: knowledgecue.co.nz

Without a doubt, SharePoint is proving to be a highly successful product for Microsoft but it can be a bit of a tricky beast from an installation/configuration angle and therefore using the services of organisations who have a deep understanding of SharePoint is going to save a lot of headaches for your business.

Now, let’s get back to sharing some coding or business discussion :-)

John-Daniel

Average Rating: 4.4 out of 5 based on 157 user reviews.


9 June 2008 in Microsoft & Tools | Comments (8)

Reading over the last week shows that there is some strong interest in Microsoft’s new “Velocity” project. What is Velocity? It’s a distributed caching framework to aid in scaling out applications over many servers – for example, an ASP.Net website.

That’s cool.

But, wait a minute, doesn’t this sound exactly the same as what memcached does? Almost the defacto standard for distributed caching and developed many moons ago, memchached powers sites like YouTube, Slashdot, Facebook, NYTimes.com to name a few.

I’m a big fan of what Microsoft creates, in fact I’m building a business that sits on top of what Microsoft builds. I appreciated that the initial blog post even referred to memcached and hints at some of what Microsoft might want to add to their caching system to create some differentiation.

What concerns me here is seeing posts popping up about how cool this framework is from various Microsoft geeks from the “ooo – distributed caching!” perspective. Do they not ever look outside the Microsoft world? Do they not realise this is not new? I think it’s an important discipline for developers to keep looking outside their comfort zone to learn new things. This is by no means something I’m perfect at – it’s a struggle when you’re comfortable with what’s already in front of you but, as the saying goes, you don’t know what you don’t know.

I look forward to the future of the Velocity project and I really hope it’s not just a me too project from Microsoft. You can keep an eye on it by subscribing to their blog.

As a mild plug, our LightSpeed object/relational mapping product has included a memcached provider if you’re building suitably large solutions since version 1.0 :-)

John-Daniel

kick it on DotNetKicks.com

Average Rating: 4.4 out of 5 based on 228 user reviews.


5 June 2008 in Code & Mindscape | Comments (5)

I’m super pleased that we’ve just shipped LightSpeed 2.0! This release has been a huge amount of work and I think that shows in how polished and feature full the final release is.

Key new features:

LINQ Provider – Developers can now query using LINQ but still leverage the fantastic performance of the LightSpeed querying framework. This means that with LightSpeed you effectively get LINQ to MySQL, LINQ to PostgreSQL, LINQ to Oracle, LINQ to SQLite and LINQ to SQL Server. We of course included extensions to ensure you could still use our great querying functionality not directly made available through the standard LINQ interface (named aggregates, eager loading etc).

Model Designer – If you’re using Visual Studio 2008 you can install the LightSpeed Designer. This fantastic addition means you can now design your models – everything from entities and relationships down to specific caching and validation concerns on your properties. This is a huge step forward in enabling end users to get up and running quickly with a LightSpeed powered domain model.

LightSpeed domain model designer in Visual Studio 2008

What is particularly kick-ass about this designer is that it supports basic database round tripping. What does that mean? When you drag on a table from the server explorer (if you’re a data centric type of person) and then you later update the database, you can see those changes made to your model without needing to delete them and drag the tables back on. This is fantastic for those people with larger models.

We decided we could take this one step further and introduced some initial rapid database prototyping functionality which means you can make changes in the designer and push those changes down to the database. This is great for rapidly getting up and running.

There is plenty more to come in this space and I look forward to seeing it evolve.

Multi-context support – Earlier versions of LightSpeed were great when you needed to work with one database but things got a wee bit hairy if you needed to access different databases from one application instance. This problem is now solved as we allow multiple contexts within a single application so you can be talking to, for example, Oracle for your store data, SQLite for your configuration data.

These are, in my view, the top three cool new features in LightSpeed 2. There are, of course, heaps of other features that we’ve packed in to help developers work faster and more effectively.

For more information please visit:

The Mindscape Blog
The LightSpeed page
Download the free Express edition of LightSpeed

Happy coding!

John-Daniel

Average Rating: 4.4 out of 5 based on 248 user reviews.


2 June 2008 in Business & General & Mindscape & Tools | Comments (0)

I’m pleased to announce that Valuecruncher is now live!

Valuecruncher - explore,  create and share valuations

What is Valuecruncher?
Aside from clicking the link and finding out directly, Valuecruncher is an online tool to facilitate creating, sharing and finding company valuations. The valuations are created using a Discount Cash flow Model which is a tried and true mechanism for creating business valuations. We’ve worked hard to try and make the site as easy to work with as possible by pre-populating many values required to compute it and providing a nice user interface for creating a valuation. You start with an existing valuation, modify as you see fit and then save. Try it for yourself – click here to go and create a valuation of Apple Computers.

What companies can be valued?
Currently we’ve included many public companies from the NZX50, S&P 500, FTSE 350, ASX 200, TSX Composite. If you don’t know what these mean that’s ok – just browse around and you’ll spot companies you know like Microsoft, Apple, Dell and more.

Currently creating valuations is limited to a selection of public companies that are suitable for a discount cash flow valuation.

What’s the technology behind Valuecruncher?
This is a geek blog primarily so it makes sense to answer this. Valuecruncher is built using Ruby on Rails and the blog is powered by WordPress. The simple interface of the site hides the fact there is some seriously grunty code running behind the scenes.

Who’s behind Valuecruncher?
Valuecruncher is a new business venture that was built by Mark Clare, Sam Stewart, Rowan Simpson, Andrew Peters, Jeremy Boyd and myself. Simply put – Investment bankers, Ex-Trade Me guy and Mindscape.

I’m very happy with what the current site offers but believe me, we have a long list of new exciting features that we’ll be adding to the site in the future. I’ll be blogging about the new features as we release them but I’d urge you to subscribe to the Valuecruncher blog and join the site so that we can keep you in the loop more directly :)

Even if you’re not a finance person, I would really appreciate any feedback you can provide!

John-Daniel

Average Rating: 4.9 out of 5 based on 171 user reviews.