Design Patterns : Prototype
Updated: Jul 12, 2021
As always here is the link to the GitHub repo :)
If this post has helped you feel free to like, comment and share.
In this post I'll be going through the prototype design pattern.
Fist off... it is a pattern best suited for cloning objects without coupling them. The UML diagram below demonstration this:
For our example we will be making a cloning machine for cloning sheep. Our first step is to define our sheep. This is the object that we can get cloning.
Now for the terminology:
. A deep copy is a clone of an object that has all of the same properties.
. A shallow copy is a clone that copies as little as possible.
This is an example of how this pattern can be implemented.
I hope that this has helped you to understand the Prototype pattern. Catch you on the flip.
( ͡ ͡° ͜ ʖ ͡ ͡°) \╭☞ \╭☞