Wednesday, April 23, 2008

Refactoring: Later? Continuously!

A couple of days ago I attended a meeting about refactoring. Some of the attendants were unfamiliar or felt unsecure about refactoring. One of the questions that arose was; "When is it time to refactor? Is it a joint descision in the developer team that it's time to refactor or is it an independent descision?" There is NEVER a special time for refactoring. You don't create a task that says refactoring. Refactoring goes hand in hand with coding and should be performed CONTINUOUSLY. ALWAYS. You should always take into account refactoring when estimating a task, if not you're in deep shit. The customers generally don't care if you build a house with duct tape, as long as it looks good enough. And they will certainly not pay for later changes not visible from the outside. But as a professional developer you know that the house will fall apart when the rainy day comes. So ALWAYS refactor and estimate accordingly!

Tuesday, April 22, 2008

DataGrid revisited

Today I held a little presentation at work showing off some of the DataGrid capabilities in Silverlight 2.0 beta. It's basically based upon my last post, but I added some new functionality that shows use of the DataGridCheckBoxColumn and the DataGridTemplateColumn.
<Data:DataGridCheckBoxColumn Header="Is done" DisplayMemberBinding="{Binding IsDone, Mode=TwoWay}" />
<Data:DataGridTemplateColumn Header="Due date">
  <Data:DataGridTemplateColumn.CellTemplate>
      <DataTemplate>
          <TextBlock Text="{Binding DueDate, Mode=TwoWay}" />
      </DataTemplate>
  </Data:DataGridTemplateColumn.CellTemplate>
  <Data:DataGridTemplateColumn.CellEditingTemplate>
      <DataTemplate>
          <DatePicker SelectedDateFormat="Short" FirstDayOfWeek="Monday" SelectedDate="{Binding DueDate, Mode=TwoWay}" />
      </DataTemplate>
  </Data:DataGridTemplateColumn.CellEditingTemplate>
</Data:DataGridTemplateColumn>
You can download the source code here