Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Bundling unrelated classes

by simonm (Vicar)
on Dec 18, 2004 at 18:55 UTC ( [id://415891]=note: print w/replies, xml ) Need Help??


in reply to Bundling unrelated classes

A design in which every object needs to be able to call methods on every other kind of object seems messy.

A typical approach is to adopt a layered architecture, where the lower-level objects don't know much about the higher-level ones.

For example, perhaps instead of having references to all of the other objects, the connection object can get by with just converting the incoming message into a standard format and passing it to a callback function? That way, some object from a higher layer could create the connection, pass it the relevant configuration information, and register the callback to be invoked when a message is received.

Replies are listed 'Best First'.
Re^2: Bundling unrelated classes
by redlemon (Hermit) on Dec 18, 2004 at 20:45 UTC

    It's not that I'm injecting all methods from all objects into each others namespaces, just that every object carries a reference to it's 'siblings' and 'parent'.

    But your suggestion of using my own callbacks is one I'll explore. thanks.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://415891]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2024-03-29 01:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found