Written materials

Bits and pieces about programming and design…

The last post

Posted by Marc Vangrieken on May 13, 2008

Dear Readers,

This is my last post on Written Materials. I decided to create a new blog on www.viss.be/blog. There will be three sections; in-depth articles, diary posts and links.

Everything you see on Written Materials today are diary posts; a few lines on what I’m working on, a book I’ve read, etc… Writing lengthy articles will be totally new for me, a huge challenge! It’s my goal to start blogging “the right way”, with a focus on quality content. The links section will contain a listing of things I’m sharing in Google Reader and del.icio.us.

I’m working on the CSS and the WordPress plugins as we speak, the site should be online in 2 weeks. Until then; there will be no more posts here. Some of the old post will be ported to the new blog, but not all. I may even re-write them.

Marc

ps. Viss stands for Vangrieken’s Impressive Software Services. More on that later…

Posted in Uncategorized | No Comments »

How you didn’t think a book on unit testing would start

Posted by Marc Vangrieken on May 3, 2008

This is how Roy Osherove starts his “The Art Of Unit Testing”.

One of the biggest failed projects I worked on had unit tests. Or so I thought. I was leading a group of programmers to create a billing application, and we were doing it in a fully test-driven manner – writing the test, then writing the code, seeing the test fail, making the test pass, refactor, rinse, repeat. The first few months of the project were great; things were looking up, and we had tests that proved that our code worked. As time went by, requirements changed, and we were forced to change our code to fit those new requirements. Whenever we changed the code, tests broke and we had to fix them – the code was still working, but the tests we wrote were so brittle that any little change in our code broke them, even though the code was working just fine. It became a daunting task to change our code in a class or a method for fear of changing all the unit tests involved with that unit being tested.

The entire intro can be read here.

Posted in Software development, Unit Testing | No Comments »

A quote from Linq In Action - The LINQ book

Posted by Marc Vangrieken on April 7, 2008

Although this is gratuit blogging and I shouldn’t be quoting from a book; here we go… I found an interesting passage in the performance considerations section of Linq In Action, a “new” book on LINQ by Fabrice Marguerie, Steve Eichert and Jim Wooley. It’s basically saying, as a rule of thumb, not to over-use LINQ to Objects.

If we look at this the other way around, we could say that the less work there is to do in the query, the higher the overhead appears. There are no surprises. LINQ does not come for free. LINQ queries cause additional work, object creations, and pressure on the garbage collector. The additional cost of using LINQ can vary a lot depending on the query. It can be as low as 5 percent, but can sometimes be around 500 percent.

In conclusion, don’t be afraid to use LINQ, but use it wisely. For simple operations that are executed extensively in your code, you may consider using the traditional alternatives. For simple filter or search operations, you can stick to the methods offered by List<T> and arrays, such as FindAll, ForEach, Find, ConvertAll, or TrueForAll. Of course, you can continue to use the classic for and foreach statements wherever LINQ would be overkill.

I completely agree with this and although it could be considered common sense; it’s a often forgotten! On the book: If you are totally new to LINQ; this book is all you need! If you are already more experienced on the subject; i’ll bet the “Manipulating XML” part of the book will still please you.

Also note that Manning Publications has an Early Access Program (MEAP). I’m considering to buy The Art Of Unit Testing (by Roy Osherove) as an early access edition.

Posted in .NET, .NET 3.5, LINQ, LINQ To Objects, Software development, VS2008 | 2 Comments »