The right way to implement communication between java objects

Posted by imoschak on Stack Overflow See other posts from Stack Overflow or by imoschak
Published on 2010-03-19T12:17:36Z Indexed on 2010/03/19 12:21 UTC
Read the original article Hit count: 128

I'm working on an academic project which simulates a rather large queuing procedure in java. The core of the simulator rests within one package where there exist 8 classes each one implementing a single concept. Every class in the project follows SRP. These classes encapsulate the behavior of the simulator and inter-connect every other class in the project. The problem that I has arisen is that most of these 8 classes are, as is logical i think, tightly coupled and each one has to have working knowledge of every other class in this package in order to be able to call methods from it when needed. The application needs only one instance of each class so it might be better to create static fields for each class in a new class and use that to make calls -instead of preserving a reference in each class for every other class in the package (which I'm certain that is incorrect)-, but is this considered a correct design solution? or is there a design pattern maybe that better suits my needs?

© Stack Overflow or respective owner

Related posts about java

Related posts about object-oriented-design