Monday, May 12, 2008

Right generalization

We can think that the generalization of software development is making a specific thing more general. For example, if we find that the specific things of our project could be used widely in variety environment, we could generalize it with removing specific things and considering variety environment.

A few day ago, I found an interesting fact. After something is generalized by someone, contrary of his or her expectation it is not used often. For example, I made a simple library named 'StopWatch' which measures processing time between sections in program. For generalization, I designed it based on interface and applied structure for extendability. Then, I registered it on common library repository. Of course, I did`t forget announcing it through the team review. What about StopWatch after a year? Nobody used StopWatch except me during the past year. Also, I could`t see who appears interest about StopWatch.

I have had various thoughts through this experience. I used time to generalize the StopWatch. If someone saves his time with the StopWatch, my effort might be valuable. However to conclude nobody used it so the time used for the StopWatch could not be valuable. Moreover, the space complexity of common library repository is increased due to the StopWatch. This complexity affects understanding and compile-time for codes.

I seriously thought why this happend. My conclusion is that these are from hasty generalization. In general, generalization is performed by self decision. Someone thinks of generalizing something during development and generalizes it. But, we need to honestly ask ourselves. "Should this be generalized?" Maybe, the answer for this question is always not "Yes". So, I think that we need to concern whether generalization has value before generalizing something. That is, we should watch out hasty generalization.

Next, my interest is the steps of generalization. The steps of generalization mean phases which generalization must step on. In my opinion, the steps of wrong generalization is making the results of generalization like falling from the sky even though nobody needs it. Nobody needs StopWatch. But I had uploaded it to common library repository. This was only my thought.

So what are good steps for generalization? I had made a validation library based on Java-Annotation. This was only used in my project. It had dependency codes on my project. One day, however, someone saw the validation library and asked me to use it. He might have thought that it`s good. So, I removed dependency codes and promoted it to the common library repository for him. Now, It is used as standard in my team. In this case, the validation library is generalized naturally with requirements unlike StopWatch. I think that the preceding case is an ideal case for generalization.

No comments:

Feed