Sunday, April 26, 2009

URL Builder Functions

I am working on an internal web application that does some state management through the query string. That being the case, I have to add, remove and change paramters in the query string. Here are the functions that I use to edit the URL to change these varables

// Takes a URL with parameters and replaces the current value of a given parameter 
// with the new value provided
public static string replaceParameterInUrl(string theUrl, string param, string newValue)
{
    StringBuilder sb = new StringBuilder();
    string[] parts = theUrl.Split(new char[] { '?', '&' });
    sb.Append(parts[0]).Append("?");
    for (int i = 1; i < parts.Length; ++i)
    {
         string thisParam = parts[i];
         string[] paramParts = thisParam.Split(new char[] { '=' });
         if (paramParts[0] != param)
             sb.Append(thisParam).Append("&");
    }
    sb.Append(param).Append("=").Append(newValue);
    return sb.ToString();
}
/// Takes a URL with parameters and replaces the current value of a given parameter 
/// with the new value provided
public static string removeParameterFromUrl(string theUrl, string param)
{
    StringBuilder sb = new StringBuilder();
    bool isFirstItem = true;
    string[] parts = theUrl.Split(new char[] { '?', '&' });
    sb.Append(parts[0]).Append("?");
    for (int i = 1; i < parts.Length; ++i)
    {
        string thisParam = parts[i];
        string[] paramParts = thisParam.Split(new char[] { '=' });
        if (paramParts[0] != param)
        {
            if (!isFirstItem)
                sb.Append("&");
            sb.Append(thisParam);
            isFirstItem = false;
        }
   }
   return sb.ToString();
}

If I was going to use these functions in a public facing site,I'd probably sort the parameters alphabetically, so there would be less flux in the URLs that Google would see

Sunday, April 19, 2009

On Small, Low Margin Projects

Part 3: Framework and Starter Application

To get off to a quick start, I would imagine finding or building (or a combination of the two) an application framework before I start selling my services to the small business-person. Most small business applications need CRUD and List forms; user accounts and various levels of access; logging;; an about window; error and audit logging; etc.

The platform doesn’t really matter as long it is robust enough to solve the business problem. You need something that is robust enough to solve the current business problem and accept the changes that will take place (sooner: you misread a requirement, later: new work and more revenue). The toolset should support modern scalable designs; the software may be the seed of an enterprise system.

I know that this is like having a hammer and making everything into a nail. At this kind of margin, you can’t afford to handle any technology that the customer may want to use. If it isn’t a nail and can’t be made into a nail, have someone else do it; margins are too tight to take anything.

The first few projects will probably be losers as you work out the kinks in the framework and your process.

With a starting point, we can get our customer something to show them after the first sprint. We can show the customer something quickly and have something to talk about when we plan the second sprint. If we come back to them quickly with something to show, they will feel involved in the process.

Monday, April 13, 2009

On Small, Low Margin Projects

Part 2: Short Interactions and Feedback

In a previous post, I wrote about some of the issues I have experienced with small projects and suggested that Waterfall, Cave of Solitude solutions tend to blow up in your face.

If we come back to the customer every 2 to 4 weeks, we can both learn about the other side of the transaction:


  • I can teach the customer how the process works, what is possible, what is easy and isn’t going to happen. If you are going to buy custom software you need to learn the process. It is like buying a new building; you aren’t going to use the gold plated faucets in the penthouse when we are still pouring concrete (I will restrain myself from going on for hundreds of words of half baked analogies).

  • The customer can teach me more about his business, what he expected the software to do and I missed on the first time around. What is important? What is a nice to have? I may have the opportunity to see the processes that are too complex to explain.

  • Customers like to feel that they are part of the process. If you are going to spend a few grand on something, you want a sense of what is going on. Buying custom software is a big part of the company’s activities and the owner may want to boast about it on his blog on in the local watering hole.

If we started at ground zero and only used Scrum like sprints but no initial framework, the first couple of sprints would give the customer little sense of satisfaction.

Sunday, April 12, 2009

On Small, Low Margin Projects

Part 1: The Problem

I have been involved in some small (low margin) projects for small business customers using a classic Waterfall type process where we get all of requirements from the customer and go into our digital cave for a few months to write our masterpiece. When we came back to the customer (usually late) to show them their shinny new program, we find that we got it wrong. On one program, we get calls from the customer as he discovers features.

The customer can’t tell us what they want in language we understand; they may know what they want, but not in our language. The customer may not have any experience buying custom software. We don’t know the business and its problems well enough. I think the effects of these problems can be mitigated by delivering more often (a la Agile).

If we were to go more agile, we would need a way to get something to the customer quickly. I don’t think a customer in this market would be impressed if, after the first sprint, I showed him a base list window, a base edit window and basic security. We need a base framework and possibly some modules that exist before the first sprint for the customer.