Answer the question
In order to leave comments, you need to log in
What design pattern to use?
Good afternoon. I'm not very good with patterns. I can’t figure out which one will fit, but I’m almost sure that there is one.
Essence - there is a main class, let it be Depot, and it will have a method for creating a class, conditionally - Tram.
And in the Depot class, there should be information about all "Trams" initialized through this method, so that by calling a certain method in the Depot, it can refer to all Trams (Well, for example, a command for everyone to go to the depot).
How it is better to implement it? Language - PHP. I need to make a competent architecture.
Answer the question
In order to leave comments, you need to log in
The depot does not create trams. And the "commands" come from the dispatcher.
It is easier to refer to objects in the real world.
you can compose a Prototype to create Trams, Trains (in php this is a clone)
And place it in the Depot - the Pool of objects
Well, then it depends on whether there will be feedback from the Trams with the Depot and with other Trams.
Examples here
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question