Some general java design question.
I have a main class "Telegram" (it generates XML-Telegrams - just to give some context)
In the course of working, a telegram object creates other objects (lets call them detail objects) of different classes to build up all the data that finally go into the XML-File. Now there's some steering information of how this information is to be gathered which also has to be communicated to some of the other objects. For instance at the moment there is a method in the telegram class which tells us, if a specific behaviour should be taken or not. These kind of exceptional behaviours might get more over time.
So I was wondering: should I put a reference of the central telegram object (aka "this") to all subsequently created detail objects, so the detail objects can question the telegram object about the steering information? Or should I transmit this steering information in form of specific parameters? Or is there an kind of desing pattern for this kind of task which I have overlooked? What would be the most elegant but also practical way of doing this? Ideas?
Aucun commentaire:
Enregistrer un commentaire