Hello,
As a junior developper, i'm a bit confused about some design patterns. Sometimes, i just don't know which to use in which context.
For exemple, on creational patterns, i don't really know when to use:
- Factory
- Prototype
- Builder
Actually, i see some differences; but i also see that you can use multiple solutions like:
- Calling a factory that calls the appropriate builder that clones a prototype.
- Calling a factory that clones the appropriate prototype
- Calling a builder with the appropriate director
- ...
I mean, the result of these creations is at the end the same: you get your object instance.
I just wonder what kind of design you would use on different contexts (i guess it could be depending on performence needs, objects complexity, coupling...)
Also, I don't really see a big differences between a facade and a mediator, except the mediator calls different interfaces.
Same for chain of responsability, don't really understand why all implementations i see use chained lists. Can't this pattern be implemented with a simple List of handlers that we call successively?
That's why i'd like people to tell me in which concrete context you would use a GoF pattern, and also why you wouldn't use any of the other patterns that could have fit to the given problem (but probably in a less elegant way).
Thanks