Design options# Java - 爪哇娇娃
g*y
1 楼
- A DocumentCenter class processes XML document.
- A bunch of classes *Rule derived from BaseRule class, which will apply some
rule to XML document.
So, I need to pass DocumentCenter instance to Rule classes.
Two options I can see:
1. Set DocumentCenter as Singleton
2. In main class, pass DocumentCenter instance to each Rule class.
Considering future expansion/maintenance, which way would you go? or you have
better solution?
- A bunch of classes *Rule derived from BaseRule class, which will apply some
rule to XML document.
So, I need to pass DocumentCenter instance to Rule classes.
Two options I can see:
1. Set DocumentCenter as Singleton
2. In main class, pass DocumentCenter instance to each Rule class.
Considering future expansion/maintenance, which way would you go? or you have
better solution?