Prototype Pattern
SW 10
1. Introduction
Problem 1
• (?) 

• 2**10 + @ 

• , 

• =>
Problem 2
• 

• 

• 

• =>
2. Prototype Pattern
What is Prototype Pattern?
• new 

• ” ” ?

• “ ”
Structure of Prototype
3. USE CASE & Caveat
Prototype Pattern in JAVA
Shape.java
Example (cont.d)
Square.java
Example (cont.d)
Circle.java
Example (cont.d)
ShapeCache.java
Example (cont.d)
PrototypePatternDemo.java (Main Program)
Java Clonable interface
• Clone 

• Clonable 

• Clone CloneNotSupport 

• Thread-safe Clone lock 

• array.clone !
Java Data Type
• : int, float, double, long, char, byte

• : , ( , )

• C, C++ 

shallow VS deep copy
• (primitive type) 

• 

• C++ / / 

• Shallow Copy ( ) 

• Deep Copy
Shared Object
• object : Flyweight 

• object 1 ? : Singleton 

• / : Memento
Prototype Pattern in JS
• 

• 

• prototype
Prototype Pattern in JS
Reference
• Java 

• Tutorialspoint

• Evacast PPT
END

Prototype 패턴 (심만섭)