Hallo, I looked at the various loose-coupling questions around here but couldn't pin down something similar to my question, so apologies if it's already been asked.
Basically I have a homegrown, very simplistic routing library that consists of Segment
s, Hub
s, and Stub
s. Hub
s and Stub
s inherit Segments
, and represent directories or primitive controllers, and pages, or views, respectively. There's also a Root
class which inherits Hub
, representing the root of the application (for convenience' sake).
Hub
classes have 2 methods, one for adding a child Hub, and one for adding a child Stub. Here's where my question comes in: does it become more coupled if Hubs know about templates and the functions that the afore-mentioned methods wrap (they're decorators, called like @somehub.expose_stub
)? If so, how do I let my application know what templates functions use, and the functions themselves? Or should I move the responsibility of adding Stubs and Hubs to the application itself and just have a map of views to the Stubs they represent? Wouldn't hubs, stubs, segments, etc become completely meaningless then, aside from offering an OO interface to view trees?