私のプロジェクトでは、クラスのバージョンを維持する必要があります。だから私が行くことができる2つのアプローチがあります
1) Edit Same Class with Version and Use Switch Case for maintain older version
Pro :
1) We only have to create one single class
2) If you want to used old version class attribute which are now not supported in
current version of class so you just provide them Default Values.
Cons:
1) There may be possibility that some attribute are not used now but they still
present in Class for supporting older version
2) It also break Open Closed Principle
次のアプローチ:
2) Create new classes for each version and maintain them by using any design pattern
so for example I have Base Class = BaseClass and It have multiple Derived classes
like DerivedClass1,DerevivedClass2. Each class have different version.
Pro:
1) If now we want to use old version class so we not have to worry about its
attribute behavior because we will fetch DerivedClass1 for Version 1 ,
DerivedClass2 for Version 2
2) We will put all common property in Base class so Derived class will only have
extended property.
3) We also follow Open Closed Principle
Cons:
1) We need to create new classes for all new versions.
それで、それについてのあなたの見解を知りたいのですが、もっと明確にする必要がある場合はお知らせください.