4. Douglas C. Schmidt Says.. Frameworks define “semi-complete” application that embody domain-specific object structures and functionality.
5. Libraries is.. Application Block DATABASE ADTs MATH NETWORKING App Specific Logic OO Design Invocations GRAPHICS GUI Event Loop Singleton Strategy Selections Reactor Adapter State Active Object Design Pattern Class Library Component Architecture
6. But Framework is .. Active Object State NETWORKING GUI Control – Flow (IoC) MATH Reactor Event Loop App Specific Logic Invocations Callbacks ADTs Singleton Adapter DATABASE GRAPHICS Application Framework Component Architecture
7. Why Do You Need Framework? Productivity Avoid Duplication
9. The Experts of Framework SPLASH (구 OOPSLA ) / PLoP의 창시 Gangs of Four 의일원 Martin Fowler의 직/간접적 스승 Framework 개념의 창시자 Designing Reusable Classes Reusing Object-Oriented Design Documenting Frameworks Using Patterns Patterns For Framework Evolution. Ralph Johnson
10. The Experts of Framework 패턴의 중흥기를 이끈 실질적 리더 – PLoP및 PLoPD Editor 패턴으로 구축한 프레임워크 공개 TAO, ACE등 – 다양한 분야 광범위하게 사용. 실제 돌아가는 프레임워크와 패턴을 접목 POSA 2, POSA 4, POSA 5권 저자 http://www.cs.wustl.edu/~schmidt/ Douglas C. Schmidt
11. The Experts of Framework Java Platform의 광범위한 부분을 설계하고 구현한가장 영향력 있는 리더 Sun에서 Google로 Chief Architect로 이직 Java에 가장 영향력 있는 둘중에 한 분. How to Design a good api and Why it Matters http://www.youtube.com/watch?v=aAb7hSCtvGw Joshua Bloch
12. The Experts of Framework .NET Framework의쌍두마차. Visual C++ 부터 현재 .NET까지 총지휘 Brad Abrams는 Google로 2010년 이직 KC는 아직 .NET Framework를 진두 지휘 실 세계의 Framework 설계 기법 공유 Framework Design Guidelines 1st. Framework Design Guidelines 2nd. Brad Abrams, KrysztofCwalina
14. Seed References “Framework Engineering”, TechED 2007 Europe “Framework Design Guidelines” , Addison Wesley Krzysztof Cwalina Program Manager on .NET Framework Team
34. Skyscrapers Peanut Butter Focus: features Results: stability, incremental improvements, not great end-to-end scenarios Focus: scenarios Results: Excitement, breakthroughs, but beware of leaving existing customers behind P
44. Primitives Very little policy (behavior design decisions) Stable design Commonly appear in publicly accessible APIs Almost impossible to evolve/change design; any design changes have huge breaking change impact on other APIs Example: Int32, String A
45. Libraries Definition: Libraries are types that are not passed between components Examples EventLog, Debug. Easy to Evolve Leave old in, add new one Beware of duplication! A
46. Abstractions Definition: Abstractions are interfaces or classes with unsealed members that are passed between components. Examples Stream, IComponent Hard to Evolve Unfortunately, pressure to evolve A
47. Primitive Oriented Design A.K.A. “Handle based design” (functional) Great evolvability, poor usability (sometimes) Low level stable primitives + high level reusable components with limited dependencies other than to the primitives E.g. Type.GetType(object) – works, but not as convenient as Object.GetType A
48. Component Oriented Design Rich APIs with lots of features, thus with lots of dependencies Great usability, poor evolvability Good for higher level components, not for the core of a platform A
53. API Dependency Component A has an API dependency on component B, if a type in B shows in the publicly accessible API surface of a type in A. This includes: Base types and implemented interfaces Generic parameter constraints Return types and parameters of members Applied attributes Nested types A
54. Implemenatin Dependency If a type in A uses a type in B in its implementation. Hard Dependencies (required to run) Soft Dependencies (optional) A
71. Heavy Dependency. // your API public class Tracer { MessageQueue mq = new MessageQueue(…); public void Trace(string message){ mq.Send(message); } } // your customer’s program that is hard to test Tracer tracer = new Tracer(); public void ProcessOrder(Order order){ tracer.Trace(order.Id); … } A
72. Inversion of Control // your better API public abstract class TraceListener { public abstract void Trace(string message); } public class Tracer { TraceListener listener; public Tracer(TraceListener listener){ this.listener = listener; } public void Trace(string message){ listener.Trace(message); } } A
73. Dependency Injection // your customer’s program that is easier to test Tracer tracer = new Tracer(new FileListener()); public void ProcessOrder(Order order){ tracer.Trace(order.Id); … } A
74. Dependency Injection Containers // customer’s program that is even easier to test Tracer tracer = container.Resolve<Tracer>(); public void ProcessOrder(Order order){ tracer.Trace(order.Id); … } Check outDI Containers (a.k.a. IoC Containers):autofac, Castle Windsor, PicoContainer.NET, Spring.NET, StructureMap, Unity, nInject and others. http://www.nInject.org A
75. Packaging Principle Package Cohesion Principle REP (Release Reuse Equivalency) CCP (Common Closure Principle) CRP (Common Reuse Principle) Package Coupling Principle ADP (Acyclic Dependencies Principle) SDP (Stable Dependencies Principle) SAP (Stable Abstraction Principle) A Robert C. Martin, Principle of Package Architecture http://www.objectmentor.com/resources/articles/Principles_and_Patterns.pdf
80. Establishing Compatibility Bar Define what’s a “breaking change” This definition depends on the objective E.g. Enable portable code between Silverlight and .NET Framework E.g. Enable cross-version portability? A
83. Breaking Changes… MS 직원과의 대화 MS에서 새 API 추가와 기존 API 변경에 들이는 시간과 노력을 아시면 절대 그렇게 말하지 못할 것. 중첩된 역할을 가진 API들이 많아지게 됨. 비동기메소드 DownloadAync, InvokeAsync, DownloadTaskAsync 동일한 역할을 하는 API들이 계속 늘어남.. Java의 NewIO와 IO도 동일한 상황. 대형 밴더들은 호환성은 가상화로 대체하자는 추세임.
89. Team Space Show and Tell Problem Space PLoP – Capable, Productive and Satisfied Patterns for Productivity http://hillside.net/plop/plop98/final_submissions/P54.pdf A
90. When to Replace Existing APIs When the new technology is “10x better” Make sure you understand the impact on the ecosystem What would happen if the BCL team added a new String? What’s the migration path for code using the old API? Support Automatic Migration Tool. (VB -> VB.NET, .NET 1.0 -> .NET 2.0) Provide Code Based Migration Manual. COM+ -> WCF , ASP.NET Web Service -> WCF A
105. KISS (Keep It Simple! Stupid!) Remove Requirements Reuse Existing Concepts or APIs. Adjust Abstraction Level Consider framework users(experience, knowledge) Three Example D
107. Specification Document: Qualities Performance Goals (XML Parser..) Baseline: What do is the best my API could do? Measure delta from the baseline Threat Models (Security ..) Threat: What is the worst that my component could do? Mitigate the threats Keep a balance between many other qualities you want your framework to have (ATAM) D
114. Why you don’t read manuals ??? You know how to drive your car All cars work basically the same way Your rental car is a car Therefore, you can drive your rental car That is… The power of sameness D
115. Static Analysis Tool http://en.wikipedia.org/wiki/List_of_tools_for_static_code_analysis D
117. Branches and Integrations- Feature Crew http://www.codeplex.com/BranchingGuidance/Wiki/View.aspx?title=Feature%20Crews%3a%20How%20Microsoft%20Does%20It V
122. Milestone Quality (MQ) Initiatives that are hard to do in regular milestones Large productivity and efficiency improvements Infrastructure changes For example, a new source control system Refactoring of fragile subsystems Internal implementation documentation Bugs backlog V
123. Summary Dounderstand how organizational structure, culture, and decision making processes impact your product. Avoidpeanut-butter in Scenario Based Application. Domanage your dependencies. Dobalance advances with compatibility. Avoidduplication and overlap. Do design APIs by first writing code samples for the main scenarios and then defining the object model to support the code samples. Do treat simplicity as a feature. Domeasure, measure, and measure! Avoidintegrating unfinished features. Do pay your debt.
124. Resources Krzysztof Cwalina, Brad Abrams Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries http://channel9.msdn.com/pdc2008/PC58/ http://www.gotdotnet.com/team/fxcop
125. Resources Douglas C. Schmidt (PLoP Editor, POSA 2, 4 Writter) JAWS: An Application Framework for High Performance Web System http://citeseer.ist.psu.edu/81775.html (En) http://www.devpia.com/net2/EvaCast/Lecture/?cu=view&r=11 (Kr) Ralph Johnson (GoF , Design Patterns) Evolving Frameworks http://st-www.cs.uiuc.edu/users/droberts/evolve.html (En) http://arload.wordpress.com/2008/09/15/evolvingframeworks/ (Kr)
126. Resources Robert C. Martin Principles of Package Architecture (Design Principles and Design Patterns) http://www.objectmentor.com/resources/articles/Principles_and_Patterns.pdf (En) http://www.devpia.com/net2/EvaCast/Lecture/?cu=view&r=108 (Kr) For Korean People.. Load to Architect http://www.arload.net EvaCast (Online Free Lecture) http://www.evacast.net
129. Question? 이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-동일조건변경허락 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다. This work is licensed under Creative Commons Korea Attribution 2.0 License.