MSBuild Extension Pack First Impression

Mike Fourie has begun a project to combine two of the larger MSBuild task libraries. FreeToDev and SDC tasks have a lot of overlap, so I believe the MSBuild Extension Pack is a great endeavor to simplify the life of many of us build architects. However, I do have a gripe after reading the description on the project page.

It implements a TaskAction based design which improves usability and maintenance whilst reducing the code base, e.g. to start or stop a website, typically two task files would be created to perform each task, whereas the pack accomplishes this in a single task files using TaskAction=”Stop” and TaskAction=”Start”.

I feel that a "TaskAction based design" decreases cohesion. Each task should be like a method: the name describes what it does and the attributes are the parameters to do it. If you start coding tasks that change behavior, then you've effectively given the class (remember, tasks are classes) too much responsibility. If multiple tasks have similar responsibilities, the correct approach is to abstract. Create a base class with the common elements, encapsulate what varies, then implement that variation in the child classes which are represented in MSBuild as tasks.

In the example given on the project page, I would prefer to have <Website.Start ... /> and <Website.Stop ... /> than <Website TaskAction="Start" ... /> and <Website TaskAction="Stop" ... />

Print | posted on Wednesday, October 08, 2008 1:51 PM

Comments on this post

No comments posted yet.

Your comment:

 (will show your gravatar)
 
Please add 3 and 5 and type the answer here: