I have a "Good Practice" Question:
Lets assume a case where one have many List Types
IObservableList With Events
IReadOnlyList Read Only
ISomeList Some List that perform additional operations
Is it better to define 6 classes Like
ObservableList:IList
ObservableReadonlyList:IList
ObservableSomeList:IList
ReadonlyList:IList
ReadonlySomeList:IList
ObservableReadonlySomeList:IList
or
Adapting one too another using 3 Classes:
ReadOnlyListAdapter : IList
ObservableListAdapter : IList
SomeListAdapter : IList
and instanciating with
IList MyObservableReadonlySomeList = new ReadonlyListAdapter(new ObservableListAdapter(new SomeListAdapter)));
Note:
i tend to like the 6 classes better, but what goes when there are 6 or 7 properties for a class??? 30-50 classes?
Thank you, have a nice day...
You might want to look at the Decorator pattern. It may indeed be what you're actually doing with what you're calling adapters.