Evolution of coding
Rate this post

Many years ago, back in Uni, I saw 2 guys in a computer lab writing a whole programming assignment without running it even once. The program was of relatively decent size written in C and consequently there were hundreds of compilation errors. That’s so silly, I thought…

After graduation I used to be a C++ programmer. The syntax sometimes was quite tricky and you would often compile after every new line of code. Sometimes, you would dare to write a whole function, just to find 10 compilation errors.

Since then the way I code has changed with help of modern IDE, Visual Studio as well as ReSharper – a productivity plugin. I never get to use just a simple text editor to write a program anymore. Real time static code analysis allows writing code while checking for compilation errors in the current file. With abundance of automatic refactorings a developer can efficiently manipulate a large amount of code.  However, there might be a compilation error in another part of the solution, you still need to run unit tests, debug etc.

Now, for quite some time I’ve been using a new tool called NCrunch – a real time code coverage tool. The idea is simple: it builds Visual Studio solution and runs all available unit and integration tests automatically in the background while you are still typing. There is no need even to save a file. Initially, I thought to give it a go, as it was an innovative way to quickly see the code coverage. However, it turned out to be much more than that…

As my code has a fair amount of automated unit and integration test coverage, the entire system becomes “alive”. Combination of Visual Studio, ReSharper and NCrunch creates quite an extraordinary experience. Not only do I not build my solution too often these days, I only occasionally need to debug my code.

While typing you are being notified of any compilation error, any broken logic, any not registered component in DI container, any db error, etc. (assuming there is automated test to cover those scenarios)

The new experience reminds me of those guys from the uni lab, who never got to run their program before finishing the entire assignment. Not only technologies and development practices are evolving, but the entire coding experience is evolving too. In the past I have followed the pattern: code – build – code – build – debug – code…. Now my development pattern is: code – code – code – code – deploy. (I still need to debug occasionally)

There are additional, interesting projects promising to further revolutionize the ways we interact with computers through programming languages. One such idea is real time state output of a method while it is being written. Here is amazing video by Bret Victor – Inventing on Principle: http://vimeo.com/36579366. There was one attempt to achieve the same in c# code. http://ermau.com/making-instant-csharp-viable-visualization/ https://github.com/ermau/Instant It looks very promising for algorithms development, but unfortunately, there are no solid commercial products available yet.

Below are some snapshots of nCrunch. For more details go to www.ncrunch.net:

1) By clicking on a dot you can see a list of all tests covering that line, passing and failing.

Image

2) By clicking on a “x” you can see where the code failed

Image

3). The test’s assertion failure is clearly seen below:

Image

4) Compilation errors are indicated in a following windows:

ncrunch_comp_errors

NCrunch is being actively developed and maintained. Give it a try!

Category:
Application Development and Integration
Tags:
, , ,

Leave a Reply

  Subscribe  
newest oldest most voted
Notify of
Mark Cheeseman
Guest
Mark Cheeseman

I would certainly echo your sentiments here about the value of nCrunch, which I have also been using for a while now. For anyone using a TDD type of approach to coding, or wanting a tool that tends to push you in the right direction nCrunch is great. It is so nice to simple code away and every now and then pause, wait a few seconds and see the red or green appear. About the only issue I’ve run into the ol’ performance problem. Once you have Visual Studio started, with Resharper, and nCrunch running, even a capable machine can… Read more »

Dan Neely
Guest
Dan Neely

nCrunch looked neat when I saw a free demoware version of it last year; unfortunately my worries about pricing (TBD then) have came true. $160 is well above what I’m willing to spend out of pocket; and $290 is enough to make the bean counters in corporate IT choke.

Follow Us!

Kloud Solutions Blog - Follow Us!