XP Design Changes

Previoulsy, tasks were determined by a due date.  Now, they can be determined by many things; a date, a custom value (say a mileage value setup), and do many other things.  Because of that, I realize that I no longer need the deferrment option.  In addition, I plan to keep complete, but instead of completing directly in the edit form, this functionality will now be in the main form, as a menu option.

XP can work like that; changes to how the system work can drastically change the interface, if that makes it more meaningful for the users.  In this case, it makes it somewhat easier, because you can also complete multiple items at a time in the system.  For the task class, this was my complete method:

public void Complete()
{

 MetadataProperty dueDateProperty = this.Properties["DueDate"];

 if (this.GetPropertyValue<bool>("IsReoccurring"))
 {
  //Get the amount of reoccurrence from the Properties
  int amount = this.GetPropertyValue<int>("ReoccurrenceAmount");

  //If the amount is a positive number
  if (amount > 0)
   //Add the amount to the date
   dueDateProperty.Value = dueDateProperty.GetValue<DateTime>().AddDays(Convert.ToDouble(amount));
  else
   //No amount provided; throw an error
   throw new ArgumentException("The reoccurrence amount is not a positive amount", "ReoccurrenceAmount Property");
 }
 else
  //The task is completed, so remove the date Property from the
  //collection; this means that it is completed
  this.Properties.Remove(dueDateProperty);

 //Set the last completed date to the current date
 this.SetPropertyValue<DateTime>("LastCompletedDate", DateTime.Today);
 this.OnTaskCompleted(EventArgs.Empty);
}

However, the methodology now changes, and so this is no longer value; I'm not storing in the task object half of these values anymore.  A new updated version will be:

public void Complete(bool trackFromLastCompleted)
{
 foreach (MeasurementTrigger trigger in this.Triggers)
 {
  trigger.TrackFromLastCompleted = trackFromLastCompleted;
  trigger.Update();
 }
 
 this.OnTaskCompleted(EventArgs.Empty);
}

This is much simpler, and works nice.  You may wonder what the triggers are, and I will explain this in my next post.  For now, I want you to understand some of the complete design changes made.  In the XP methdology, it is worth throwing out code if it is no longer valid or isn't what the user wants.  I know this can be a hard thing to do, as a developer, but we must.  Actually, I was relieved to be able to remove code.  It was like the power of God freeing my soul.

Anyway, there has been other code to remove.  I had a large PercentDue property, which I won't post here because of the size, which I was able to remove.  It is no longer useful, and so I removed it, as that evaluation will be a part of what I am going to explain next.

This is part of the XP methodology, which can seem radical to redesign the interface; however, after using the tool, you learn about it, and locking into a specific design hurts the usefulness of that tool.  Since this feature is helpful, it is great to then change it, to increase its usefulness.  That should be one of our first and foremost criteria in refactoring the UI; making it more useful.

Comments

No Comments