Is it bad practice to pass instances through several layers?
Posted
by
Puckl
on Programmers
See other posts from Programmers
or by Puckl
Published on 2012-09-27T12:32:25Z
Indexed on
2012/09/27
15:50 UTC
Read the original article
Hit count: 271
class-design
|software-design
In my program design, I often come to the point where I have to pass object instances through several classes. For example, if I have a controller that loads an audio file, and then passes it to a player, and the player passes it to the playerRunnable, which passes it again somewhere else etc. It looks kind of bad, but I don´t know how to avoid it. Or is it OK to do this?
EDIT: Maybe the player example is not the best because I could load the file later, but in other cases that does not work.
© Programmers or respective owner