bernardmanning
Programmer
Hi, I wonder if somebody could give me some feedback on this proposed classed design.
This class is based around the command button control and the hierarchy looks like this :-
FoxproBaseCommandButton
|
V
MyStandardCommandButton
|
---------------|
| V
| MyAppCommandButton
| Method Click - Private
| Method PreClick - Public
| Method PostClick - Public
|
MyCommandButton
My intention is that when we create classed controls to do certain tasks we use the MyAppCommandButton class and prevent the user from placing code in the click event when it's subclassed. If the user wants to perform an action either before or after the click then it goes in the preclick or postclick methods.
The design idea behind this is that the class code will always be 100% correct, at least in theory, so the click event code will never need overriding.
The MyCommandButton class doesn't have pre or post click event and is to be used for other buttons that don't have classed code.
My problems are :
1 - Issues around the developer knowing which button to use and when
2 - The fact that the same control has a different class interface and doesn't have a good level of abstractions eg, one uses pre and post methods whilst the other uses the click method.
3 -The fact that when using one class code is placed in one set of methods, pre and post, and when using the other control code is placed in another methods, the click.
I think I may be better off subclassing all my buttons from the MyAppCommandButton class so that all the buttons in my app have the same class interface and standard methods.
Do you think it's a good idea to have the click event private so that you cannot override it?
Any feedback would be appreciated.
Bernard
This class is based around the command button control and the hierarchy looks like this :-
FoxproBaseCommandButton
|
V
MyStandardCommandButton
|
---------------|
| V
| MyAppCommandButton
| Method Click - Private
| Method PreClick - Public
| Method PostClick - Public
|
MyCommandButton
My intention is that when we create classed controls to do certain tasks we use the MyAppCommandButton class and prevent the user from placing code in the click event when it's subclassed. If the user wants to perform an action either before or after the click then it goes in the preclick or postclick methods.
The design idea behind this is that the class code will always be 100% correct, at least in theory, so the click event code will never need overriding.
The MyCommandButton class doesn't have pre or post click event and is to be used for other buttons that don't have classed code.
My problems are :
1 - Issues around the developer knowing which button to use and when
2 - The fact that the same control has a different class interface and doesn't have a good level of abstractions eg, one uses pre and post methods whilst the other uses the click method.
3 -The fact that when using one class code is placed in one set of methods, pre and post, and when using the other control code is placed in another methods, the click.
I think I may be better off subclassing all my buttons from the MyAppCommandButton class so that all the buttons in my app have the same class interface and standard methods.
Do you think it's a good idea to have the click event private so that you cannot override it?
Any feedback would be appreciated.
Bernard