SlideShare a Scribd company logo
Holub on PatternsChapter 3.1 โ€“ Game of Life ์•„๊ฟˆ์‚ฌhttp://andstudy.com ์•ˆ๋ช…ํ™˜http://eritaka.net
John Conwayโ€™s Game of Life ์˜ค์ง 2 ๊ฐ€์ง€ ๋ฒ•์น™ ์ฃฝ์–ด ์žˆ๋Š” ์…€์€ 3๊ฐœ์˜ ์ด์›ƒ์ด ์žˆ์œผ๋ฉด ์‚ด์•„๋‚œ๋‹ค ๋‘ ๊ฐœ ํ˜น์€ ์„ธ ๊ฐœ์˜ ์ด์›ƒ๋งŒ์„ ๊ฐ€์ ธ์•ผ๋งŒ ์‚ฐ๋‹ค
ํŠน์ง• โ€“ Game of Life Emergence ํ•˜์œ„ ์ˆ˜์ค€์—๋Š” ์—†๋Š” ํŠน์„ฑ์ด ์ƒ์œ„ ์ˆ˜์ค€์—์„œ ์ž๋ฐœ์ ์œผ๋กœ ์ถœํ˜„ํ•˜๋Š” ํ˜„์ƒ ๋ฏธ์‹œ ๋™๊ธฐ์˜ ๊ฒฐํ•ฉ์œผ๋กœ ์ธํ•œ ๊ฑฐ์‹œ ํ–‰๋™ ํ˜•์„ฑ ๋‹ค์–‘ํ•œ ํŒจํ„ด ๋ฐœ์ƒ
Game of Life
Static Model
Design Pattern Singleton Visitor Observer Composite Facade Mediator Prototype Memento Flyweight
class Java Menu SubSyst... JComponent ยซProperty> -  name -  text +  setName(String) : void +  getName() : String +  setText(String) : void +  getText() : String AbstractButton JMenuBar ยซinterface> notifies ActionListener +  addActionListener(ActionListener) : void +  add(JMenu) : void ยซcall? +  actionPerformed(ActionEvent) : void +  removeActionListener(ActionListener) : void #  fireActionPerformed(ActionEvent) : void Observer 1 Subject Observer JMenuItem Component & Leaf +  JMenuItem(String) Concrete Observer Concrete Subject * Composite {submenus} <<anonymous>> 1 Composite +  actionPerformed(ActionEvent) : void Concrete Subject JMenu +  add(JMenuItem) : void * {menus} Case Study: Menu (Java Swing)
Observer ๋ฌธ์ œ ๊ตฌํ˜„ ์ƒ์† ๊ธฐ๋ฐ˜์˜ ํ•ด๊ฒฐ์•ˆ abstract class BadJMenuItem { abstract void itemSelected(); } classMyMenuItemextendsBadJMenuItem { public void itemSelected() { //์•„์ดํ…œ์ด ์„ ํƒ๋˜์—ˆ์„ ๋•Œ ์ˆ˜ํ–‰ํ•  ๊ฒƒ... 	} } ,[object Object]
๋ชจ๋“  ๋ฉ”๋‰ด ์•„์ดํ…œ์ด BadJMenuItem์ƒ์†
BadJMenuItem์„ ์ƒ์†ํ•œ ๊ฐœ์ฒด์—๋งŒ ํ†ต์ง€,[object Object]
Observer: ๋ฉ€ํ‹ฐ์Šค๋ ˆ๋“œ ํ™˜๊ฒฝ 1 ํ•ด๊ฒฐ์ฑ… 1์˜ ๋ฌธ์ œ class Publisher1 { ArrayList subscribers = new ArrayList(); // fireEvent๋ฅผ ๊ธฐ๋‹ค๋ฆฌ๋‹ค๊ฐ€ ๊ธฐ์•„ ํ˜„์ƒ ๋ฐœ์ƒ public synchronized void subscribe(Runnable subscriber) { subscribers.add(subscriber); } public synchronized void cancelSubscribe(Runnable subscriber) { subscribers.remove(subscriber); } private synchronized void fireEvent() { for(inti=0; i < subscribers.size(); ++i) 		((Runnable)subscribers.get(i)).run(); // ์‹œ๊ฐ„์ด ๊ฑธ๋ฆฐ๋‹ค! }}
Observer: ๋ฉ€ํ‹ฐ์Šค๋ ˆ๋“œ ํ™˜๊ฒฝ 2 ํ•ด๊ฒฐ์ฑ… 2์˜ ๋ฌธ์ œ class Publisher2 { private Collection subscribers = newLinkedList(); // Iterator์—ฐ์‚ฐ ์ค‘ add, remove ํ˜ธ์ถœ ์‹œ ์˜ˆ์™ธ ๋ฐœ์ƒ public synchronized void subscribe(Runnable subscriber) { subscribers.add(subscriber); } public synchronized void cancelSubscribe(Runnable subscriber) { subscribers.remove(subscriber); } private void fireEvent() { for( Iteratori=subscribers.iterator(); i.hasNext(); ) 		((Runnable)i.next()).run();  }}
Observer: ๋ฉ€ํ‹ฐ์Šค๋ ˆ๋“œ ํ™˜๊ฒฝ 3 ํ•ด๊ฒฐ์ฑ… 3์˜ ๋ฌธ์ œ class Publisher3 { private Collection subscribers = newLinkedList(); public synchronized void subscribe(Runnable subscriber) { subscribers.add(subscriber); } public synchronized void cancelSubscribe(Runnable subscriber) { subscribers.remove(subscriber); } // ํ†ต์ง€ ์ด๋ฒคํŠธ ์‹œ๋งˆ๋‹ค ๋ณต์‚ฌ๋ณธ์ด ์ƒ์„ฑ (๊ตฌ๋…์ทจ์†Œ ์ด๋ฒคํŠธ์™€ ์ƒ๊ด€์—†์ด) private void fireEvent() { Collection localCopy; synchronized( this ) { localCopy = subscribers.clone(); } for( Iteratori=localCopy.iterator(); i.hasNext();) 	((Runnable)i.next()).run(); }}
Observer: ๋ฉ€ํ‹ฐ์Šค๋ ˆ๋“œ ํ™˜๊ฒฝ 4 ๋ถˆ๋ณ€ ๊ฐ์ฒด ๋…ธ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋ฆฌ์ŠคํŠธ ํ•ด๊ฒฐ๋ฒ• ์ด์ „: ํ—ค๋“œ d:Object c:Object b:Object a:Object ์ดํ›„: ๊ฐ€๋น„์ง€ ์ปฌ๋ ‰์…˜ ๋  ๊ฒƒ์ž„ ์ด์ „ ํ—ค๋“œ d:Object c:Object b:Object a:Object ํ—ค๋“œ
class GoF_Visitor Visitor +  VisitConcreteElementA(ConcreteElementA) +  VisitConcreteElementB(ConcreteElementB) ConcreteVisitor1 ConcreteVisitor2 +  VisitConcreteElementA(ConcreteElementA) +  VisitConcreteElementA(ConcreteElementA) +  VisitConcreteElementB(ConcreteElementB) +  VisitConcreteElementB(ConcreteElementB) Element ObjectStructure 1..* +  Accept(Visitor) ConcreteElementA ConcreteElementB +  Accept(Visitor) +  Accept(Visitor) v->VisitConcreteElementA(this) v->VisitConcreteElementB(this) GoFโ€“ Visitor Pattern ์˜๋„ ๊ธฐ์กด ๊ณ„์ธต ๊ตฌ์กฐ๋ฅผ ์ˆ˜์ •ํ•˜์ง€ ์•Š๊ณ  ์ƒˆ๋กœ์šด ๋ฉ”์†Œ๋“œ๋ฅผ ์ถ”๊ฐ€ํ•˜๊ณ ์ž ํ•  ๋•Œ ์ „๋ฌธ๊ฐ€ ๋„์ž…
sd LifeGameVisitor Clock publisher subscribers[i] : :Distributor subscribers[i].subscriber Node tick() publish(:Distributor) *accept(:Distributor) deliverTo(subscribers[i].subscriber) tick() "visit"  ๋ฉ”์†Œ๋“œ sd GoF_Visitor aObjectStructure aConcreteElement[i] aConcreteVisitor *accept(Distributor) visit(aConcreteElement[i]) operation() Holub Visitor vsGoF Visitor 1
class Visitor_Car ยซinterface? CarElementVisitor +  visit(Wheel) : void +  visit(Engine) : void +  visit(Body) : void ยซinterface? CarElement +  accept(CarElementVisitor) : void CarElementPrintVisitor Engine Wheel Body class Visitor_Holub +  accept(CarElementVisitor) : void +  accept(CarElementVisitor) : void +  accept(CarElementVisitor) : void v.visit(this) v.visit(this) v.visit(this) Publisher ยซinterface? Distributor +  accept(Distributor) : void forall node in list +  deliverTo(Object) : void    node.accept(:Distributor); <<anonymous>> Node +  deliverTo(Object) : void -  subscriber:  Object ((Observer)subscriber).notify(); +  accept(Distributor) : void distributor.deliverTo(subscriber); Holub Visitor vsGoF Visitor 2
Publisher vsAWTEventMulticaster AWTEventMulticaster AWT์˜ ๋ชจ๋“  ๋ฆฌ์Šค๋„ˆ ์ธํ„ฐํŽ˜์ด์Šค ๊ตฌํ˜„ ์ด๋ฒคํŠธ ํƒ€์ž…์ด ์ถ”๊ฐ€๋  ๋•Œ๋งˆ๋‹ค ํ•ด๋‹น ์ธํ„ฐํŽ˜์ด์Šค์— ๋Œ€ํ•œ ๊ณผ๋„ํ•œ ์ฝ”๋“œ ์ˆ˜์ • Publisher ์ž„์˜์˜ ์ด๋ฒคํŠธ๋ฅผ ์ž„์˜์˜ ๊ตฌ๋… ๊ฐ์ฒด์— ์ถœํŒ ์ด๋ฒคํŠธ ํƒ€์ž… ์ถ”๊ฐ€ ์‹œ ์ฝ”๋“œ ์ฆ๊ฐ€๋Ÿ‰์ด ์ž‘์Œ
class GoF_Composite Component 1..* +  Operation() Client +  Add() : Component +  Remove() : Component +  GetChild() : Component Leaf Composite +  Operation() +  Operation() -children forall g in children    g.Operation(); +  Add() : Component +  Remove() : Component +  GetChild() : Component GoF โ€“ Composite Pattern ์˜๋„ ๊ฐœ๋ณ„ ๊ฐ์ฒด์™€ ๋ณตํ•ฉ ๊ฐ์ฒด๋ฅผ ๋™์ผํ•˜๊ฒŒ ๋‹ค๋ฃจ๊ณ  ์‹ถ์„ ๊ฒฝ์šฐ
class AWT_ComponentContainer public void doLayout() { Component     for( every Component in contents )         doLayout(); +  doLayout() : void } 0..* 1 Component Container +  doLayout() : void Button Leaf +  add(Component) : Component Composite Checkbox Leaf Composite Composite Window Composite Leaf Choice Frame Composite Dialog Case Study: AWT Component/Container
ํŒจํ„ด์€ ๋ณ€ํ˜•๋˜์–ด ์‹ค์ฒดํ™”๋œ๋‹ค Composite ํŒจํ„ด์˜ ์˜๋„๋ฅผ ๋ณด๋ผ class Directory System Leaf and Component SimpleFile Composite +  open() +  close() Composite +  print() Directory public void print() 0..* { {contents} +  print()     for(int i=0; i < contents.length; ++i) +  add(SimpleFile)         contents[i].print(); 1 +  remove(SimpleFile) } +  contents() : Iterator Case Study: Directory System
VS

More Related Content

What's hot

[ํ•˜์ฝ”์‚ฌ์„ธ๋ฏธ๋‚˜]๋ฏธ๋ฆฌ๋ณด๋Š” ๋Œ€๊ทœ๋ชจ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ๊ฐœ๋ฐœ
[ํ•˜์ฝ”์‚ฌ์„ธ๋ฏธ๋‚˜]๋ฏธ๋ฆฌ๋ณด๋Š” ๋Œ€๊ทœ๋ชจ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ๊ฐœ๋ฐœ[ํ•˜์ฝ”์‚ฌ์„ธ๋ฏธ๋‚˜]๋ฏธ๋ฆฌ๋ณด๋Š” ๋Œ€๊ทœ๋ชจ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ๊ฐœ๋ฐœ
[ํ•˜์ฝ”์‚ฌ์„ธ๋ฏธ๋‚˜]๋ฏธ๋ฆฌ๋ณด๋Š” ๋Œ€๊ทœ๋ชจ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ๊ฐœ๋ฐœ
์ •์„ ์–‘
ย 
Blockchain 4th dapp programming
Blockchain 4th dapp programmingBlockchain 4th dapp programming
Blockchain 4th dapp programming
ihpark92
ย 
GCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (4) - Executing System
GCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (4) - Executing SystemGCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (4) - Executing System
GCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (4) - Executing System
์ƒํ˜„ ์กฐ
ย 
Blockchain 3rd smart contract programming
Blockchain 3rd smart contract programmingBlockchain 3rd smart contract programming
Blockchain 3rd smart contract programming
ihpark92
ย 
Surface flingerservice(์„œํ”ผ์Šค ์ถœ๋ ฅ ์š”์ฒญ jb)
Surface flingerservice(์„œํ”ผ์Šค ์ถœ๋ ฅ ์š”์ฒญ jb)Surface flingerservice(์„œํ”ผ์Šค ์ถœ๋ ฅ ์š”์ฒญ jb)
Surface flingerservice(์„œํ”ผ์Šค ์ถœ๋ ฅ ์š”์ฒญ jb)fefe7270
ย 
GCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (5) - Executor with Exception
GCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (5) - Executor with ExceptionGCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (5) - Executor with Exception
GCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (5) - Executor with Exception
์ƒํ˜„ ์กฐ
ย 
GCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (8) - Group System
GCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (8) - Group SystemGCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (8) - Group System
GCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (8) - Group System
์ƒํ˜„ ์กฐ
ย 
GCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (3) - Exception
GCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (3) - ExceptionGCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (3) - Exception
GCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (3) - Exception
์ƒํ˜„ ์กฐ
ย 
Blockchain 1st bitcoin_core
Blockchain 1st bitcoin_coreBlockchain 1st bitcoin_core
Blockchain 1st bitcoin_core
ihpark92
ย 
ES6-02
ES6-02ES6-02
ES6-02
ChangHyeon Bae
ย 
๋งŒ๋“ค๋ฉด์„œ๋ฐฐ์šฐ๋Š”Cocos2d-x(12-13)
๋งŒ๋“ค๋ฉด์„œ๋ฐฐ์šฐ๋Š”Cocos2d-x(12-13)๋งŒ๋“ค๋ฉด์„œ๋ฐฐ์šฐ๋Š”Cocos2d-x(12-13)
๋งŒ๋“ค๋ฉด์„œ๋ฐฐ์šฐ๋Š”Cocos2d-x(12-13)
Seungyup Choi
ย 
Realm์€ ์–ด๋–ป๊ฒŒ ํšจ์œจ์ ์ธ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ ๋งŒ๋“ค์—ˆ๋‚˜?
Realm์€ ์–ด๋–ป๊ฒŒ ํšจ์œจ์ ์ธ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ ๋งŒ๋“ค์—ˆ๋‚˜?Realm์€ ์–ด๋–ป๊ฒŒ ํšจ์œจ์ ์ธ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ ๋งŒ๋“ค์—ˆ๋‚˜?
Realm์€ ์–ด๋–ป๊ฒŒ ํšจ์œจ์ ์ธ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ ๋งŒ๋“ค์—ˆ๋‚˜?
Leonardo YongUk Kim
ย 
Surface flingerservice(์„œํ”ผ์Šค ํ”Œ๋ง๊ฑฐ ์—ฐ๊ฒฐ jb)
Surface flingerservice(์„œํ”ผ์Šค ํ”Œ๋ง๊ฑฐ ์—ฐ๊ฒฐ jb)Surface flingerservice(์„œํ”ผ์Šค ํ”Œ๋ง๊ฑฐ ์—ฐ๊ฒฐ jb)
Surface flingerservice(์„œํ”ผ์Šค ํ”Œ๋ง๊ฑฐ ์—ฐ๊ฒฐ jb)fefe7270
ย 
NDC14 - Rx์™€ Functional Reactive Programming์œผ๋กœ ๊ณ ์„ฑ๋Šฅ ์„œ๋ฒ„ ๋งŒ๋“ค๊ธฐ
NDC14 - Rx์™€ Functional Reactive Programming์œผ๋กœ ๊ณ ์„ฑ๋Šฅ ์„œ๋ฒ„ ๋งŒ๋“ค๊ธฐNDC14 - Rx์™€ Functional Reactive Programming์œผ๋กœ ๊ณ ์„ฑ๋Šฅ ์„œ๋ฒ„ ๋งŒ๋“ค๊ธฐ
NDC14 - Rx์™€ Functional Reactive Programming์œผ๋กœ ๊ณ ์„ฑ๋Šฅ ์„œ๋ฒ„ ๋งŒ๋“ค๊ธฐ
Jong Wook Kim
ย 
Startup JavaScript 8 - NPM, Express.JS
Startup JavaScript 8 - NPM, Express.JSStartup JavaScript 8 - NPM, Express.JS
Startup JavaScript 8 - NPM, Express.JS
Circulus
ย 
GCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (6) - CGCII Server Sample
GCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (6) - CGCII Server SampleGCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (6) - CGCII Server Sample
GCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (6) - CGCII Server Sample
์ƒํ˜„ ์กฐ
ย 
Blockchain 2nd ethereum_core
Blockchain 2nd ethereum_coreBlockchain 2nd ethereum_core
Blockchain 2nd ethereum_core
ihpark92
ย 
Surface flingerservice(์„œํ”ผ์Šค ํ”Œ๋ง๊ฑฐ ์—ฐ๊ฒฐ ics)
Surface flingerservice(์„œํ”ผ์Šค ํ”Œ๋ง๊ฑฐ ์—ฐ๊ฒฐ ics)Surface flingerservice(์„œํ”ผ์Šค ํ”Œ๋ง๊ฑฐ ์—ฐ๊ฒฐ ics)
Surface flingerservice(์„œํ”ผ์Šค ํ”Œ๋ง๊ฑฐ ์—ฐ๊ฒฐ ics)fefe7270
ย 
Surface flingerservice(์„œํ”ผ์Šคํ”Œ๋ง๊ฑฐ์„œ๋น„์Šค์ดˆ๊ธฐํ™” ics)
Surface flingerservice(์„œํ”ผ์Šคํ”Œ๋ง๊ฑฐ์„œ๋น„์Šค์ดˆ๊ธฐํ™” ics)Surface flingerservice(์„œํ”ผ์Šคํ”Œ๋ง๊ฑฐ์„œ๋น„์Šค์ดˆ๊ธฐํ™” ics)
Surface flingerservice(์„œํ”ผ์Šคํ”Œ๋ง๊ฑฐ์„œ๋น„์Šค์ดˆ๊ธฐํ™” ics)fefe7270
ย 

What's hot (20)

[ํ•˜์ฝ”์‚ฌ์„ธ๋ฏธ๋‚˜]๋ฏธ๋ฆฌ๋ณด๋Š” ๋Œ€๊ทœ๋ชจ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ๊ฐœ๋ฐœ
[ํ•˜์ฝ”์‚ฌ์„ธ๋ฏธ๋‚˜]๋ฏธ๋ฆฌ๋ณด๋Š” ๋Œ€๊ทœ๋ชจ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ๊ฐœ๋ฐœ[ํ•˜์ฝ”์‚ฌ์„ธ๋ฏธ๋‚˜]๋ฏธ๋ฆฌ๋ณด๋Š” ๋Œ€๊ทœ๋ชจ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ๊ฐœ๋ฐœ
[ํ•˜์ฝ”์‚ฌ์„ธ๋ฏธ๋‚˜]๋ฏธ๋ฆฌ๋ณด๋Š” ๋Œ€๊ทœ๋ชจ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ๊ฐœ๋ฐœ
ย 
Blockchain 4th dapp programming
Blockchain 4th dapp programmingBlockchain 4th dapp programming
Blockchain 4th dapp programming
ย 
GCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (4) - Executing System
GCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (4) - Executing SystemGCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (4) - Executing System
GCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (4) - Executing System
ย 
Blockchain 3rd smart contract programming
Blockchain 3rd smart contract programmingBlockchain 3rd smart contract programming
Blockchain 3rd smart contract programming
ย 
Surface flingerservice(์„œํ”ผ์Šค ์ถœ๋ ฅ ์š”์ฒญ jb)
Surface flingerservice(์„œํ”ผ์Šค ์ถœ๋ ฅ ์š”์ฒญ jb)Surface flingerservice(์„œํ”ผ์Šค ์ถœ๋ ฅ ์š”์ฒญ jb)
Surface flingerservice(์„œํ”ผ์Šค ์ถœ๋ ฅ ์š”์ฒญ jb)
ย 
GCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (5) - Executor with Exception
GCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (5) - Executor with ExceptionGCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (5) - Executor with Exception
GCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (5) - Executor with Exception
ย 
GCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (8) - Group System
GCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (8) - Group SystemGCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (8) - Group System
GCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (8) - Group System
ย 
GCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (3) - Exception
GCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (3) - ExceptionGCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (3) - Exception
GCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (3) - Exception
ย 
Blockchain 1st bitcoin_core
Blockchain 1st bitcoin_coreBlockchain 1st bitcoin_core
Blockchain 1st bitcoin_core
ย 
ES6-02
ES6-02ES6-02
ES6-02
ย 
๋งŒ๋“ค๋ฉด์„œ๋ฐฐ์šฐ๋Š”Cocos2d-x(12-13)
๋งŒ๋“ค๋ฉด์„œ๋ฐฐ์šฐ๋Š”Cocos2d-x(12-13)๋งŒ๋“ค๋ฉด์„œ๋ฐฐ์šฐ๋Š”Cocos2d-x(12-13)
๋งŒ๋“ค๋ฉด์„œ๋ฐฐ์šฐ๋Š”Cocos2d-x(12-13)
ย 
Realm์€ ์–ด๋–ป๊ฒŒ ํšจ์œจ์ ์ธ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ ๋งŒ๋“ค์—ˆ๋‚˜?
Realm์€ ์–ด๋–ป๊ฒŒ ํšจ์œจ์ ์ธ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ ๋งŒ๋“ค์—ˆ๋‚˜?Realm์€ ์–ด๋–ป๊ฒŒ ํšจ์œจ์ ์ธ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ ๋งŒ๋“ค์—ˆ๋‚˜?
Realm์€ ์–ด๋–ป๊ฒŒ ํšจ์œจ์ ์ธ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ ๋งŒ๋“ค์—ˆ๋‚˜?
ย 
Surface flingerservice(์„œํ”ผ์Šค ํ”Œ๋ง๊ฑฐ ์—ฐ๊ฒฐ jb)
Surface flingerservice(์„œํ”ผ์Šค ํ”Œ๋ง๊ฑฐ ์—ฐ๊ฒฐ jb)Surface flingerservice(์„œํ”ผ์Šค ํ”Œ๋ง๊ฑฐ ์—ฐ๊ฒฐ jb)
Surface flingerservice(์„œํ”ผ์Šค ํ”Œ๋ง๊ฑฐ ์—ฐ๊ฒฐ jb)
ย 
NDC14 - Rx์™€ Functional Reactive Programming์œผ๋กœ ๊ณ ์„ฑ๋Šฅ ์„œ๋ฒ„ ๋งŒ๋“ค๊ธฐ
NDC14 - Rx์™€ Functional Reactive Programming์œผ๋กœ ๊ณ ์„ฑ๋Šฅ ์„œ๋ฒ„ ๋งŒ๋“ค๊ธฐNDC14 - Rx์™€ Functional Reactive Programming์œผ๋กœ ๊ณ ์„ฑ๋Šฅ ์„œ๋ฒ„ ๋งŒ๋“ค๊ธฐ
NDC14 - Rx์™€ Functional Reactive Programming์œผ๋กœ ๊ณ ์„ฑ๋Šฅ ์„œ๋ฒ„ ๋งŒ๋“ค๊ธฐ
ย 
Startup JavaScript 8 - NPM, Express.JS
Startup JavaScript 8 - NPM, Express.JSStartup JavaScript 8 - NPM, Express.JS
Startup JavaScript 8 - NPM, Express.JS
ย 
Multithread design pattern
Multithread design patternMultithread design pattern
Multithread design pattern
ย 
GCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (6) - CGCII Server Sample
GCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (6) - CGCII Server SampleGCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (6) - CGCII Server Sample
GCGC- CGCII ์„œ๋ฒ„ ์—”์ง„์— ์ ์šฉ๋œ ๊ธฐ์ˆ  (6) - CGCII Server Sample
ย 
Blockchain 2nd ethereum_core
Blockchain 2nd ethereum_coreBlockchain 2nd ethereum_core
Blockchain 2nd ethereum_core
ย 
Surface flingerservice(์„œํ”ผ์Šค ํ”Œ๋ง๊ฑฐ ์—ฐ๊ฒฐ ics)
Surface flingerservice(์„œํ”ผ์Šค ํ”Œ๋ง๊ฑฐ ์—ฐ๊ฒฐ ics)Surface flingerservice(์„œํ”ผ์Šค ํ”Œ๋ง๊ฑฐ ์—ฐ๊ฒฐ ics)
Surface flingerservice(์„œํ”ผ์Šค ํ”Œ๋ง๊ฑฐ ์—ฐ๊ฒฐ ics)
ย 
Surface flingerservice(์„œํ”ผ์Šคํ”Œ๋ง๊ฑฐ์„œ๋น„์Šค์ดˆ๊ธฐํ™” ics)
Surface flingerservice(์„œํ”ผ์Šคํ”Œ๋ง๊ฑฐ์„œ๋น„์Šค์ดˆ๊ธฐํ™” ics)Surface flingerservice(์„œํ”ผ์Šคํ”Œ๋ง๊ฑฐ์„œ๋น„์Šค์ดˆ๊ธฐํ™” ics)
Surface flingerservice(์„œํ”ผ์Šคํ”Œ๋ง๊ฑฐ์„œ๋น„์Šค์ดˆ๊ธฐํ™” ics)
ย 

Similar to HolubOnPatterns/chapter3_1

NDC 2017 ํ•˜์žฌ์Šน NEXON ZERO (๋„ฅ์Šจ ์ œ๋กœ) ์ ๊ฒ€์—†์ด ์‹ค์‹œ๊ฐ„์œผ๋กœ ์ฝ”๋“œ ์ˆ˜์ • ๋ฐ ๊ฒŒ์ž„ ์ •๋ณด ์ˆ˜์ง‘ํ•˜๊ธฐ
NDC 2017 ํ•˜์žฌ์Šน NEXON ZERO (๋„ฅ์Šจ ์ œ๋กœ) ์ ๊ฒ€์—†์ด ์‹ค์‹œ๊ฐ„์œผ๋กœ ์ฝ”๋“œ ์ˆ˜์ • ๋ฐ ๊ฒŒ์ž„ ์ •๋ณด ์ˆ˜์ง‘ํ•˜๊ธฐNDC 2017 ํ•˜์žฌ์Šน NEXON ZERO (๋„ฅ์Šจ ์ œ๋กœ) ์ ๊ฒ€์—†์ด ์‹ค์‹œ๊ฐ„์œผ๋กœ ์ฝ”๋“œ ์ˆ˜์ • ๋ฐ ๊ฒŒ์ž„ ์ •๋ณด ์ˆ˜์ง‘ํ•˜๊ธฐ
NDC 2017 ํ•˜์žฌ์Šน NEXON ZERO (๋„ฅ์Šจ ์ œ๋กœ) ์ ๊ฒ€์—†์ด ์‹ค์‹œ๊ฐ„์œผ๋กœ ์ฝ”๋“œ ์ˆ˜์ • ๋ฐ ๊ฒŒ์ž„ ์ •๋ณด ์ˆ˜์ง‘ํ•˜๊ธฐ
Jaeseung Ha
ย 
[์•ผ์ƒ์˜ ๋•…: ๋“€๋ž‘๊ณ ]์˜ ์‹๋ฌผ ์ƒํƒœ๊ณ„๋ฅผ ๋‹ด๋‹นํ•˜๋Š” 21์„ธ๊ธฐ ์ •์›์‚ฌ์˜ OpenCL ๊ฒฝํ—˜๋‹ด
[์•ผ์ƒ์˜ ๋•…: ๋“€๋ž‘๊ณ ]์˜ ์‹๋ฌผ ์ƒํƒœ๊ณ„๋ฅผ ๋‹ด๋‹นํ•˜๋Š” 21์„ธ๊ธฐ ์ •์›์‚ฌ์˜ OpenCL ๊ฒฝํ—˜๋‹ด[์•ผ์ƒ์˜ ๋•…: ๋“€๋ž‘๊ณ ]์˜ ์‹๋ฌผ ์ƒํƒœ๊ณ„๋ฅผ ๋‹ด๋‹นํ•˜๋Š” 21์„ธ๊ธฐ ์ •์›์‚ฌ์˜ OpenCL ๊ฒฝํ—˜๋‹ด
[์•ผ์ƒ์˜ ๋•…: ๋“€๋ž‘๊ณ ]์˜ ์‹๋ฌผ ์ƒํƒœ๊ณ„๋ฅผ ๋‹ด๋‹นํ•˜๋Š” 21์„ธ๊ธฐ ์ •์›์‚ฌ์˜ OpenCL ๊ฒฝํ—˜๋‹ด
Sumin Byeon
ย 
Api design for c++ ch3 pattern
Api design for c++ ch3 patternApi design for c++ ch3 pattern
Api design for c++ ch3 patternjinho park
ย 
Api design for c++ pattern
Api design for c++ patternApi design for c++ pattern
Api design for c++ pattern
jinho park
ย 
Effective c++ chapter1 2_dcshin
Effective c++ chapter1 2_dcshinEffective c++ chapter1 2_dcshin
Effective c++ chapter1 2_dcshin
Dong Chan Shin
ย 
Nodejs_chapter3
Nodejs_chapter3Nodejs_chapter3
Nodejs_chapter3
Yoon Hee Hwang
ย 
7๊ฐ€์ง€ ๋™์‹œ์„ฑ ๋ชจ๋ธ - ๋ฐ์ดํ„ฐ ๋ณ‘๋ ฌ์„ฑ
7๊ฐ€์ง€ ๋™์‹œ์„ฑ ๋ชจ๋ธ - ๋ฐ์ดํ„ฐ ๋ณ‘๋ ฌ์„ฑ7๊ฐ€์ง€ ๋™์‹œ์„ฑ ๋ชจ๋ธ - ๋ฐ์ดํ„ฐ ๋ณ‘๋ ฌ์„ฑ
7๊ฐ€์ง€ ๋™์‹œ์„ฑ ๋ชจ๋ธ - ๋ฐ์ดํ„ฐ ๋ณ‘๋ ฌ์„ฑ
HyeonSeok Choi
ย 

Similar to HolubOnPatterns/chapter3_1 (8)

NDC 2017 ํ•˜์žฌ์Šน NEXON ZERO (๋„ฅ์Šจ ์ œ๋กœ) ์ ๊ฒ€์—†์ด ์‹ค์‹œ๊ฐ„์œผ๋กœ ์ฝ”๋“œ ์ˆ˜์ • ๋ฐ ๊ฒŒ์ž„ ์ •๋ณด ์ˆ˜์ง‘ํ•˜๊ธฐ
NDC 2017 ํ•˜์žฌ์Šน NEXON ZERO (๋„ฅ์Šจ ์ œ๋กœ) ์ ๊ฒ€์—†์ด ์‹ค์‹œ๊ฐ„์œผ๋กœ ์ฝ”๋“œ ์ˆ˜์ • ๋ฐ ๊ฒŒ์ž„ ์ •๋ณด ์ˆ˜์ง‘ํ•˜๊ธฐNDC 2017 ํ•˜์žฌ์Šน NEXON ZERO (๋„ฅ์Šจ ์ œ๋กœ) ์ ๊ฒ€์—†์ด ์‹ค์‹œ๊ฐ„์œผ๋กœ ์ฝ”๋“œ ์ˆ˜์ • ๋ฐ ๊ฒŒ์ž„ ์ •๋ณด ์ˆ˜์ง‘ํ•˜๊ธฐ
NDC 2017 ํ•˜์žฌ์Šน NEXON ZERO (๋„ฅ์Šจ ์ œ๋กœ) ์ ๊ฒ€์—†์ด ์‹ค์‹œ๊ฐ„์œผ๋กœ ์ฝ”๋“œ ์ˆ˜์ • ๋ฐ ๊ฒŒ์ž„ ์ •๋ณด ์ˆ˜์ง‘ํ•˜๊ธฐ
ย 
Effective c++(chapter 5,6)
Effective c++(chapter 5,6)Effective c++(chapter 5,6)
Effective c++(chapter 5,6)
ย 
[์•ผ์ƒ์˜ ๋•…: ๋“€๋ž‘๊ณ ]์˜ ์‹๋ฌผ ์ƒํƒœ๊ณ„๋ฅผ ๋‹ด๋‹นํ•˜๋Š” 21์„ธ๊ธฐ ์ •์›์‚ฌ์˜ OpenCL ๊ฒฝํ—˜๋‹ด
[์•ผ์ƒ์˜ ๋•…: ๋“€๋ž‘๊ณ ]์˜ ์‹๋ฌผ ์ƒํƒœ๊ณ„๋ฅผ ๋‹ด๋‹นํ•˜๋Š” 21์„ธ๊ธฐ ์ •์›์‚ฌ์˜ OpenCL ๊ฒฝํ—˜๋‹ด[์•ผ์ƒ์˜ ๋•…: ๋“€๋ž‘๊ณ ]์˜ ์‹๋ฌผ ์ƒํƒœ๊ณ„๋ฅผ ๋‹ด๋‹นํ•˜๋Š” 21์„ธ๊ธฐ ์ •์›์‚ฌ์˜ OpenCL ๊ฒฝํ—˜๋‹ด
[์•ผ์ƒ์˜ ๋•…: ๋“€๋ž‘๊ณ ]์˜ ์‹๋ฌผ ์ƒํƒœ๊ณ„๋ฅผ ๋‹ด๋‹นํ•˜๋Š” 21์„ธ๊ธฐ ์ •์›์‚ฌ์˜ OpenCL ๊ฒฝํ—˜๋‹ด
ย 
Api design for c++ ch3 pattern
Api design for c++ ch3 patternApi design for c++ ch3 pattern
Api design for c++ ch3 pattern
ย 
Api design for c++ pattern
Api design for c++ patternApi design for c++ pattern
Api design for c++ pattern
ย 
Effective c++ chapter1 2_dcshin
Effective c++ chapter1 2_dcshinEffective c++ chapter1 2_dcshin
Effective c++ chapter1 2_dcshin
ย 
Nodejs_chapter3
Nodejs_chapter3Nodejs_chapter3
Nodejs_chapter3
ย 
7๊ฐ€์ง€ ๋™์‹œ์„ฑ ๋ชจ๋ธ - ๋ฐ์ดํ„ฐ ๋ณ‘๋ ฌ์„ฑ
7๊ฐ€์ง€ ๋™์‹œ์„ฑ ๋ชจ๋ธ - ๋ฐ์ดํ„ฐ ๋ณ‘๋ ฌ์„ฑ7๊ฐ€์ง€ ๋™์‹œ์„ฑ ๋ชจ๋ธ - ๋ฐ์ดํ„ฐ ๋ณ‘๋ ฌ์„ฑ
7๊ฐ€์ง€ ๋™์‹œ์„ฑ ๋ชจ๋ธ - ๋ฐ์ดํ„ฐ ๋ณ‘๋ ฌ์„ฑ
ย 

HolubOnPatterns/chapter3_1

  • 1. Holub on PatternsChapter 3.1 โ€“ Game of Life ์•„๊ฟˆ์‚ฌhttp://andstudy.com ์•ˆ๋ช…ํ™˜http://eritaka.net
  • 2. John Conwayโ€™s Game of Life ์˜ค์ง 2 ๊ฐ€์ง€ ๋ฒ•์น™ ์ฃฝ์–ด ์žˆ๋Š” ์…€์€ 3๊ฐœ์˜ ์ด์›ƒ์ด ์žˆ์œผ๋ฉด ์‚ด์•„๋‚œ๋‹ค ๋‘ ๊ฐœ ํ˜น์€ ์„ธ ๊ฐœ์˜ ์ด์›ƒ๋งŒ์„ ๊ฐ€์ ธ์•ผ๋งŒ ์‚ฐ๋‹ค
  • 3. ํŠน์ง• โ€“ Game of Life Emergence ํ•˜์œ„ ์ˆ˜์ค€์—๋Š” ์—†๋Š” ํŠน์„ฑ์ด ์ƒ์œ„ ์ˆ˜์ค€์—์„œ ์ž๋ฐœ์ ์œผ๋กœ ์ถœํ˜„ํ•˜๋Š” ํ˜„์ƒ ๋ฏธ์‹œ ๋™๊ธฐ์˜ ๊ฒฐํ•ฉ์œผ๋กœ ์ธํ•œ ๊ฑฐ์‹œ ํ–‰๋™ ํ˜•์„ฑ ๋‹ค์–‘ํ•œ ํŒจํ„ด ๋ฐœ์ƒ
  • 6. Design Pattern Singleton Visitor Observer Composite Facade Mediator Prototype Memento Flyweight
  • 7. class Java Menu SubSyst... JComponent ยซProperty> - name - text + setName(String) : void + getName() : String + setText(String) : void + getText() : String AbstractButton JMenuBar ยซinterface> notifies ActionListener + addActionListener(ActionListener) : void + add(JMenu) : void ยซcall? + actionPerformed(ActionEvent) : void + removeActionListener(ActionListener) : void # fireActionPerformed(ActionEvent) : void Observer 1 Subject Observer JMenuItem Component & Leaf + JMenuItem(String) Concrete Observer Concrete Subject * Composite {submenus} <<anonymous>> 1 Composite + actionPerformed(ActionEvent) : void Concrete Subject JMenu + add(JMenuItem) : void * {menus} Case Study: Menu (Java Swing)
  • 8.
  • 10.
  • 11. Observer: ๋ฉ€ํ‹ฐ์Šค๋ ˆ๋“œ ํ™˜๊ฒฝ 1 ํ•ด๊ฒฐ์ฑ… 1์˜ ๋ฌธ์ œ class Publisher1 { ArrayList subscribers = new ArrayList(); // fireEvent๋ฅผ ๊ธฐ๋‹ค๋ฆฌ๋‹ค๊ฐ€ ๊ธฐ์•„ ํ˜„์ƒ ๋ฐœ์ƒ public synchronized void subscribe(Runnable subscriber) { subscribers.add(subscriber); } public synchronized void cancelSubscribe(Runnable subscriber) { subscribers.remove(subscriber); } private synchronized void fireEvent() { for(inti=0; i < subscribers.size(); ++i) ((Runnable)subscribers.get(i)).run(); // ์‹œ๊ฐ„์ด ๊ฑธ๋ฆฐ๋‹ค! }}
  • 12. Observer: ๋ฉ€ํ‹ฐ์Šค๋ ˆ๋“œ ํ™˜๊ฒฝ 2 ํ•ด๊ฒฐ์ฑ… 2์˜ ๋ฌธ์ œ class Publisher2 { private Collection subscribers = newLinkedList(); // Iterator์—ฐ์‚ฐ ์ค‘ add, remove ํ˜ธ์ถœ ์‹œ ์˜ˆ์™ธ ๋ฐœ์ƒ public synchronized void subscribe(Runnable subscriber) { subscribers.add(subscriber); } public synchronized void cancelSubscribe(Runnable subscriber) { subscribers.remove(subscriber); } private void fireEvent() { for( Iteratori=subscribers.iterator(); i.hasNext(); ) ((Runnable)i.next()).run(); }}
  • 13. Observer: ๋ฉ€ํ‹ฐ์Šค๋ ˆ๋“œ ํ™˜๊ฒฝ 3 ํ•ด๊ฒฐ์ฑ… 3์˜ ๋ฌธ์ œ class Publisher3 { private Collection subscribers = newLinkedList(); public synchronized void subscribe(Runnable subscriber) { subscribers.add(subscriber); } public synchronized void cancelSubscribe(Runnable subscriber) { subscribers.remove(subscriber); } // ํ†ต์ง€ ์ด๋ฒคํŠธ ์‹œ๋งˆ๋‹ค ๋ณต์‚ฌ๋ณธ์ด ์ƒ์„ฑ (๊ตฌ๋…์ทจ์†Œ ์ด๋ฒคํŠธ์™€ ์ƒ๊ด€์—†์ด) private void fireEvent() { Collection localCopy; synchronized( this ) { localCopy = subscribers.clone(); } for( Iteratori=localCopy.iterator(); i.hasNext();) ((Runnable)i.next()).run(); }}
  • 14. Observer: ๋ฉ€ํ‹ฐ์Šค๋ ˆ๋“œ ํ™˜๊ฒฝ 4 ๋ถˆ๋ณ€ ๊ฐ์ฒด ๋…ธ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋ฆฌ์ŠคํŠธ ํ•ด๊ฒฐ๋ฒ• ์ด์ „: ํ—ค๋“œ d:Object c:Object b:Object a:Object ์ดํ›„: ๊ฐ€๋น„์ง€ ์ปฌ๋ ‰์…˜ ๋  ๊ฒƒ์ž„ ์ด์ „ ํ—ค๋“œ d:Object c:Object b:Object a:Object ํ—ค๋“œ
  • 15. class GoF_Visitor Visitor + VisitConcreteElementA(ConcreteElementA) + VisitConcreteElementB(ConcreteElementB) ConcreteVisitor1 ConcreteVisitor2 + VisitConcreteElementA(ConcreteElementA) + VisitConcreteElementA(ConcreteElementA) + VisitConcreteElementB(ConcreteElementB) + VisitConcreteElementB(ConcreteElementB) Element ObjectStructure 1..* + Accept(Visitor) ConcreteElementA ConcreteElementB + Accept(Visitor) + Accept(Visitor) v->VisitConcreteElementA(this) v->VisitConcreteElementB(this) GoFโ€“ Visitor Pattern ์˜๋„ ๊ธฐ์กด ๊ณ„์ธต ๊ตฌ์กฐ๋ฅผ ์ˆ˜์ •ํ•˜์ง€ ์•Š๊ณ  ์ƒˆ๋กœ์šด ๋ฉ”์†Œ๋“œ๋ฅผ ์ถ”๊ฐ€ํ•˜๊ณ ์ž ํ•  ๋•Œ ์ „๋ฌธ๊ฐ€ ๋„์ž…
  • 16. sd LifeGameVisitor Clock publisher subscribers[i] : :Distributor subscribers[i].subscriber Node tick() publish(:Distributor) *accept(:Distributor) deliverTo(subscribers[i].subscriber) tick() "visit" ๋ฉ”์†Œ๋“œ sd GoF_Visitor aObjectStructure aConcreteElement[i] aConcreteVisitor *accept(Distributor) visit(aConcreteElement[i]) operation() Holub Visitor vsGoF Visitor 1
  • 17. class Visitor_Car ยซinterface? CarElementVisitor + visit(Wheel) : void + visit(Engine) : void + visit(Body) : void ยซinterface? CarElement + accept(CarElementVisitor) : void CarElementPrintVisitor Engine Wheel Body class Visitor_Holub + accept(CarElementVisitor) : void + accept(CarElementVisitor) : void + accept(CarElementVisitor) : void v.visit(this) v.visit(this) v.visit(this) Publisher ยซinterface? Distributor + accept(Distributor) : void forall node in list + deliverTo(Object) : void node.accept(:Distributor); <<anonymous>> Node + deliverTo(Object) : void - subscriber: Object ((Observer)subscriber).notify(); + accept(Distributor) : void distributor.deliverTo(subscriber); Holub Visitor vsGoF Visitor 2
  • 18. Publisher vsAWTEventMulticaster AWTEventMulticaster AWT์˜ ๋ชจ๋“  ๋ฆฌ์Šค๋„ˆ ์ธํ„ฐํŽ˜์ด์Šค ๊ตฌํ˜„ ์ด๋ฒคํŠธ ํƒ€์ž…์ด ์ถ”๊ฐ€๋  ๋•Œ๋งˆ๋‹ค ํ•ด๋‹น ์ธํ„ฐํŽ˜์ด์Šค์— ๋Œ€ํ•œ ๊ณผ๋„ํ•œ ์ฝ”๋“œ ์ˆ˜์ • Publisher ์ž„์˜์˜ ์ด๋ฒคํŠธ๋ฅผ ์ž„์˜์˜ ๊ตฌ๋… ๊ฐ์ฒด์— ์ถœํŒ ์ด๋ฒคํŠธ ํƒ€์ž… ์ถ”๊ฐ€ ์‹œ ์ฝ”๋“œ ์ฆ๊ฐ€๋Ÿ‰์ด ์ž‘์Œ
  • 19. class GoF_Composite Component 1..* + Operation() Client + Add() : Component + Remove() : Component + GetChild() : Component Leaf Composite + Operation() + Operation() -children forall g in children g.Operation(); + Add() : Component + Remove() : Component + GetChild() : Component GoF โ€“ Composite Pattern ์˜๋„ ๊ฐœ๋ณ„ ๊ฐ์ฒด์™€ ๋ณตํ•ฉ ๊ฐ์ฒด๋ฅผ ๋™์ผํ•˜๊ฒŒ ๋‹ค๋ฃจ๊ณ  ์‹ถ์„ ๊ฒฝ์šฐ
  • 20. class AWT_ComponentContainer public void doLayout() { Component for( every Component in contents ) doLayout(); + doLayout() : void } 0..* 1 Component Container + doLayout() : void Button Leaf + add(Component) : Component Composite Checkbox Leaf Composite Composite Window Composite Leaf Choice Frame Composite Dialog Case Study: AWT Component/Container
  • 21. ํŒจํ„ด์€ ๋ณ€ํ˜•๋˜์–ด ์‹ค์ฒดํ™”๋œ๋‹ค Composite ํŒจํ„ด์˜ ์˜๋„๋ฅผ ๋ณด๋ผ class Directory System Leaf and Component SimpleFile Composite + open() + close() Composite + print() Directory public void print() 0..* { {contents} + print() for(int i=0; i < contents.length; ++i) + add(SimpleFile) contents[i].print(); 1 + remove(SimpleFile) } + contents() : Iterator Case Study: Directory System
  • 22. VS