Composite class problem

Hey!

My current project is divided up into four classes that manage different areas of the program. These classes have grown very large and I want to split them up into composite classes with member classes that only care about one specific task each.

So then the entire program takes on a tree-like structure.

The problem I face is then how to handle the communication between classes. If I was to pass around pointers to any other systems that a class might need, it would quickly result in a "spider web" of dependencies and long lists of pointers.

I didn't have this problem previously since I only worked with 4 major classes and each class just carried a pointer to the others.

The problem is very general in nature and I'm sure there's plenty of theory on how to handle these situations, I just haven't been able to find any.

I can imagine a few ways to solve this problem, I'm just not sure how to implement them exactly, and I don't know whether they are good or bad in practice.

So I guess any thoughts or tips or links would be useful right now.

Thanks!
Do these object really need pointers to each and every other one? Maybe there is just a parent child relationship? The parent delegates commands to each sibling, the siblings don't know about each other? It's hard to say without any kind of picture or if the objects are even related.
If the four classes you have need to know about each other at all times, then they should reall be one class. Splitting them up even further because they are too big is a sign that you're doing something wrong.
Topic archived. No new replies allowed.