Re: communication between different parts of application via signals
- From: Chris Vine <chris cvine freeserve co uk>
- To: gtkmm-list gnome org
- Subject: Re: communication between different parts of application via signals
- Date: Mon, 26 Jun 2006 23:06:29 +0100
On Monday 26 June 2006 06:33, Joe Van Dyk wrote:
> On 6/25/06, Chris Vine <chris cvine freeserve co uk> wrote:
> > On Sunday 25 June 2006 18:13, Joe Van Dyk wrote:
[snip]
> > > Historically, I've hooked up a function to the clicked event of the
> > > check box. And that function calls member functions of the different
> > > objects in the application. So, signals aren't used for
> > > communication. But something about that seems smelly.
> >
> > I do not really understand what you are saying. sigc slots are just
> > callbacks, executed at the point the signal is invoked. Nothing
> > "listens" to them; they just execute when called, like any other function
> > pointer or functor or callback.
> >
> > If the callback function calls other member functions it does so because
> > you have coded the callback function to call the member functions.
>
> "Ardour makes heavy use of libsigc++ as a way to provide anonymous
> coupling between components, particulular between the backend and user
> interface. The code makes heavy use of the Model-View-Controller
> programming model, and attempts to draw from the best work on
> programming pattern languages." From http://ardour.org/development .
> That's what I'm asking about.
>
> I wonder if I'm not understanding "anonymous coupling" correctly. Hm.
This doesn't seem to have anything to do with your original post, which didn't
really make sense.
Any form of callback mechanism, whether plain function pointers, function
objects, libsigc++, .NET delegates or the numerous similar techniques help
promote loose coupling of objects (if, as I assume, that is what is meant by
"anonymous coupling"). Loose coupling of objects promotes modularity which
promotes good code organisation which promotes maintainability and
extensibility.
If you view the libsigc++ signal/slot mechanism as a means of organising your
code through type safe function pointers (callbacks) suitable for use with
class methods and with automatic disconnection of the callbacks when relevant
objects cease to exist then you will not be far out. It is not magic (it
doesn't create code execution paths you have not written).
Chris
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]