Three .NET "tools" that I use every day and you want to know about

Time is a very limited and expensive resource. As a software developer I feel more often than not that I just don’t have enough of it…

That’s why whenever I find a new library or tool that save me time I embrace it with both hands, especially if they preform tasks that I find boring and tedious.

the following is a short list of three such tools that I find myself using daily because using them means that instead of writing the same code over and over again I get to focus on more interesting aspects of my job.

Configuration Section Designer

What is it: Visual Studio (2008/2010) add-in

License: Microsoft Public License (Ms-PL)

Website: http://csd.codeplex.com

Most project I know have some form of configuration, in the .NET world it usually means one or more XML files that have various key-value pairs that are used to store “configurable” application settings. The problem is that if you want to harness the full power of configuration that is available you have to learn quite a lot about configuration sections and/or write quite a lot of boilerplate code to serialize and de-serialize the configuration files properly.

Enter Configuration section designer – a visual studio add-in that help create and edit configuration sections (structure) visually. It’s really simple to use and about after 5 minuets you’ll be able to use it to create the configuration files you’ve always wanted.

After visually creating your configuration design you get the following:

  1. XSD schema that you can use to add intelligence to your configuration files creation process
  2. A config fie with simple outline that you can fill.
  3. C# serialize/de-serialize file that is simple and easy to use to load/save the files from your application

CSD saves me hours each week - It slices, it dices and it verifies that your configuration is valid. I can created custom types and converters and it manages to stay simple and easy to use.

This open source project was dormant for quite some time and I’ve started to think its development was stopped, but I’m glad I was wrong with the new version that supports VS2010 CSD seems more alive than ever!

AutoMapper

What is it: .NET library

License: MIT license

Website: https://github.com/AutoMapper/AutoMapper

 

I hate writing conversion code. Converting one class to another class is tedious, error prone and it feels just “wrong”.

The problem is that there are quite a lot of architecture solutions that requires converting object from system A to a different object in system B. Luckily with AutoMapper all of the A.X = B.Y code just go away.

Mapping from the application’s internal object mode to DTO (Data Transfer Objects) or view model has never been easier. With a plethora of conversion abilities from simple property to property mapping up to custom converters. And if you build your classes the right way most of the conversion is done automatically.

It’s well documented and has a very good getting started guide that would get you up and running in no time. Using it at work was a simple matter of Add reference and I was ready to go. Since then AutoMapper has helped me rid of quite a lot of hard to read, error prone lines of code.

PostSharp

What is it: .NET library

License: Commercial (has free edition)

Website: http://www.sharpcrafters.com/

I’ve started been using PostSharp extensively and never looked back. I keep finding new ways to harness its power and I’m happy to see that more and more of my co-workers are solving problems easily using AOP (Aspect Oriented Programming).

Using PostSharp I’m able to create “attributes” that encapsulate cross-application concerns and I’ve stopped counting the times that my logging attribute has helped us track a bug in one of our servers.

Conclusion

With each new tool under my belt I become better at my job. The examples above are only three such tools and I’m always happy to learn about a new one I can use.

So if you enjoy learning new tricks - try them for size and decide if they’re good for you.

 

Happy coding…

Labels: , ,