DependencyProperties the easier way

After working with Workflow Foundation at a customer I had to admit: I hate DependencyProperties. Yes I hate them. They exist because Workflow Foundation, Windows Presentation Foundation and now also Silverlight needed some way to add features to properties. I must admit I would have liked a different approach by using some kind of Aspect Orientation with PostSharp or so. But I still have to make use of them, so let's make the creation of DependencyProperties easier, an Resharper Live Template. Just a few words (Property Name, Property Type, Activity Type and PropertyDescription) and you'll have a full DependencyProperty. I made the Live Template start with word "dprop" and also made the Activity Type be selected by the containing class type.

1 public static DependencyProperty $PROPERTYNAME$Property = 2 DependencyProperty.Register("$PROPERTYNAME$", typeof ($PROPERTYTYPE$), 3 typeof ($ACTIVITYTYPE$)); 4 [Description("$PROPERTYDESCRIPTION$")] 5 [Browsable(true)] 6 [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] 7 public $PROPERTYTYPE$ $PROPERTYNAME$ 8 { 9 get { return ($PROPERTYTYPE$) GetValue($PROPERTYNAME$Property); } 10 set { SetValue($PROPERTYNAME$Property, value); } 11 }

Have fun with it.

The advantage of the TagCloud

While looking at the TagCloud below I thought, there are some things that can be done better. The article on the original TagCloud can be found here.Like:

  • A middle alignment for all items in a row
  • An equal divided space between items in a row

The old TagCloud.

So what I did is take the original code from the WrapPanel and did some refactoring first. I changed the ArrangeOverride method to become a two phase step. The first step is to determine which items become in which row. I put those items in a two-dimensional collection. The next step is the actual arranging of the elements. One of the pieces of code for the arrange does determine which element is the largest in Height in a specific row. Besides this it also measures the total width of the elements in the row which is use to calculate the space needed between the elements.

1 double largestHeightInRow = elementsRow.Max(element => element.DesiredSize.Height); 2 double widthOfRow = elementsRow.Sum(element => element.DesiredSize.Width); 3 double betweenElements = (finalSize.Width-widthOfRow)/(elementsRow.Count + 1);

This all combined results in the following TagCloud.

The new TagCloud.

The updated source can be found here.

Aspect Oriented Programming article

.Net Magazine #21In June this year an article from my hand about Aspect Oriented Programming (AOP) was published in the Dutch .NET Magazine. It's about partly about AOP in general and partly about the usage of PostSharp. You can download the article here. You can read about my other articles here and here. Let me know what you thing about the article.

Maren Anne Hilany Monster

YES! It's a girl and we have given her the name Maren Anne Hilany. She's born on August 11th at 15:06. She weights 3955 g and is 52 cm long. I'm feeling so much love for her no one can possibly understand. Time for some photo's taken from my beautiful daughter Maren.

Mark-Maren-Yvonne Maren  Her weight on 13-08Taking a little bit of bathHands Up

Isn't she beautiful?

It's time for a little bit of prioritizing so I might be blogging a little bit less. But I'm sure everyone understands this.

Something about Sashimi

No it's not about the  Japanese delicacy that consists of raw seafood. It's about the definition of "Done". A former project-college Michel has written (in Dutch) about estimating in Agile projects. It's an interesting read for everyone because what he writes is what we call in Dutch "de spijker op de kop slaan".

I've had a lot of interesting talks and discussions with Michel on Agility. He recommended the book I am currently reading called Agile Project Management with Scrum, an interesting read for people wanting to learn more about Agile projects and scrum. This book actually picks real world cases and explains the problems they had and what solutions they used to overcome their troubles. One of the things the book talks about is Sashimi.

So what's Sashimi?

It actually has something to do with the Japanese delicacy because Sashimi is more like some kind of art with food. Sashimi are thin slices of raw fish that are all complete in the way they have the same taste. In scrum Sashimi is used to require every 'slice' of functionality is complete in itself. Yes but what is complete? It's about the following things that are all done:

  • Requirements gathering
  • Analysis
  • Design
  • Coding
  • Testing
  • Documentation

So when doing scrum it's important that every member of the scrum team has the same definition of "done". It seams to be logical when reading, but I know a lot of you have experienced the differences in the perception of done during a project.

I've got a whole bookshelf to read on Agile Projects. So probably more on this later.