Saturday, January 7, 2012

The Power of One

Let's start with a question why big softwares are generally complex??????

Any Guesses !!!!!

Let me give it a try
It tend to achieve lots of functionalities which makes it tightly coupled which are difficult to test, debug and maintain. Obvious answer to this problem is engineer it well, create loose coupling between modules and many other intelligent sounding words which are repeatedly endlessly by every architect of this world. But practical implementation of those design principle are difficult because we often makes mistake in defining modules, defining scope of classes and sometimes methods as well. Below are the few thoughts of mine which are not that intelligent sounding but might help in creating a better designed software:

1. Create Software boundaries: Well, every estimation book use this word but generally all softwares deviate from this principle. So at the start only we should be clear with what all functionality and resources are in scope of the software we are creating.

2. Distribute responsibility between different modules: Define responsibility of every module very clearly and ensure that every module is not taking any extra responsibility.

3. Power of One: Ensure that every module takes one and only one responsibility, secondly there should be one and only one reason for which a module can be changed. Module can be as large as a dll and can be as small as a method.


Let's understand it with an example

Method to sort a list

private List sortedList SortList (List unsortedList)
{
//write some code

return sortedList;
}

So above method SortList have a responsibility to sort a list (just a single responsibility). Now we deep-down on sorting of list.
1. we have to choose sorting algorithm
2. we have to sort the list using that algorithm.

So to sort a list we identified 2 task to be completed.
Now take first task choose sorting algorithm. Sorting algorithm can be based on certain parameters like length of list; and then those parameters are required to sort a list.

1. Choose sorting algorithm choice parameters based on the list.
2. Check sorting algorithm based on the parameter defined in the previous step.

So the method would look like

private List SortList (List unsortedList)
{
string sortingalgo = FetchSortingAlgo(unsortedList);
List sortedList = SortbasedonAlgo(sortingalgo, unsortedList);

return sortedList;
}
private string FetchSortingAlgo(List unsortedList)
{
Parameters sortParameters = FetchSortParameters(unsortedList);
string sortingalgo = SortAlgo(sortParameters);
return sortingalgo;
}

So the task Sortlist is broken down into smaller methods and there by in smaller responsibilities.

If there is some change in the code due to change request or a bug then we should be clear that whether it is adding some new task or responsibility or it is changing existing responsibility, and based on that we should make the decision of extending a design or modification of design. Having said that the title of this blog The Power of One is trying to highlight that every module should to address only one responsibilities and if not possible then number of responsibilities should be minimal. I am eagerly waiting for ur thoughts and comments and till then keep coding.

Friday, December 3, 2010

How agile is Agile

One of the dictionary meaning of agile is "Quick and well coordinated in movement" that's the best interpretation of today's project needs. Here both being quick and well coordinated are equally important and it also signifies being quick without sacrificing coordination.

In my brief stint with project processes I have observed that a single process can not provide solution to all type projects, we have to adjust our project processes as per the need of the project and customers, but there can be some basic guidelines. Some common considerations irrespective of our processes can be :

1. Estimations: All projects start with this step and ends with criticizing this very step, so let's knock it down. Let's start with a question, how much time will it take u to reach office from Home and the obvious answer would be it depends sometimes let's say 15minutes and sometimes up-to an hour. When we plot a graph and it would be something like:


and as expected we will estimate it to be 20 minutes; but hang on a second we are giving estimations for which probability of success is just 50% which is too risky. Ideally, probability of success should be 80% to start with any project.

2. CheckPoints: Projects need a checkpoint when a scrum or an iteration end and thumb rule for it's duration is 4 weeks or 2 weeks but it should also depend on the need and stage of the project. Checkpoint should only happen on completion of a story point which is ideally an independently testable and demonstrable module of the complete application.


3. When to end an iteration: Generally there is an exit criteria for a project to move to SIT phase then to UAT, similar exit criteria should also be there for an iteration to end and iteration is closed only if it is signed off by all the stakeholders and with due acceptance with the permissible limitations (which can be known issues and defects) and a plan to resolve it. It's even better to plan a spike sprint in between to address those limitation instead of carrying the issues till the end. It's important for everyone to understand that it's far more important to make a project successful then to just focus on an iteration.


Will update it further with my thoughts on other project processes till then look for this space.

Saturday, November 6, 2010

Freedom @ Midnight

I am reading this book with the same title authored by Dominique Lapierie, and it's really connecting the dots of India's Past with the Present. One thing that stuck me is the role of Mahatma Gandhi in this whole process. As the book is from a foreign author so his writing is not polluted with political pressures.

First question to be answered is what make Mahatma Gandhi a great leader and why that great leader lost the control over India at the time of Independence.

So what made Mahatma Gandhi a great leader:

1. Connect not just Communicate: Masses were connected with the thoughts and lives of Gandhi and he always presented that he is one of them, not a person from some other planet. Just imagine the reaction among people of Bihar when politicians land in their private jets and talk socialist ideas. Similarly I have observed similar things in our offices as well when our great leaders talk about the million dollars in kitty for a project. We all are presented a picture that this money would be transferred in our respective bank accounts over the weekend.

2. Motivate people with Hope but Motivate urself with desire: Everyone needs motivation from time to time, even the great leaders. What make leaders different from masses is this desire and hope. For people of India there was a hope that there is a better life ahead for them after independence, but for Gandhi it was the desire to fight for the self respect, freedom and equality. Architect of India's freedom struggle was not there at the time of independence.

What went wrong in his leadership

1. Create core team and future leaders: As I was going through that book I realized that Gandhi was sidelined by his own stalwarts. So for every leader creation of core team and future leaders is utmost important who stands for the same values as presented by the leader. So a million dollar question why leaders fail to do that? I don't have definite answers but one of the reason I can think of the fear that some day those future leader will undermine the current leader.

2. Chose what to compromise and what not to compromise: Gandhi never wished for a partition and he agreed to that under the duress of his colleagues and viceroy of India. Standing on your own stand is one of the most simplest and difficult thing to do in which he failed. What worse could have happened at that moment. Partition was not less than a civil which they were eagerly trying to prevent.

I know I am no where to comment on the capabilities of these great leaders but for appreciation and criticism I leave it to my readers if there are any :).

Why we are so obsessed with American Dream

In last 24 hours I have just seen all news channel playing serial Just Obama. Or Indian media don't have anything else to present on post Diwali day.

I think Indian political leadership believes that one day America will turn some magical stick to solve all our security problems but we don't believe on our capabilities in solving those problems. Just a simple school of thought will India worry on cross border issues which US have with Mexico, that's there internal problem so is Mumbai attacks are India's internal problem. These attacks have global nexus but @ end of the day it was India attacked so action should also originate from India. There was another point that was raised why name of Pakistan was not explicit while making reference to terrorist, but actually what difference would it have made except few headlines and few columns.

Next come trade and commerce believe me I am not an expert in economics and trade, but I am expert in a field where everyone is novice and that is common sense. I believe simply create quality, we buy iphone not because it is created in some part of America. There will always be other pressure which for sometime manipulate trade and commerce but I believe in self correcting nature of economy. If we want our commercial interest to be safeguarded we should invest on genuine R&D (not just an eye wash) in all technology facets and focus on quality or meet end users expectations.

So my conclusion we only can solve our problems and come out of the habit, developed because of 200 years of colonial that some foreigner and will come and solve all our problems.