benefits of callbacks 
Author Message
 benefits of callbacks

A co-worker asked today what they were and why they are so useful, and to be
honest, I struggled in giving a good example. Anyone have a sec to spare?

Thanks!
Jack



Sat, 03 Jul 2004 15:23:16 GMT  
 benefits of callbacks
A callback gives the power of a virtual or late binding function to a non OO
language.

Will that do?

Ralph

Quote:
----- Original Message -----


Sent: Tuesday, January 15, 2002 8:10 PM
Subject: benefits of callbacks

> A co-worker asked today what they were and why they are so useful, and to
be
> honest, I struggled in giving a good example. Anyone have a sec to spare?

> Thanks!
> Jack



Sat, 03 Jul 2004 15:50:15 GMT  
 benefits of callbacks
Ok, but being in Ruby (which most certainly is OO =P), why are callbacks so
useful?

Thanks!
Jack

Quote:
> -----Original Message-----

> Sent: Tuesday, January 15, 2002 2:47 AM
> To: ruby-talk ML
> Subject: Re: benefits of callbacks

> A callback gives the power of a virtual or late binding function
> to a non OO
> language.

> Will that do?

> Ralph

> ----- Original Message -----


> Sent: Tuesday, January 15, 2002 8:10 PM
> Subject: benefits of callbacks

> > A co-worker asked today what they were and why they are so
> useful, and to
> be
> > honest, I struggled in giving a good example. Anyone have a sec
> to spare?

> > Thanks!
> > Jack



Sun, 04 Jul 2004 00:34:42 GMT  
 benefits of callbacks
Signals.  You can register a function (or an object, in Ruby) to listen
to a particular function in another object.  Then, when said signal is
generated, the callback is activated.

The place this is most commonly used is a GUI.  For example, you can
register an object to be called when a user signal is generated (user
clicked on OK button).

Without callbacks, you'd have to, for ever GUI object, make a child
object with some form of "activate" method or something, which would be
more complex (depending on the exact situation).  And then, on top of
that, only the child object could respond - if you need multiple
sections of code to be updated when a signal is generated, it wouldn't
be possible without callbacks (or some really really ugly code).

Another way to look at callbacks is the way Ruby allows you to
dynamically change a method in an object.  This is, really, just another
form of callbacks.  Setting the method is analogous to registering a
callback; when the object invokes the method, it's just like calling a
callback.  Of course, setting a method of an object is limited in that
you can only have *one* callback registered for a particular purpose at
a time...

Quote:

> Ok, but being in Ruby (which most certainly is OO =P), why are callbacks so
> useful?

> Thanks!
> Jack

> > -----Original Message-----

> > Sent: Tuesday, January 15, 2002 2:47 AM
> > To: ruby-talk ML
> > Subject: Re: benefits of callbacks

> > A callback gives the power of a virtual or late binding function
> > to a non OO
> > language.

> > Will that do?

> > Ralph

> > ----- Original Message -----


> > Sent: Tuesday, January 15, 2002 8:10 PM
> > Subject: benefits of callbacks

> > > A co-worker asked today what they were and why they are so
> > useful, and to
> > be
> > > honest, I struggled in giving a good example. Anyone have a sec
> > to spare?

> > > Thanks!
> > > Jack



Sun, 04 Jul 2004 00:45:25 GMT  
 benefits of callbacks
Ok...the idea made sense before, but I can see how this would really save
some time in certain situations.

Thanks!
Jack

Quote:
> -----Original Message-----

> Sent: Tuesday, January 15, 2002 11:43 AM
> To: ruby-talk ML
> Subject: RE: benefits of callbacks

> Signals.  You can register a function (or an object, in Ruby) to listen
> to a particular function in another object.  Then, when said signal is
> generated, the callback is activated.

> The place this is most commonly used is a GUI.  For example, you can
> register an object to be called when a user signal is generated (user
> clicked on OK button).

> Without callbacks, you'd have to, for ever GUI object, make a child
> object with some form of "activate" method or something, which would be
> more complex (depending on the exact situation).  And then, on top of
> that, only the child object could respond - if you need multiple
> sections of code to be updated when a signal is generated, it wouldn't
> be possible without callbacks (or some really really ugly code).

> Another way to look at callbacks is the way Ruby allows you to
> dynamically change a method in an object.  This is, really, just another
> form of callbacks.  Setting the method is analogous to registering a
> callback; when the object invokes the method, it's just like calling a
> callback.  Of course, setting a method of an object is limited in that
> you can only have *one* callback registered for a particular purpose at
> a time...


> > Ok, but being in Ruby (which most certainly is OO =P), why are
> callbacks so
> > useful?

> > Thanks!
> > Jack

> > > -----Original Message-----

> > > Sent: Tuesday, January 15, 2002 2:47 AM
> > > To: ruby-talk ML
> > > Subject: Re: benefits of callbacks

> > > A callback gives the power of a virtual or late binding function
> > > to a non OO
> > > language.

> > > Will that do?

> > > Ralph

> > > ----- Original Message -----


> > > Sent: Tuesday, January 15, 2002 8:10 PM
> > > Subject: benefits of callbacks

> > > > A co-worker asked today what they were and why they are so
> > > useful, and to
> > > be
> > > > honest, I struggled in giving a good example. Anyone have a sec
> > > to spare?

> > > > Thanks!
> > > > Jack



Sun, 04 Jul 2004 00:45:25 GMT  
 benefits of callbacks
And event loops are more portable and more robust
than threads.  I wish this were not so, but alas,
it is ;^)
I don't exactly see how callbacks save time, but they certainly
can reduce complexity of code, and are easier to debug than
threads.
Quote:

> Ok...the idea made sense before, but I can see how this would really save
> some time in certain situations.

> Thanks!
> Jack
>> > > A callback gives the power of a virtual or late binding function
>> > > to a non OO
>> > > language.
>> > > Subject: benefits of callbacks

>> > > > A co-worker asked today what they were and why they are so
>> > > useful, and to
>> > > be
>> > > > honest, I struggled in giving a good example. Anyone have a sec
>> > > to spare?



Sun, 04 Jul 2004 01:39:32 GMT  
 benefits of callbacks
Hey Phil,

Good point...as far as time, I meant less complex code -> less
writing/debugging/etc

Thanks,
Jack

Quote:
> -----Original Message-----

> Sent: Tuesday, January 15, 2002 12:54 PM
> To: ruby-talk ML; undisclosed-recipients:
> Subject: Re: benefits of callbacks

> And event loops are more portable and more robust
> than threads.  I wish this were not so, but alas,
> it is ;^)
> I don't exactly see how callbacks save time, but they certainly
> can reduce complexity of code, and are easier to debug than
> threads.


> > Ok...the idea made sense before, but I can see how this would
> really save
> > some time in certain situations.

> > Thanks!
> > Jack
> >> > > A callback gives the power of a virtual or late binding function
> >> > > to a non OO
> >> > > language.
> >> > > Subject: benefits of callbacks

> >> > > > A co-worker asked today what they were and why they are so
> >> > > useful, and to
> >> > > be
> >> > > > honest, I struggled in giving a good example. Anyone have a sec
> >> > > to spare?



Sun, 04 Jul 2004 02:00:38 GMT  
 benefits of callbacks

Quote:

> Hey Phil,

> Good point...as far as time, I meant less complex code -> less
> writing/debugging/etc.

Yeah, I realised that 5 seconds after hitting send... sorry,
sometimes my fingers get ahead of my brain.  You can imagine
the trouble that causes outside of usenet ;^)


Sun, 04 Jul 2004 02:46:34 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Why a Java programmer can benefit from Smalltalk

2. Benefits of saving the image

3. Benefits of VB versus FB under OS/390

4. Maryland/DC Smalltalk Position 100-105K Perm + Full Benefits

5. Benefits of FP

6. Benefits of saving the image

7. Incremental Development Process is Key to Capturing OO Benefits

8. Benefits of Dynamic Typing

9. Benefits and Contract Work

10. perm VW job up to 95K Plus benefit

11. Upgrade to CW5.0 Benefits?

12. Payroll/Benefits Administrator

 

 
Powered by phpBB® Forum Software