Take control of your SAP testing with UiPath Test Suite
닷넷 개발자를 위한 패턴이야기
1. Pattern Story (for .NET Developers) YoungSu, Son [email_address] Microsoft MVP Devpia Architecture&Design Sysop Devpia .NET Framework 3.0 Sysop Samsung Electronics Home Solution Group
16. GoF 2 nd Principle Favor Object Composition over Class Inheritance Don’t use Inheritance?? Developer Only use Object Composition! A swindler
17. The Two Towers in Object World. Composition & Inheritance are Two Towers in OO World A Great Architect
18. Inheritance and Composition 구분 상속 객체 합성 스타일 White Box Black Box 장점 단순하고 사용하기 편리 . 구조 명확 코드 재활용 약한 결합력 동적 바인딩 가능 캡슐화 유지 단점 부모 클래스에 종속성 발생 유연성 감소 클래스 수 폭발적 증가 캡슐화 파괴 구조가 복잡 사용시 유의해야 함 객체 수 증가 UML 구조
19.
20. Types of Inheritance. Class Interface1 { ISomething() = 0; } Class Impl { ISomething() { .. do(); .. } } Subtyping Subclassing Interface1 +ISomething() Concrete Class1 +ISomething() Concrete Class2 +ISomething() Impl. +ISomething() Impl Inheritance +ISomething() Impl Inheritance +ISomething() A Great Architect Don’t use Subclassing
24. Core Components of S/W Impl. 06/02/09 Devpia A&D EVA You must remember 3 Core Components! Common Part Configurable Part Variable Part Great Architect
25. Core Components of S/W Impl. 06/02/09 Devpia A&D EVA Configurable Part Variable Part Component Configurator Factory Strategy <<LINKS>> <<CREATES>> Common Part (Modularity) Log Security Transaction AOP
26.
27.
28.
29. Template Method Pattern in GoF 06/02/09 Devpia A&D EVA class CQueryTemplate { public void doQuery() { string dbCommand; dbCommand = FormatConnect(); dbCommand = FormantSelect(sql); } ... } void main() { //pQT 라는 인터페이스를 선언한다 CQueryTemplate *pQT; Sql sql = “select * from AA”; if (GetDBProductInfo() = Oracle) pQT = new COracleQT(); else pQT = new CSqlSvrQT(); pQt->doQuery(sql); delete pQt; } CQueryTemplate +doQuery() #FormatConnect() #FormatSelect() COracleQT #FormatConnect() #FormatSelect() CSqlSvrQT #FormatConnect() #FormatSelect() Inversion of Control (Hollywood Principle)
35. Reflection Pattern in POSA1 Component A UserInterface MetaObject A MetaObject B MOP Meta Level Base Level Component B uses uses uses uses modifies modifies provides access to further base-level components further meta-level components retrieves information
40. Pipe & Filter in WCF Services Runtime Layer Messaging Layer Behaviors Channels Instancing Behavior Security Channel TCP Transport Channel UDP Transport Channel Cross-Proc Transport Channel Queue Transport Channel HTTP Transport Channel Full Duplex Channel Reliable Messaging Channel Custom Channel Transaction Behavior CLR Type Integration Behavior Throttling Behavior Metadata Behavior Error Handling Behavior Concurrency Behavior Custom Behavior Security Channel HTTP Transport Channel TCP Transport Channel UDP Transport Channel Reliable Messaging Channel Custom Channel Instancing Behavior Custom Behavior Contract To Type Behavior
41.
42.
43. Factory Pattern in GOF 06/02/09 Devpia A&D EVA void main() { CMessage *pMessage = new CMessage(); if ( GetComponentInfo(“Proto”) = HTTP ) pMessage->Protocol = HTTP; else pMessage->Protocol = FTP; if ( GetComponentInfo(“Log”) = XML ) pMessage->Protocol = XML; else pMessage->Protocol = TEXT; ... pMessage->Send(“Hello”); delete pMessage; } Abstract Factory +CrateProduct() Client Concrete Factory Abstract Product Concrete Product
44. Factory Pattern in GOF 06/02/09 Devpia A&D EVA class CFactory { CMessage* GetInstance() { CMessage *pMessage = new CMessage(); if ( GetComponentInfo(“Proto”) = HTTP ) pMessage->Protocol = HTTP; else pMessage->Protocol = FTP; if ( GetComponentInfo(“Log”) = XML ) pMessage->Protocol = XML; else pMessage->Protocol = TEXT; ... return pMessage; } } Abstract Factory +CrateProduct() Client Concrete Factory Abstract Product Concrete Product Reminds Component Configurator!!
45. 3 Foe Patterns 06/02/09 Devpia A&D EVA Configurable Part Variable Part Common Part (Modularity) Log Security Transaction Component Configurator Factory Strategy <<LINKS>> <<CREATES>>
46. Observer Pattern (Misconception) 06/02/09 Devpia A&D EVA Change Data Misconception!! Or Prejudices ( 편견 !) 1. Observation 2. Notification
53. With Today’s Patterns Configuration File App.config Web.config Client A Client B Overhead!! File I/O Load Get Info Change Config File Notifiy Handler
54. With Today’s Patterns Configuration File App.config Web.config Client A Load Get Info Change Config File Notifiy FileSystemWatcher .NotifyFilter Handler A Smart Developer
55.
56.
57. Chain of Responsibility in GoF 06/02/09 Devpia A&D EVA +successor Client Handler +HandleRequest() Concrete Handler