Sunday, August 23, 2009

Why code reviews should be a teamthing

Often code reviews are done by one person, the technical lead of your team.

In my opinion it's better to make each developer of your team do code reviews.

My arguments
  1. Having all developers doing code reviews enforces well-documented coding standards..
  2. Which also leads to discussions about what these codings tandards should be.
  3. Each developer is forced to understand the workflow of an application which isn't his, which expands his domain knowledge.
  4. Each developer learns from others and is given an opportunity to teach and discuss why someone chose a certain path.. There is always something new to learn, even for seasoned developers. You might just pick up that latest trick doing whizbang Silverlight 3 stuff from that freshman that just started working this year.
  5. Multiple perspectives on a problem can only benefit the solution.

What are your thoughts?

Thursday, August 20, 2009

My holiday in France in five pictures

Last week I went on a holiday to France with my girlfriend and her family.

Because pictures say more than words..

One: The location - Laguepie, Albi

Two: The house and "la piscine"

Three: Me enjoying the sun

Four: Only in France you find a 1955 Peugeot 403 with numberplates just standing there next to the road

Five: Random picture of one of the towns next to Laguepie

Looking forward to the next holiday :)

Saturday, August 1, 2009

Managing UserControls using Interfaces

It's a pretty common situation where you have multiple UserControls in a page which all expose the same functionalities.

In the project I'm working on right now, we have a big TabContainer. And each Tab is a UserControl. One button should make all the Tabs save their data, but not every Tab is always loaded into the TabContainer. As you can guess, we needed something generic.

That's why I introduced the ITab interface. Every UserControl implements this interface.

When I hit that save-button, a method iterates trough the ControlCollection and looks for every type that implements the ITab interface.

Take a look at this codesnippet.

The public method Iterates through the ControlCollection and checks if the Type is a Tab using the private IsTab() method. This private method uses Type.GetInterfaces() to iterate through all the Interfaces for that Type. If the control is a Tab, I cast it to an ITab and call a public method depending on the ReportMode.