工作感想
最近一年都在做一个Framework。经理对这个Framework的雄心很大,我也就做得很郁闷。总觉得方向出了问题。工作之余写了一篇感想,大家提提意见。
We all know the aim of any software framework is to reuse source code, to avoid reinventing the wheel. The original intention to construction a framework is always good, but the result is dramatically different. Why?
I think this depends on the constructer's ambition. More stylized is the work for which they try to construct a single reusable framework, more likely the framework will succeed. Those constructer who are relatively conservative, that is, who focus their effort on a relatively narrow domain will much likely achieve their object.
For example, the orignial aim of MFC team of Microsoft is to construct a framework for OS independent application of wide range. Thus the first version is too complex and somewhat useless. Then they narrow the object to provide a framework for Document-View applicaiton tied to Win32 platform, and the framework becomes the one we see today, which succeeds. Even though, many MFC developers must go around (note unlike tooltip, developers using framework can not simply do not use a feature, they must do go around) some useless functions provided by MFC in their developement. This shows even holding a conservative assumption it is very difficult to assure every pieces of your effort on reusibility can really benifit your users.
On the other hand, framework construction, or more generically, source code reusibility is an object that sometimes impossible to be achieved only by tools on the same level, in paticular the object is tend to cover wide-range applications. This is much like things in mathematical field. When you want to prove a theory about integers, you must use proven theories of real numbers. In computer engineering, to gain reusiblity of a certain level, building right tools from the underlying level is sometimes neccessary.
For example, to gain the reusiblity of database-object mapping was impossible if you only dealt with existing programming language before a fully dynamic programming language that supports rich runtime type information and dynamic class loader, such as Java, was invented. Thus if those work had not been done by Sun, defining a language, defining the corresponding platform, implementing the runtime enviornment, implementing the compiler would be the necessary work for the constructer. By the way, even though, J2EE's CMP is far from perfect.
Another example is that, to gain the resuibily of algorithm was impossible if you only dealt with existing programming language before the invent of advance notion and language feature, such as iterator and C++ template. Before STL was invented, many those thought algorithm was so stylized that they can be implemented in a single framework failed or result in ugly framework. On the other hand, even today, after 4 years of latest C++ standard published, no compiler can fully implement template features. This shows two points:
1. People ofter underestimate the necessary of work to build fundemental principle and tools.
2. People often underestimate the difficulty of work to build fundemental principle and tools.
According to the above examples, we can find another very important fact which administrative stuff of software team dislike. While innovation like a framework often bases on adequate fundamental effort, such fundamental effort is often contributed by irrelevant organizations independently over many years. More the object is innovativet, more likely that is the case. One organization, in particular one has market stress, is unable to provide all fundamental tools of different aspects, such as mathematical theory, language feature, hardware feature, and so on. Only those projects for reusiblity whose aim is relatively conservative can be accomplished by a single organization in a pratical timeframe.