The prototype design pattern is useful when performance is important. Using the copy method, we can get instances that otherwise take time to create. The slowness could be caused by some calculations performed during creation, a database call that retrieves data, and so on.
What it is good for?
Get Scala Design Patterns - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.