Reputation: 35627
Let's say I have a base class that implements the INotifyPropertyChanged interface and I also have a VS snippet, so the codes can be typed easily. I am writing a data class, but now there is no client that needs to wathch this class' property changes, but there is a possibility that in the future there will be. Is there a reason not to implement INotifyPropertyChanged? Will this reduce performance, etc.?
Upvotes: 1
Views: 201
Reputation: 13601
Why not mark the relevant properties as virtual
, thus making it possible to write a subclass that implements INotifyPropertyChanged
at some point in the future? Your base class will remain lightweight this way.
Upvotes: 0
Reputation: 301147
"Always implement things when you actually need them, never when you just foresee that you need them."
YAGNI - http://c2.com/xp/YouArentGonnaNeedIt.html
INotifyPropertyChanged
is known to be very lightweight and your real concern is not performance issues and such. If all you are worried about is performance issue, you can as well implement it. YAGNI is not (just) about such issues. It says that your code be flexible that you can when you do need something. That flexibility is what you should be looking at.
Upvotes: 8