|
Prev: customerisnotalwaysright.
Next: background image
From: Matthias Watermann on 6 May 2008 09:17 On Tue, 06 May 2008 05:00:58 -0700, VK wrote: > [...] > For a long right run it is not instance business to handle RMI (Remote > Method Invocation), they have to do their job right first. For RMI > there should be a separate dispatcher. This way an instance sends > request to the dispatcher with reference to itself as request > consumer. The dispatcher then handles the request queue and returns > results to consumers by stored references. > This way you don't care what identifier(s) is(are) currently used to > hold a reference to the object which is the proper way to do things. Ah, thank you very much! I definitely like such an approach. Quite possibly that would allow for omitting the whole inheritance stuff and use a design-by-contract model instead. Hmm, the more I think of it the more charming it becomes ... -- Matthias /"\ \ / ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL X - AGAINST M$ ATTACHMENTS / \
From: sheldonlg on 6 May 2008 10:48 Matthias Watermann wrote: > On Tue, 06 May 2008 05:00:58 -0700, VK wrote: > >> [...] >> For a long right run it is not instance business to handle RMI (Remote >> Method Invocation), they have to do their job right first. For RMI >> there should be a separate dispatcher. This way an instance sends >> request to the dispatcher with reference to itself as request >> consumer. The dispatcher then handles the request queue and returns >> results to consumers by stored references. >> This way you don't care what identifier(s) is(are) currently used to >> hold a reference to the object which is the proper way to do things. > > Ah, thank you very much! I definitely like such an approach. Quite > possibly that would allow for omitting the whole inheritance stuff and > use a design-by-contract model instead. Hmm, the more I think of it > the more charming it becomes ... > > Try this one line: <input type="button" onclick="alert('My name is ' + this.id)" id="foo" value="Click Me"> and see what happens for you. Yes, each tag needs to be given a name for this to work, but if you want a generic javascript with a generic calling method, the use of "this" will work and give you the objects id.
From: Matthias Watermann on 6 May 2008 11:51
On Tue, 06 May 2008 10:48:00 -0400, sheldonlg wrote: >>> [...] >>> For a long right run it is not instance business to handle RMI (Remote >>> Method Invocation), they have to do their job right first. For RMI >>> there should be a separate dispatcher. This way an instance sends >>> request to the dispatcher with reference to itself as request >>> consumer. The dispatcher then handles the request queue and returns >>> results to consumers by stored references. >>> This way you don't care what identifier(s) is(are) currently used to >>> hold a reference to the object which is the proper way to do things. >> >> Ah, thank you very much! I definitely like such an approach. Quite >> possibly that would allow for omitting the whole inheritance stuff and >> use a design-by-contract model instead. Hmm, the more I think of it >> the more charming it becomes ... >> > > Try this one line: > > <input type="button" onclick="alert('My name is ' + this.id)" id="foo" > value="Click Me"> > > and see what happens for you. Yes, each tag needs to be given a name > for this to work, but if you want a generic javascript with a generic > calling method, the use of "this" will work and give you the objects id. My markup doesn't contain any "onXXX" attributes since I prefer to clearly separate markup (HTML), presentation (CSS) and behaviour (JavaScript). But I see your point. However, my objects are not tied to a certain tag (i.e. its JavaScript/DOM incarnation); sometimes they may handle several page elements - like, say all anchors - sometimes they become active somewhere in the event chain controlled by the respective method arguments. So it's not a tag identifier I was looking for (that's easy enough as you pointed out) but the name of a JavaScript object which I intended to send to the remote server. Thanks for your thoughts anyway. -- Matthias /"\ \ / ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL X - AGAINST M$ ATTACHMENTS / \ |