Suggestion: Consider Inheriting Acting Interfaces From IDisposable
It felt like I was posting a lots of posts lately, but checking the numbers, I didn't come close to scratching my daily record in the entire weekend, and I still have items in my blog scratch pad that I need to post (down to five items, though). Anyway, this post is about interfaces, not about my blogging habits.
I mentioned that it takes quite a bit of interfaces to write a file to database (8 interfaces and 15 classes, on last count). I found it useful to make all the interfaces inherit from IDisposable. There is quite a bit of composition there, and even if currently their implementor do not hold disposable resources, they will probably will.
I don't have a good defination for an acting interface, but I have a good defination for one that isn't. A non acting interface is one that can be used only to get information or to change the state of an object. An acting interface is one that can change the state of the system.
This allows me to handle resources in the top level class by simply disposing a single interface, which will pass the call to the rest of the system.
Comments
Comment preview