Friday, July 16, 2010

Design UI Mockups

Presently I’m engaged with Puzzlepart team that one of the best SharePoint solution providers in Norway and working on their SharePoint products, external customers. Working with them reminds me one of the great projects that I worked in Virtusa, that changed my whole thinking pattern of software development.

Few weeks ago we had a workshop for one of their upcoming product and it was mainly focused on sprint planning for that product. The process we are using is Scrum and according to that we picked few user stories from the user story board and create a product back log and did the estimation for that. Each user story represents the main functionalities of the product and based on that, we decided how we are going to design user interfaces for the product. Previously I was only familiar with the RUP development and still new to the Scrum.

The interesting thing was how we done the UI design for this product. Usually this will be done by an UI designer and based on their wireframes we do the actual implementation. But in here everybody was involved and it was a new experience to me. 

How we did:
  • Team is get together and pick up one user story from the planning sprint. Discuss the user story scenario and the functionality that we need to implement.
  • After that each team member need to present his UI mockup for the functionality (draw it in a paper and show it to the team). Others will discuss if there were missing functionalities in the UI, discuss whether it is implementable.
  • UI designer will consider all UI mockups given by the team and aware about the technical limitations and the functionality.

Using this approach developers will have a good feeling that they have contributed something for the UI design and they are responsible to implement that. That time this was one of the key thing that we were able deliver the sprint successfully.

One lesson I learned was when design UI mockups it should contains the actual data that relevant to the user story not dummy data.

Saturday, July 3, 2010

Enum to Description

Recently we had an issue with maintaining enum descriptions in our project. The problem was descriptions duplicated several places in codebase and when it came to modify descriptions we had to modify the description everywhere. From the maintainability perspective this not a good practice and we came up with a solution by using the coolest feature Extensions methods that comes with the .NET 3.5. Following is the sample code of the solution.
using System;
using System.ComponentModel;
using System.Reflection;

namespace EnumToDescriptionTest
{
    public static class EnumExtensions
    {
        // Extension method to get the enum description.
        public static string ToDescription(this Enum val)
        {
            Type type = val.GetType();

            string name = Enum.GetName(type, val);
            FieldInfo field = type.GetField(name);

            // Check for the Description Attribute.
            DescriptionAttribute[] attributes = (DescriptionAttribute[])field.GetCustomAttributes(
                                                typeof(DescriptionAttribute), false);

            return attributes.Length > 0 ? attributes[0].Description : name;
        }
    }

    class Program
    {
        // Define the enum with description.
        public enum UserMode
        {
            [Description("Add User")]
            Add = 0,
            [Description("Update User")]
            Update = 1,
            [Description("Delete User")]
            Delete = 2
        }

        static void Main(string[] args)
        {
            // Get the enum description.
            Console.WriteLine(UserMode.Add.ToDescription());
            Console.ReadLine();
        }
    }
}