The subject doesn't quite explain it well, but here is what I am curious
about.  My program designs usually include a repository of objects that many
parts of the application will need.  For instance, in a client/server app
the link back to the server would be one such object.  A global dictionary
of metadata items would be another.

Back in the MFC days (gasp), I could put these items/collections in the App
class and each part of the application could get to them via AfxGetApp()
with a cast back to the app class.  Components wouldn't do so, but other
parts could.  Of course they always got to them through methods so I could
control what the parts saw if necessary.

I'm facing the same problem in my current application and I'm solving it by
passing these things around to everything as constructor arguments.  This is
painful because I have ended up passing things through several classes for
the sole purpose of something down below using it.  This seems inefficient
and it's hideous when you change the layout (which I've done a few times)
because you have a million constructor arguments to fix/add to.

Does anyone know a better way to do this?  It may not be pure OOD, but the
pure approach in this case creates a maintenance nightmare.

John Woodard
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>

Reply via email to