Five pattern(facade mediator_singleton_monostate_null)

551 views

Published on

Published in: Education, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
551
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
12
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Five pattern(facade mediator_singleton_monostate_null)

  1. 1. FAÇADE<br />아.꿈.사. <br /> LHS87<br />
  2. 2. What is the Façade?<br />n. (건물의) 정면(front), (길에 접해 있는) 앞면;겉보기, 외관, 허울<br />-From Naver Dictionary<br />A facade is an object that provides a simplified interface to a larger body of code, such as a class library<br />-From WIKIPEDIA<br />
  3. 3. Structure<br />
  4. 4. Example<br />
  5. 5. Code<br />
  6. 6. What are the good points?<br />make a software library easier to use and understand, since the<br /> facade has convenient methods for common tasks<br />2. make code that uses the library more readable, for the same reason<br />3.reduce dependencies of outside code on the inner workings<br /> of a library, since most code uses the facade, thus allowing more flexibility<br /> in developing the system<br />4. wrapa poorly-designed collection of APIs with a single well-designed API<br />
  7. 7. Thank you<br />
  8. 8. MEDIATOR<br />아.꿈.사. <br /> LHS87<br />
  9. 9. What is the Mediator?<br />n. 중재인, 조정자, 매개자<br />-From Naver Dictionary<br />Communicationbetween <br />object is encapsulatedwith a mediator object. Objects no longer communicate directly with each other, but instead communicate through the mediator.<br />-From WIKIPEDIA<br />
  10. 10. Terran Mediator<br />가스 내놔<br />일꾼내놔<br />배틀크루져 줘<br />자원 내놔<br />병사가 될 사람을 줘<br />전쟁 나갈 병사를 줘<br />식량좀 줘<br />
  11. 11. Structure<br />
  12. 12. Example<br />
  13. 13. Code<br />
  14. 14. Code<br />
  15. 15. What are the good point?<br />reduces the dependencies between communicating objects<br />thereby lowering the coupling<br />
  16. 16. Thank you<br />
  17. 17. SINGLETON<br />아.꿈.사. <br /> LHS87<br />
  18. 18. What is the Singleton?<br />n. 하나씩 일어나는 일[것], 홀로인 것, 독자(獨子)<br />-From Naver Dictionary<br />In software engineering the singleton pattern is a design pattern that is used to restrict instantiation of <br />a class to one object. This is useful when exactly one object is needed to coordinate actions across the system. The concept is sometimes generalized to systems <br />that operate more efficiently when only one object exists, or that restrict the instantiation to a certain number of objects (say, five).<br />-From WIKIPEDIA<br />
  19. 19. Structure<br />
  20. 20. Code<br />
  21. 21. Combination<br />
  22. 22. Thank you<br />
  23. 23. MONOSTATE<br />아.꿈.사. <br /> LHS87<br />
  24. 24. What is the Monostate?<br />mono- 《연결형》 「단일의; 단분자의;【화학】 1원자를 함유한」의 뜻(opp. poly-)<br />-From Naver Dictionary<br />The monostateenforces the behavior of<br /> a singleton without the structure of the monostate.<br />그녀의 별명들…<br />1.깝탱<br />2.백설기<br />3.탱<br />4.탱구<br />5.꼬꼬마리더태연<br />6.때때<br />7.젤리<br />Symbolic link<br />
  25. 25. Simple Code<br />
  26. 26. What are the good points?<br />1. 투명성, 사용자가 이 객체가 MONOSTATE라는 것을 알 필요가 없다.<br />2. 파생가능성, 어떤 MONOSTATE의 파생 클래스는 같은 MONOSTATE의 일부<br />3.다형성, 파생 클래스에서 같은 정적 변수의 집합에 대해 서로 다른 동작<br />제공 가능<br />
  27. 27. Singleton vsMonostate<br />creating a single state <br />that all of the instances use. <br />limiting an object to <br />a single instance of that object<br />can't be instantiated via <br />normal mechanisms.<br />a different semantic <br />to object instantiation <br />but retains the same syntax.<br />developers always know when<br />they're dealing with a singleton <br />Classes derived singleton classes<br />are not singletons by default<br />all classes derived from a monostate<br /> are monostates.<br />
  28. 28. Thank you<br />
  29. 29. NULL OBJECT<br />아.꿈.사. <br /> LHS87<br />
  30. 30. What is the Null object?<br />provides intelligent do nothing behavior, hiding the details from its collaborators. <br />
  31. 31. Structure<br />
  32. 32. Code<br />
  33. 33.
  34. 34. What are the good points?<br />makes client code simple. Clients can treat real collaborators <br /> and null collaborators uniformly. Clients normally don't know (and shouldn't care) whether they're dealing with a real or a null collaborator.<br />makes the do nothing code in the null object easy to reuse. Multiple <br />clients which all need their collaborators to do nothing will <br />all do nothing the same way. If the do nothing behavior needs to be modified, the code can be changed in one place. Thereafter, all clients will continue to use the same do nothing behavior, which is now the modified do nothing behavior.<br />
  35. 35. Thank you<br />

×