Hi Jay,
|| > I would prefer VB to insert 'TheTextBox' or some name
|| > tailored to the Control or Object. Ah, well.
||
|| Interesting thought. What happens in the case where I have
|| MenuItem.Click, ToolBarButton.Click, Button.Click and
|| Form.Close all being handled by the same event handler?
Lol. ... and <Form.Close>!!
Yes, my scheme only works for dedicated handlers. But 'tis more than a
few. Actually it's an ideal. In use I leave sender and e as given. That's why
'Ah, well' because I can't battle against a never ending tide of VB defaults.
It's a shame that it's not an option, though it would possibly confuse those
who are bound to the convention. [Know any good code reformatters, eh? No,
<good> ones, lol.!!]
|| I normally give 'theTextBox' or just 'textbox' when I cast 'sender'
|| to the specific type.
I've decided I'm going to stick to my 'o's. I think it's the Irish in me.
Thus I can have oDear As Mishap, and oGod As Deity. I'm still vascillating
over clsSomething versus plain Something.
|| Note that the EventHandler delegate is used by a significant number of
|| events. Which enables having only one Delegate class defined, rather
than
|| having a significant number of Delegate Classes... (code reuse). Hence
the
|| very generic names for the parameters.
Yes - that's what I meant by 'standard pattern' and when your post
appeared I saw that you had used it too.
Here's part of a set of classes that I have in C# that might make you
shudder.
public class VoidDelegates
{
public delegate void v_i (int iArg);
public delegate void v_s (string sArg);
public delegate void v_t (bool tArg);
public delegate void v_o (object oArg);
public delegate void v_ii (int iArg1, int iArg2);
public delegate void v_is (int iArg1, string sArg2);
public delegate void v_iii (int iArg1, int iArg2, int
iArg3);
public delegate void v_iis (int iArg1, int iArg2, string
sArg3);
public delegate void v_ss (string sArg1, string sArg2);
public delegate void v_so (string sArg1, object oArg2);
}
We're talking majorly <generic>!! It's used within a system that has no
knowledge of its users' semantics - it just takes 'em in and sends 'em out, as
it were.
|| Public Event NotifyUser(ByVal sender As Object, _
|| ByVal e As EventArgs)
I must admit I haven't seen this one - in fact, I haven't actually used
the keyword 'Event' much. I find this area so much simpler in C# where it's
all out in the open. This VB behind-the-scenes helpfulness <is> helpful, but
it can delay the fullness of grokking.
|| > 'e' is another stupid name
|| I would have expected eventArgs
And, to be sure, Oid be after havin' oEventArgs, now. But yet again I go
with what's given. I'm going to have to undo my habit of Catch e As Exception,
though, and get used to using 'ex' so it doesn't clash with 'e'.
|| > ... I like g for Graphics!
|| I normally prefer gr for Graphics!
That I actually like better, and I'm going to steal it off you. ;-)
|| I mostly agree having a more specific names & types may be nice
|| on the event handlers, however part of OOP is generalization &
|| code reuse. If you start giving specifics you are introducing
coupling...
Yes. There are clear cases where close coupling is neither here nor there,
and yet others where it is to be avoided. And we can spend years umming and
ahhing about the grey areas and changing our mind one way and back as our
experience grows. At least I will. ;-) Some of my 'standards' are decidely
shifty in the longer term.
Best regards,
Fergus
ps. Thank you. It's been nice having this conversation with you.
) Much
relief - I was concerned that I had offended you in the IIM (not-a-) debate
and had thought out, though not sent, my apologies. And secondly, after a
battle last night with a (to me at least) rude poster, it's nice sharing an
understanding and being agreeable. It's my preferred state, lol, whatever he
may have thought.