Friday, October 31, 2008

Code Smell Riddle #22

q. I have two sets of methods
that basically do the same work.
Change their name and code to match
Or I will certainly go berserk!

a. Parallel Inheritance Hierarchies

If you need help, here is a LIST of the remaining 2 Code Smells for this riddle series.

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

Post a comment with your guess :)

~/riddle by me

Code Highlighters For Your Blog

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 :)

The Windows Live Writer plug-ins that I recommend are...

Thursday, October 30, 2008

An NDepth Look @ NDepend

Synpopsis

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 :)

Code Smell Riddle #21

q. A collection of reusable methods,
Can be extremely handy when in a bind,
But can be all together aggravating,
When the desired one, you can not find!

a. Incomplete Library Class

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.

Post a comment with your guess :)

~/riddle by me

Monday, October 20, 2008

Code Smell Riddle #20

q. I'm not fond of your scavenger games;
I like my things to be easily found.
So please move your code in such a way,
That change doesn't require a look around!

a. Divergent Chang

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.

Post a comment with your guess :)

~/riddle by me

Tuesday, October 14, 2008

Code Smell Riddle #19

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.

Post a comment with your guess :)

~/riddle by me

Monday, October 13, 2008

Code Smell Riddle #18

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.

Post a comment with your guess :)

~/riddle by me

Friday, October 10, 2008

Code Smell Riddle #17

q. When you link method to method,
I can get super long really quick.
You should cut out the middle man;
Breaking the hierarchy is the trick.

a. Message Chains

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.

Post a comment with your guess :)

~/riddle by me

Nashville .NET User's Group Presentation

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.

You might be interested in keeping up with me via:

Email elijah.manor@gmail.com
Twitter http://twitter.com/elijahmanor
.NET Tech blog http://webdevdotnet.blogspot.com
Stack Overflow http://stackoverflow.com/.../elijah-manor
Tech Riddle blog http://manorisms.blogspot.com
Personal blog http://elijahmanor.blogpot.com

Thanks for everyone who came... there was an awesome crowd!

Tuesday, October 07, 2008

Code Smell Riddle #16

q. I store lots of information goodies,
But I take no action whatsoever.
You should find whoever uses me,
Plan to move their logic, and sever!

a. Data Class

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.

Post a comment with your guess :)

~/riddle by me

Monday, October 06, 2008

Code Smell Riddle #15

q. You might consider me small potatoes,
but I'm just as qualified as the rest.
Instead of using those elementary types,
why don't you add some tiny object zest!

a. Primitive Obsession

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.

Post a comment with your guess :)

~/riddle by me

Thursday, October 02, 2008

Code Smell Riddle #14

q. You should really learn to keep to yourself;
There are certain places you should never be.
My private places aren't meant for your eyes,
In regard to your behavior, I highly disagree!

a. Inappropriate Intimacy

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.

Post a comment with your guess :)

~/riddle by me