Grokking Design Patterns for Engineers and Managers
0% completed
Prototype Pattern
The Prototype Pattern creates a new object by copying one that is already configured, instead of building it from nothing.
Producing a fresh object is sometimes expensive. The setup reads a file, queries a database, parses a template, or applies forty defaults. If an object already exists in exactly the right shape, constructing another from scratch repeats all that work for no reason.
Consider a NotificationTemplate parsed from disk at start-up. Every welcome email is that template with the subject changed and a channel added
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%