|
-
Dec 17th, 2009, 01:45 PM
#1
Interfaces and Unsupported Functionality
I have an interface I have written and I have a few user controls that implement the interface. The user controls each expose a third party control which have mostly identical functionality, but there are a few things that one control can do that others might not be able to do.
So my question is
1.)Do I use a single interface and throw NotSupported exceptions when the caller tries to use functionality that doesn't work in this particular implementation?
Or
2.)Do I break all of my functionality into separate interfaces and implement a whole bunch of interfaces in my usercontrol?
Or
3.)Do I do some Hybrid of 1 and 2, grouping certain functionality together?
I am really trying to avoid #1, as it would require using exceptions to control program flow, which I hate doing. Also I want to disable functionality if it is not implemented, so the user can't even click the option in my UI if the control doesn't support it. I would fear I could run into this problem if I went down the road of #3 and we built a new control that implemented all but one function in an interface.
So right now I am leaning towards #2, but I have a fear that it will make the code unmanageable.
Does anyone have any suggestions?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|