zyzhang
Explorer
发贴: 155
积分: 30
|
于 2003-11-06 00:46
I think I'd better to explain how my design idea developped for the solution . The original thought is based on the fact that a,b,c objects are essentially the same objects,but with hierarchy structure defined for them.Also, the semantics between them are composition. My first attempt is to try to abstract the common stuff and pooling them. then, i analysed the objects model and identified the common attributes in these classes,but the class structure are so complex, i need to abstract the interfaces to make them uniformly accessible, at this moment, i realized i should turn to design patterns to get the proven design solution for this common problem.I sent my request to this topic.Currently, it seems that the topic is not fit well to my problem.
Eventually, I found the right design patterns to sort out my problem. These patterns also give me the clue how to abstract the interface and reexamine the existing class structure, this made me quickly go on the right track.
I created a running prototype quickly(3 hours) and adapted to the existing programs(hard work), i modified the existing test cases(hard work) and then released it(happy): performace dramatically improved, cause the objects kept in memory are reduced significantly.
Again, I learned the three design patterns(Flyweight,factory and composite) in the real world application , alone with the decorator that floater mentioned.
|