Revision Notes/Design Patterns
Field Entry - Design Patterns
Prototype Pattern
Creates new objects by copying (cloning) an existing object, avoiding the overhead of creating from scratch.
Field Note - Real-world Analogy
“Like a photocopier: instead of rewriting an entire 50-page document from scratch, you put the original on the copier and get as many copies as you need instantly. Each copy is independent — writing on one doesn't affect the others.”
Field Observations - Key Topics Covered
When object creation is expensive — maybe it hits a database, calls an API, or does heavy computation — you don't want to repeat that cost every time you need a similar object. The Prototype pattern says: create the object once, then clone it whenever you need another one.
4 more observations inside
Sign in to read every key point in full
Ready to go deeper?
Open the complete revision note.
Sign in to read every field observation in full, including a runnable code example and side-by-side comparisons with related patterns.
Read Full NotesSee Also in Design Patterns