Friday, December 10, 2010

Providing Solution v/s creating Architecture

You may feel that this is something similar to one of the post “Technology v/s concepts and architecture” in my WPF blog.This is just a story from which you can understand what I would like to convey by the post Solution v/s architecture.

Last week when I was almost alone in office ,one of the Infrastructure & network support guy called me and asked “Can you write a program for me?” Yes buddy of course that is why I am here.He explained me his need.He need to restart 4 windows services after installing one particular software in a considerable number of machines.If I give a program he can just run that to restart services in one machine immediately after he installs and he can go to another machine for installation.

Then the .Net architect in me stood up and said .I will write a C# program which is configurable to restart any number of services.He said “OK”.My next question was “Which format you prefer for the configuration? xml or csv?”.What?? he continued “I need a program to restart 4 services.Let me know when you finish”.Oh poor guy he don’t know what he wants.But it’s my duty to give him highly sophisticated program.

Fortunately or unfortunately I had to attend one production support issue.Since it was complex our lead architect had to involve in the issue on the day.It was a out of memory exception which was not reproducible in our dev machines which have 4GB RAM.So it was decided like client needs to upgrade their machine as the data pulled is very large.But our lead architect started tackling in another way.He started asking some basic questions such as what is the chunk size we used in WCF services,is it really OOME or exception raised due to LOH fragmentation etc… which gave a new perspective to the issue.After 15mins the diagnostics session ended and I came to the previous problem.

May be due to the new light I got from my lead,I started thinking about the requirement from the network guy? Do I really need to write C# program to restart 4 windows services?It needs a .Net runtime. If I target to .Net 4.0,can I assure him that it will work in all the machines?Now the answer comes ’no’.I should think about some thing simple.

When .Net seems over engineered the option normally goes to scripting.Yes that is enough.Then which scripting? .bat files or vb script which will read the config to restart services?Oh.Again I am complicating.There is one more scripting technique which is nothing but WindowsPowerShell.Seems I got an alternative solution.The next phase is to discuss with the client about the alternatives.I called him and asked one thing.”Are you going to use this tool in machines which have Windows power shell?” Yes he replied.OS is either Vista or Win7.

Yes.This is the solution.Create a RestartService.ps1 file and write the below 4 lines.Ask him to change the service name using notepad and run using Windows Powershell.

Restart-Service BthServ
Restart-Service BthServ
Restart-Service BthServ
Restart-Service BthServ

Architect for solution.Don’t solve for architecture.

Seems I taught somebody to do my job which may be a threat in future:)

No comments: