Characteristic 2 - Controllers should be Singleton

Characteristic 2 – Controller should be strictly singleton.

Now lets visit the next characteristic .. if we notice closely we will realize that there is a single instance of the controller within the system.

That’s the next very important property

Controllers are strictly Singleton

Ie There cannot exist more than one instance of a controller trying to control a particular region at a particular instance of time. Ideally it should never happen in any well designed system, but whenever it happens accidentally or because of improper design decisions , it is a perfect recipe for a system failure or a disaster.

Why are controller designed to be Singleton?

The job of the controller is to control the system and the interaction between the structural components. The moment we have a system with multiple controllers , one there will be conflict of interest between multiple controllers as all of them will try to control the same system and second the components will not be sure as to whose order they are supposed to take.

Have we ever seen a project with two or more project managers?

Have we ever seen a connection pool with more than one connection pool manager?

Have we have ever seen a house lying within the jurisdiction to two police stations?

Have we ever seen a city with two police commissioners?

Have we seen a state with two chief ministers?

Have we seen a country with more than 1 prime ministers/ presidents?

The answer is no … as I said mostly it will never happen … but whenever it happens accidentally … it a perfect reason for a system failure.

This characteristics of a controller is single handedly capable to destroying the entire system.

Let me give you a very quick example of a incident that happened to me in reality.

In one of the companies I was working for, the company had the concept of “Onsite Managers” and “Off site Managers”. For one of the very critical release the onsite manager thought that he would be an asset to the team if he comes offshore to help the team with this release. Although he took this decision in good faith but he didn’t realize that he was accidentally creating a system with two controllers.

What do you think should have happened to that release?

The release got screwed up badly. The reason was … My offsite manager comes to me and asks me to do a particular job, after sometime the on site manager comes to me and says “This task is not of high priority… do this task” … now whos order am I supposed to take ? … This was not a problem that I was facing in isolation, this was the case with most of the team members and hence most of us was not sure as to what needs to be done and the release failed. This is what multiple controllers can do to systems.

Although it is a very simple principle with very simple reasonings but most of the people are not aware of the same and hence they land up taking decisions which can violate this principle there by causing the system to fail.

Some of the biggest failures of the systems can be contributed to this characteristics of the controller but people don’t realize the same.

If the readers follow cricket … in the past there has been some excellent examples of this principle being violated there by causing the system to fail.

For example – In IPL season 2009, there was a team called as “Kolkotta Knight Riders” and had a coach called John Buchanan. Before the start of the tournament, this gentleman came out with the concept of multiple captaincy. The moment he exposed this concept of multiple captaincy … I immediately realized that he is talking about systems with multiple controllers which will never succeed. Although the coach dropped the concept at the last minute, but just the talk of multiple captaincy made the entire system fail. Till the last moment the players were not sure as to who was their controller.

Although the coach dropped the concept of multiple captaincy and continued with a single captain, but still there were multiple controllers within that system. Can you guess who was the other controller apart from the captain who was actually supposed to be the controller of the system (Team). The answer is the Coach himself. History of sports management shows whenever the coaches have started controlling the teams, the teams have failed pathetically. The very simple reason being …. The players(Team members) don’t know whose order they are supposed to take. This has not happened for the first time in Indian Cricket… few years back again an Indian Coach Greg Chappel again started controlling the team apart from the captain Rahul Dravid and again the team failed pathetically.

While on the other hand the same Indian team has recorded great success with coaches like Gary Kirsten and John Wright who are known for their non controlling behavior.

Similarly there are some very serious problems that we face every day because of this characteristic. We will discuss the same latter in the separate articles meant for the same.

In the software domain … Servlets in J2EE are Singleton by default because they are supposed to act as the front controller for the we application system.

 
Hemant Jha
Founder - VPlanSolutions
Researcher, Trainer

www.VPlanSolutions.co.in