I recently tweeted that I thought the SyntaxHighlighter is the best way to display code on your blog. In response, I had some who were a little confused how to get started with the tool. The tool isn't as straight forward as some other tools. There are several steps you will need to take in order for it to work on your blog.

Since my tweet, I have reconsidered my initial recommendation for new users. The look and features of SyntaxHighlighter are nice, but it does take some setup on your blog, some manual manipulation of your code, and presents a slight delay during render time (since it is dynamically manipulated via JavaScript).

I plan to start using SyntaxHighligher from now on and I would recommend it for bloggers that post a lot of code, but if you an occasional code poster, then one of the following Windows Live Writer plug-ins might be a better solution for you (they are much simpler and faster to render and takes no setup on your blog). All that said, you might even like the plug-ins better than SyntaxHighlighter... and hey, that's fine by me :)

Thursday, October 30, 2008

I've been wanting to review NDepend for quite some time, but I figured it was bad form to run it against my production code from work.

So, instead of running the tool against my work code, I thought I'd use the PetShop ASP.NET MVC project that I created for the .NET User's Group.

NDepend provides many ways to visualize the architecture of any particular project. To create the following pictures and diagrams all I did was point NDepend to my Visual Studio solution file.

Dependency Graph

A useful way to get an understanding of how your application architecture is to generate a Dependency Graph based off your code. The following graph shows show the PetShop pieces relate to one another.

Dependency Matrix

For those of you who are graphically challenged, there is a Dependency Matrix that does a nice job of showing how many dependencies there are between 2 particular areas of your design.

Code Metrics

The next diagram has always impressed me. Even if you didn't know what it meant... it is pretty impressive to just look at :) The following diagram is actually showing the Code Metrics for your project. The following image represents the number of lines of code (LOC) in your project.

CQL Queries

In addition to all these cool graphs, matrices, and images, there are some hard core queries that you can perform against your assemblies. NDepend has something called Code Query Language (CQL) that allows you to write custom queries to identify numerous statistics such as:

Which public methods have more than 30 lines of code?

Which classes implement System.IDisposable?

Which methods have been refactored recently and is not thoroughly covered by tests?

etc...

The following is an example of what a CQL query looks like. This query identifies the methods that are too big in your assembly. NDepend comes with a library of already created queries, such as this one, but you are able to add to or customize these quieres as well.

Conclusion

There is so many more features that I haven't covered that NDepend provides, but I wanted to highlight some of the features that I thought are very useful and could help you in your current projects.

I think this tools adds some great functionality that dovetails nicely with the features of from the various Visual Studio suites.

Don't just take my word for it, I encourage you to download a trial version of NDepend and check it out for yourself.

Then if you like it, make a list of the features that are useful for your project, show it to your boss, and see if your work will pay for it :)

Tuesday, October 14, 2008

q. Between you and me I tend to be quite the conundrum;A side effect of complexity way beyond my own good.Unless you extract me from my overly convoluted mess,I will forever be thoroughly dazed and misunderstood.

a. Temporary Field

For a list of the 22 Code Smells feel free to visit the Code Smells website.

Need help? Here is a list of remaining Code Smells for this riddle series.

Monday, October 13, 2008

q. I love to be on the cutting edge of ignorance;Black boxes are the greatest thing since sliced bread.But if the smoke and mirrors point to another box,Then you might as well just send me there instead.

a. Middle Man

For a list of the 22 Code Smells feel free to visit the Code Smells website.

Need help? Here is a list of remaining Code Smells for this riddle series.

Yesterday I gave my first User's Group (UG) presentation at the Nashville .NET UG entitled... "A Crash Course in ASP.NET MVC".

In the presentation I gave an overview of what MVC is, explained some pros & cons of using it, answered some common questions, presented a demo application that I developed (Pet Shop 5), and then I dived into the demo's code.

You can download the content that I presented at the User's Group below...

*Note: There is some additional slides at the end of the slide show that you might find interesting.

You also might want to check out a blog post I created a month or so ago intended for ASP.NET Web Form developers to quickly get up to speed on the concepts of ASP.NET MVC. A lot of the material is about pre-Preview 5 releases of ASP.NET MVC, but I still think it would be beneficial for most developers. If you so choose, you can directly link to the document hosted on Google Documents.