Framework engineering JCO 2011
Upcoming SlideShare
Loading in...5
×
 

Framework engineering JCO 2011

on

  • 3,046 views

JCO 2011 발표 자료용

JCO 2011 발표 자료용
- DSM 관련 내용 업데이트
- Code Metrics 관련 내용 업데이트

Statistics

Views

Total Views
3,046
Views on SlideShare
2,031
Embed Views
1,015

Actions

Likes
0
Downloads
51
Comments
2

6 Embeds 1,015

http://arload.wordpress.com 961
http://www.hanrss.com 26
url_unknown 14
https://arload.wordpress.com 10
http://moin.neocoin.net 3
http://www.heej.net 1

Accessibility

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • 별 말씀을요 :)
    Are you sure you want to
    Your message goes here
    Processing…
  • 좋은 자료를 다운로드하게끔 허용을 해주셔서 감사합니다.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Framework engineering JCO 2011 Framework engineering JCO 2011 Presentation Transcript

  • Framework EngineeringArchitecting, Designing, and Developing Reusable Libraries
    http://www.arload.net
  • 손영수 arload@live.com동완이 아빠, 인옥이 남편!!EVA팀 리더PLoP패턴 저자AsianPLoP공동의장Blog http://www.arload.net
  • Framework is ..
    View slide
  • Framework is…
    View slide
  • Douglas C. Schmidt Says..
    Frameworks define “semi-complete” application
    that embody domain-specific object structures and functionality.
  • 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
  • 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
  • Why Do You Need Framework?
    Productivity
    Avoid Duplication
  • Why Do You Need Framework?
    De Facto War
  • Welcome to
    My Framework
    Journey!
  • Seed References
    “Framework Engineering”, TechED 2007 Europe
    “Framework Design Guidelines” , Addison Wesley
    Krzysztof Cwalina
    Program Manager on .NET Framework Team
  • 5 Topics..
    D
    O
    P
    A
    V
  • OrganizationThe most powerful design tool
    O
  • Project Management Triangle
    Scope
    Time
    Cost
    O
  • Organization
    Project Management Triangle + 1
    O
  • Do understand how organizational structure, culture, and decision making processes impact your product.
    O
  • Conway's law
    If you have 4 groups working on a compiler,
    you’ll get a 4-pass compiler.
    O
  • Conway's law
    O
  • Conway's Clean State Approach
    O
  • Your Company Culture Is ..
    Voluntary ??
    O
  • Your Company Culture Is ..
    Familial ??
    O
  • Remember Your Company Culture ..
    O
    Peremptory
  • Organizational InfluencesSize of Organization
    Simple Design
    Consistency Design
    Focus on 80/20 Rules
    Small Team
    O
  • Organizational InfluencesSize of Organization
    Powerful Design
    Lack Consistency
    Remove Requirements
    Large Team
    O
  • Organizational InfluencesOrganization’s Culture/Biases
    Customer-Focused
    End-2-End Scenarios
    O
  • Organizational InfluencesOrganization’s Culture/Biases
    Technology-Focused
    Long Lasting Architecture
    O
  • Decision Making Process is..
    呼兄呼弟
    O
  • Solution ??
    Give this book your boss..
  • Planning Ensuring we are building the right thing
    P
  • P
  • P
  • 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
  • Moderation (中庸)MileStone = Scenarios + Feature
    Vision statement
    RTM
    Feature complete
    Release
    Testing
    Planning
    M1
    M2
    Technology Preview
    Beta 1
    Beta 2
    RC1
    P
  • ArchitectureEnsuring the long term health of the framework
    A
  • Right Way??Choose right types.
    A
  • Taxonomy of TypesLibraries , Primitives, Abstractions
    A
  • 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
  • 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
  • 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
  • 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
  • Extension Method for primitive.. C# 3.0 New Feature
    namespace MyCompany.StringManipulation {
    public static class StringExtensions{
    public static bool IsNullOrEmpty(this string s){ return String.IsNullOrEmpty(s);
    }
    }
    }

    using MyCompany.StringManipulation;
    string message= “hello world”;
    if(message.IsNullOrEmpty()){
    Console.WriteLine(“EMPTY”);
    }
  • 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
  • Do Manage Dependencies..
    A
    A
  • Component is ..
    Lego, Plug ??
    A
  • Component is ..
    .. a set of types that ship and evolve as a unit.
    A
  • Types of Dependencies
    A
  • 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
  • Implemenatin Dependency
    If a type in A uses a type in B in its implementation.
    Hard Dependencies (required to run)
    Soft Dependencies (optional)
    A
  • Circular Dependency
    Component A depends on component B and
    Component B depends on component A (even indirectly).
    A
  • Solution is Layering..
    A
  • Solution is Layering..
    A
  • WPF
    XML



    BCL
    Reflection
    A
    Dependency Management
  • 상황을 파악하는 좋은 방법DSM (Dependency Structure Matrix)
  • 간단한 DSM
  • 잘 계층화된 DSM
  • 엄격한 계층화를 유지한 시스템의 DSM
  • 불완전한 계층구조를 가진 시스템
    Circular Dependency 발생.
  • 또 하나의 도구– Code Metrics
  • xDepend(Ndepend, Xdepend, CDepend)
    NDepend - http://www.xdepend.com
  • Solution is..
    Create a new package.
    A
  • circular dependency
    GUI
    Comm
    Analysis
    Protocol
    Modem Control
    Comm Error
    Database
    Message
    Manager
    A
  • Indirect circular dependency
    A
    X
    B
    Y
    A
  • Use Interface.
    A
    X
    Y
    <<interface>>
    BY
    B
    A
  • Heavy Depedency..
    A
  • Solution is IoC
    A
  • 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
  • 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
  • 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
  • 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
  • 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
  • Do balance advances with compatibility.
    A
  • Types of “Compatibility”
    Backward
    Cross-Version
    Forward
    A
  • Cross-Redist.
    A
  • A
  • 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
  • Avoid duplication and overlap.
    A
  • 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
  • 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
  • DesignThis is where quality happens
    D
  • Is using your framework correctly like…
    Running across a desert?
    D
  • You need Feedback.
    D
  • Do design APIs by
    first writing code samples for the main scenarios
    and then
    defining the object model to support the code samples.
    D
  • Code Samples
    D
  • Read File
    static void Main(string[] args)
    {
    StreamReadersr = File.OpenText("MyFile.txt");
    string s = sr.ReadLine();
    while (s != null)
    {
    s = sr.ReadLine();
    Console.WriteLine(s);
    }
    }
    D
  • Feedback (Read File)
    static void Main(string[] args)
    {
    foreach (string s in File.ReadAllLines("MyFiles.text"))
    {
    Console.WriteLine(s);
    }
    }
    D
  • Object Model Listing
    D
  • Framework Design Studio Assembly Exploer
    Project -> Add -> Assembly
    D
    Download here - http://code.msdn.microsoft.com/fds
  • Framework Design Studio Assembly Review Comment
    D
  • Framework Design StudioCompare API Versions
    D
  • Framework Design StudioCompare API Versions
    Red is removed,
    Green is added,
    Grey means inherited.
    D
  • Framework Design StudioExporting to Microsoft Word
    Tools -> Export to Document
    D
  • Do treat simplicity as a feature.
    D
  • KISS (Keep It Simple! Stupid!)
    Remove Requirements (ATAM).
    Reuse Existing Concepts or APIs
    Adjust Abstraction Level
    Consider framework users(experience, knowledge)
    Three Example
    D
  • Domeasure, measure, and measure!
    D
  • 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
  •  The POWER oFSameness
    D
  • Read the manual??
    When you pick up your rental car….
    Push the seat all the way back
    Find an NPR station
    Find the exit
    D
  • Oh, down to lock…
    D
  • How to use a key…
    D
  • Oh, you push the PRESS button…
    D
  • Who actually needs this data?
    D
  • 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
  • Static Analysis Tool
    http://en.wikipedia.org/wiki/List_of_tools_for_static_code_analysis
    D
  • DevelopmentThe bits customers get, … or not
    V
  • Branches and Integrations- Feature Crew
    http://www.codeplex.com/BranchingGuidance/Wiki/View.aspx?title=Feature%20Crews%3a%20How%20Microsoft%20Does%20It
    V
  • Avoid integrating unfinished features.
    V
  • Feature Complete & Quality Gates
    Functional Specification
    Developer Design Specification
    Test Plan
    Threat Model
    API review
    Architectural Review
    Dependency Management
    Static Analysis
    Code Coverage
    Testing (Unit and Integration Tests)
    0 Bugs
    Performance
    V
  • Do pay your debt.
    V
  • Milestone Quality
    Vision statement
    RTM
    Feature complete
    Release
    Testing
    Planning
    M1
    M2
    Technology Preview
    Beta 1
    Beta 2
    RC1
    Milestone Quality
    V
  • 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
  • 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.
  • 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
  • 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)
  • 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
  • 최근 저서 및 곧 나올 저서..
  • 곧 나올 저서..
  • Question?
    이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-동일조건변경허락 2.0
    대한민국 라이센스에 따라 이용하실 수 있습니다.
    This work is licensed under Creative Commons Korea Attribution 2.0 License.