Linked by Eugenia Loli on Sun 22nd Apr 2007 07:43 UTC
.NET (dotGNU too) All too often, source code spends a lot of time on basic housekeeping, monitoring the state of many objects. This is wasteful, and with C# it is unnecessary. Software expert Stephen Morris shows how C# provides a range of callback mechanisms that obviate the need for polling objects for state information.
Thread beginning with comment 232897
To read all comments associated with this story, please click here.
It is a shame
by joshv on Sun 22nd Apr 2007 12:45 UTC
joshv
Member since:
2006-03-18

Yeah, it's a shame, all that polling logic I've written in Java because I don't understand how to use java.util.Observable, or the various event listener interfaces most frameworks provide.

Reply Score: 2

RE: It is a shame
by Matzon on Sun 22nd Apr 2007 13:28 in reply to "It is a shame"
Matzon Member since:
2005-07-06

I do so hope that was ironic...

Reply Parent Score: 1

RE[2]: It is a shame
by joshv on Sun 22nd Apr 2007 15:56 in reply to "RE: It is a shame"
joshv Member since:
2006-03-18

No, I was serious.

Reply Parent Score: 2

RE: It is a shame
by nberardi on Sun 22nd Apr 2007 15:09 in reply to "It is a shame"
nberardi Member since:
2005-07-10

I thought this is why we used the delegate event model, or the event subscriber model, so that we didn't have to monitor all this stuff?

Reply Parent Score: 1

RE[2]: It is a shame
by jayson.knight on Sun 22nd Apr 2007 18:43 in reply to "RE: It is a shame"
jayson.knight Member since:
2005-07-06

"I thought this is why we used the delegate event model, or the event subscriber model, so that we didn't have to monitor all this stuff?"

You are absolutely 100% correct. I have no idea why the author went through all the pains of setting up all the callbacks/polling/whatever you want to call it, by hand in this example when delegates (Name EventHandler delegates) would have more than sufficed, as well as made the code much more readable, and smaller.

It's almost like he went out of his way to do it the Java way ;-).

Reply Parent Score: 3