Wednesday, February 18, 2009

Hierarchical vs Linear Workflow

Several of the applications that we've built or are currently working on in the OSS group involve the processing of workflow in some form. If you peruse the Web you'll find there are a variety of types such as "activity-based" or "content-driven". Microsoft Windows Workflow Foundation supports two types: "Sequential" and "State Machine" ( There is enough material out there though to make your head spin. Being that I'm not an authority on the subject I thought I'd explain in a simple-to-understand format the two types that we've used.

Hierarchical: workflow events are fired one at a time and they operate in a very sequential waits on the other. Example: I fill out a form and submit it to my boss for approval. Until he approves or denies the request, the entire transaction is in a holding state. Once he approves it, it then gets submitted to his boss. If he denies the request, it comes back to me. After all approvals have been gathered, the transaction is considered complete.

Linear: here workflow events all fire off on different threads (asynchronously) and are independent of one another. They must all be completed though before the transaction can be considered complete. Example: I put in a request to get a widget ordered. This order requires the participation of four different groups to perform an action. So, requests are sent to all four groups and they all complete their task independent of one another. Once all four are completed, the widget can be processed.

Hopefully those two approaches make sense. If you have more to add to this topic, I welcome your feedback.

Friday, February 13, 2009


Someone sent me this story via email and I just had to share it...

At a fundraising dinner for a school that serves children with learning disabilities, the father of one of the students delivered a speech that would never be forgotten by all who attended. After extolling the school and its dedicated staff, he offered a question:

'When not interfered with by outside influences, everything nature does, is done with perfection. Yet my son, Shay, cannot learn things as other children do. He cannot understand things as other children do. Where is the natural order of things in my son?'

The audience was stilled by the query.

The father continued. 'I believe that when a child like Shay, who was mentally and physically disabled comes into the world, an opportunity to realize true human nature presents itself, and it comes in the way other people treat that child.'

Then he told the following story:

Shay and I had walked past a park where some boys Shay knew were playing baseball. Shay asked, 'Do you think they'll let me play?' I knew that most of the boys would not want someone like Shay on their team, but as a father I also understood that if my son were allowed to play, it would give him a much-needed sense of belonging and some confidence to be accepted by others in spite of his handicaps.

I approached one of the boys on the field and asked (not expecting much) if Shay could play. The boy looked around for guidance and said, 'We're losing by six runs and the game is in the eighth inning. I guess he can be on our team and we'll try to put him in to bat in the ninth inning.'

Shay struggled over to the team's bench and, with a broad smile, put on a team shirt. I watched with a small tear in my eye and warmth in my heart. The boys saw my joy at my son being accepted. In the bottom of the eighth inning, Shay's team scored a few runs but was still behind by three.

In the top of the ninth inning, Shay put on a glove and played in the right field. Even though no hits came his way, he was obviously ecstatic just to be in the game and on the field, grinning from ear to ear as I waved to him from the stands.

In the bottom of the ninth inning, Shay's team scored again.

Now, with two outs and the bases loaded, the potential winning run was on base and Shay was scheduled to be next at bat.

At this juncture, do they let Shay bat and give away their chance to win the game? Surprisingly, Shay was given the bat. Everyone knew that a hit was all but impossible because Shay didn't even know how to hold the bat properly, much less connect with the ball. However, as Shay stepped up to the Plate, the pitcher, recognizing that the other team was putting winning aside for this moment in Shay's life, moved in a few steps to lob the ball in softly so Shay could at least make contact.

The first pitch came and Shay swung clumsily and missed.

The pitcher again took a few steps forward to toss the ball softly towards Shay. As the pitch came in, Shay swung at the ball and hit a slow ground ball right back to the pitcher.

The game would now be over. The pitcher picked up the soft grounder and could have easily thrown the ball to the first baseman. Shay would have been out and that would have been the end of the game. Instead, the pitcher threw the ball right over the first baseman's head, out of reach of all team mates. Everyone from the stands and both teams started yelling, 'Shay, run to first! Run to first!' Never in his life had Shay ever run that far, but he made it to first base.

He scampered down the baseline, wide-eyed and startled.

Everyone yelled, 'Run to second, run to second!' Catching his breath, Shay awkwardly ran towards second, gleaming and struggling to make it to the base. By the time Shay rounded towards second base, the right fielder had the ball . The smallest guy on their team who now had his first chance to be the hero for his team. He could have thrown the ball to the second-baseman for the tag, but he understood the pitcher's intentions so he, too, intentionally threw the ball high and far over the third-baseman's head. Shay ran toward third base deliriously as the runners ahead of him circled the bases toward home.

All were screaming, 'Shay, Shay, Shay, all the Way Shay'

Shay reached third base because the opposing shortstop ran to help him by turning him in the direction of third base, and shouted, 'Run to third! Shay, run to third!' As Shay rounded third, the boys from both teams, and the spectators, were on their feet screaming, 'Shay, run home! Run home!' Shay ran to home, stepped on the plate, and was cheered as the hero who hit the grand slam and won the game for his team.

'That day', said the father softly with tears now rolling down his face, 'the boys from both teams helped bring a piece of true love and humanity into this world'.

Shay didn't make it to another summer. He died that winter, having never forgotten being the hero and making me so happy, and coming home and seeing his Mother tearfully embrace her little hero of the day!

Wednesday, February 11, 2009

Cohesion and Coupling

Every seasoned object-oriented developer should be familiar with these coding principles. Sometimes we forget though to implement them in the code that we write which leads to future refactoring. This article is a good reminder of these design and architecture patterns, and it provides some pretty good examples.

Sunday, February 01, 2009

URL ReWrite

void Application_BeginRequest(object sender, EventArgs e)


System.Web.HttpContext httpContext = HttpContext.Current;

String currentURL = httpContext.Request.Path.ToLower();

string processPath =currentURL.Substring(httpContext.Request.ApplicationPath.Length).TrimStart('/').ToLower();

//Creates th

string physicalPath = httpContext.Server.MapPath(

currentURL.Substring(currentURL.LastIndexOf("/") + 1));

//checks to see if the file does not exsists.

if (!System.IO.File.Exists(physicalPath))


string queryString =httpContext.Request.ServerVariables["QUERY_STRING"];

string defaultPage = "~/PageViewer.aspx?process=";

if (processPath.EndsWith(".aspx"))

processPath = processPath.Substring(0, processPath.Length - ".aspx".Length);

// Rewrites the path

httpContext.RewritePath(defaultPage + processPath + "&" + queryString);



Peopleware: Productive Projects and Teams

This is one of the best books that I've read in a while on People Management. I would recommend it to all Development and Project Managers...heck, all managers in general.