SlideShare uma empresa Scribd logo
1 de 26
Baixar para ler offline
How to Design Frameworks




Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   567




        Framework is
            • the design of an application or
              subsystem
            • expressed as
               • a set of abstract classes and
               • the way objects in those classes
                 collaborate.



Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   568




                                                                                    1
Use framework to build application by:
             • Creating new subclasses
             • Configuring objects together
             • Modifying working examples
                 (editing scripts)




Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   569




        Inversion of Control
            Subroutine library
              • User's program calls reused code.
              • User designs structure of program.
            Framework
              • Reused code calls user's program
              • Structure of program determined
                primarily by reused code.

Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   570




                                                                                    2
Parts of Framework Application
            New classes
            Script that specifies classes of
             components by
              • creating components
              • connecting components
              • parameterizing components


Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   571




        Testing Framework
            Classes - Test, TestResult, TestSuite
            Use by subclassing Test
            Define instance methods to set up test, to
              perform tests
            Define class methods to create a test
              suite



Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   572




                                                                                    3
Model/View/Controller
            Classes - Model, View, Controller,
              ApplicationModel, ValueModel, etc.
            Use by using GUI builder to make a
              screen; the GUI builder automatically
              builds an ApplicationModel and a
              window-spec that later gets interpreted
              to build a window.


Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   573




        HotDraw
            Classes - Figure, Drawing, Handle, Tool,
              DrawingEditor
            Subclass DrawingEditor, Figure, rarely
              Drawing
            Parameterize Handle, Tool.
            There is a graphical tool for defining new
              Tools.


Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   574




                                                                                    4
White-box vs. Black-box

                 White-box                                                    Black-box
                 Customize by                                            Customize by
                 subclassing                                              configuring
                 Emphasize                                                 Emphasize
                 inheritance                                            polymorphism
                 Must know                                                    Must know
                 internals                                                     interfaces

Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson                 575




        (continued)

            White-box                                                         Black-box
            Simpler, easier to                                 Complex, harder to
            design                                                        design
            Harder to learn,                                           Easier to learn,
            requires more                                                 requires less
            programming.                                                programming.



Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson                 576




                                                                                                  5
First Rule of Framework Design



                     Don’t.                       Buy one, instead.




Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   577




              Relevant Principles

       Frameworks are abstractions: people
         generalize from concrete examples
       Designing reusable code requires iteration
       Frameworks encode domain knowledge
       Customer of framework is application
         programmer



Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   578




                                                                                    6
Generalize from Concrete Cases

              People think concretely, not abstractly.
              Abstractions are found bottom-up, by
               examining concrete examples.




Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   579




        To Generalize:
            • find things with different names that are
               really the same,
            • parameterize to eliminate differences,
            • break large things into small things so
               that similar components can be found,
               and
            • categorize things that are similar.


Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   580




                                                                                    7
Finding Abstract Classes
      Abstract classes are discovered by
       generalizing from concrete classes.
      To give classes a common superclass:
        • give operations common interface
           • move operations with same
             implementation to superclass
           • make operations with different
             implementation abstract

Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   581




        (continued)
            • give them common interface
               • + rename operations so classes use
                 same names
               • + reorder arguments, change types of
                 arguments, etc.
               • + refactor (split or combine)
                 operations


Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   582




                                                                                    8
Frameworks Require Iteration
           Reusable code requires many iterations.
           Basic law of software engineering
                  If it hasn’t been tested, it doesn’t
               work.
               Corollary: software that hasn’t been
               reused is not reusable.


Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   583




           Frameworks Encode
           Domain Knowledge
           Frameworks solve a particular set of
             problems.
           Not always application-domain specific,
             but domain specific. (GUI,
             distribution, structured drawing editor,
             business transaction processing,
             workflow)


Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   584




                                                                                    9
Customers are Programmers

            Purpose of framework is to make it easier
             to build applications.
            Apply these slogans to application
             programmers:
              • The customer is always right.
              • We are customer-driven.
              • Understand your customer.

Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   585




                        Example-driven Design
                        Generalization
                  Examples        Framework

           Generalization is iterative.
           Most changes are small.
           A few big changes represent new ways of
            looking at the problem.

Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   586




                                                                                    10
System
                 size

                                                                              Time
             To generalize faster:
                   • • get different points of view
                   • • explain/defend current design

Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson            587




        Ideal Way to Develop Framework

                  Analysis                           Design                     Test

         1) Analyze problem domain
              • Learn well-known abstractions.
              • Collect examples of programs to be
                built from framework. (Minimum of 4
                or 5).

Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson            588




                                                                                             11
Ideal Way to Design Framework
            2) Design abstraction that covers
              examples.
            3) Test framework by using it to solve the
              examples.
                 • • Each example is a separate
                   application.
                 • • Performing a test means writing
                   software.

Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   589




            Designing Abstractions

          Design phase: look for commonalities,
           represent each idea once.
          Use design patterns
               • implies that experience is needed
          Insight and ingenuity is always useful, but
            hard to schedule.


Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   590




                                                                                    12
Design Patterns

        Design patterns make designs more black-
         box.
        Show how to represent something that
         changes as an object
          • • Strategy -- algorithm
          • • Prototype -- products
          • • State -- state of an object
          • • Mediator -- way objects interact
Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   591




        Using design patterns
            Each pattern makes design more
             complex.
            Each pattern makes design more flexible.
             Do you need that flexibility?
             Is the complexity worth while?

            Only use a pattern when it results in a
             simpler design than the alternatives.
Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   592




                                                                                    13
Why Ideal is Never Followed

       Analyzing domain requires analyzing
        individual examples, which is already very
        hard.
            • Only practical if examples have already
              been analyzed.
            • Analyzing and implementing examples
              is large fraction of the cost of the
              project.
              • People need the concrete feedback of
                 implementation.
Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   593




       Good Way to Develop Framework

            Pick two similar applications.
            Include developers experienced in the
              same domain.
            One framework group
            Two application groups



Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   594




                                                                                    14
• framework group
                   • Give and take software
                   • Consider other applications
                   • Explain and teach framework
             • 2 application groups
                   • Try to reuse as much software as possible
                   • Complain about how hard software is to
                     use

Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   595




    Typical Way to Develop
    Framework
           Notice that many applications are similar.
           Develop next application in that domain in
            an OO language.
           Divide software into reusable and
            nonreusable parts.
           Develop next application reusing as much
            software as possible.


Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   596




                                                                                    15
• Surprise! Framework is not very
                   reusable.
                 • Fix it.
                 • Develop next application reusing as
                   much software as possible.




Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   597




      Problems with Reuse as a Side-
      effect

              Conflicting goals
                 • get system out on time
                 • make it reusable
              Hard to pay for reusability
              Hard to enforce reusability


Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   598




                                                                                    16
Advantages with Reuse as a Side-
       effect
            Framework developers experience being
              framework users.
            Only add features that are cost-effective.
            Helps prevent frameworks that are too
              complex and too abstract.




Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   599




             Another Strategy
                Design framework - prototype several
                 small applications.
                Build real application.
                Refactor and extend framework and old
                 applications.




Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   600




                                                                                    17
Summary of Process
           Start with examples of desired
              applications
           Iteratively develop abstractions
           Test by building applications




Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   601




             More detail

                  1) Three Examples
                  2) White-box Framework
                  3) Component Library
                  4) Hot Spots
                  5) Puggable Objects




Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   602




                                                                                    18
(continued)

       6) Fine-grained Objects
       7) Black-box Framework
       8) Visual Builder
       9) Language Tools

       http://st-
         www.cs.uiuc.edu/users/droberts/evolve.ht
         ml
Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   603




                       Application Generators
        Black-box frameworks make it easier to:
          • specify application with a picture
          • generate code from a picture

        Visual programming languages let non-
          programmers build applications.



Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   604




                                                                                    19
Disadvantages
           of Black-box Framework
            Black-box framework tends to have
              • more kinds of objects
              • more artificial kinds of objects
              • more complex relationships between
                objects
              • more objects
            Not-quite-ultimate framework forces you to
              debug more complex system.
Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   605




            Patterns and Refactoring
          Refactoring
            -- changing the structure of a program,
              but not its function.
            -- the most common way to fix reusability
              problems.
            -- making a quot;hot spotquot; flexible
            -- often is applying a pattern


Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   606




                                                                                    20
Refactoring to Help Find
      Composites
                       Component                        Composite




                                         Component
                                         Container
                                         Children




                              Leaf                      Composite

Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   607




                 Hints for Framework Design

                 Use object composition instead of
                  inheritance
                 Incrementally apply patterns / lazy
                   generalization
                 Framework should work out of the box




Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   608




                                                                                    21
Strategic Concerns

        Developing a framework is expensive, so
         look before you leap.
          • Framework development requires long
            term commitment.
          • Pick frameworks that will give you
            competitive advantage.



Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   609




        Start small and work up.
            • get experience with OOP
            • select and train good abstractors
            • build small frameworks first
            • generalize existing systems
            • keep user base small at first




Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   610




                                                                                    22
Customers are Crucial
               Get customers involved early, and use
                their feedback.
               Make your initial customers succeed.
               First set of customers are really part of
                 the development team.




Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   611




            Reuse Scenarios


          Ideal: Framework grows along with
            customer base.




         Actual: Projects may customize the initial
          framework, and start competing streams
          of development.
Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   612




                                                                                    23
Dealing with Iteration
               Don’t claim framework is useful until your
                customers say it is.
               Keep customer base small while
                framework is evolving.
               A successful framework must evolve to
                meet new customer needs.
               Don’t constantly tinker. Plan releases and
                coordinate with customers.


Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   613




            Documentation and Training
          Documentation for framework costs several
           times usual
               • how to use
               • how to extend / how it works
          Software must be understandable to be
           usable.
          Improving documentation can make
            software more reusable.

Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   614




                                                                                    24
Documentation and Training
             Base documentation on examples.
             Must debug documentation and training.
             Documenting system shows how to
              change it.
             Framework developers must be
               intimately involved.



Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   615




                                     NIH vs. TILI


             Problem with reuse is NOT fault of
                customer.
             Software is not as reusable as it is
                claimed.
             It is hard to make software reusable.



Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   616




                                                                                    25
Reusable Design is Hard
            • Must be abstract and powerful - theory
              of application domain.
            • Must be customizable - theory of what
              users want to change.
            • Must be easy to understand
               • -- simplicity is crucial
               • -- needs good documentation

Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson   617




                                                                                    26

Mais conteúdo relacionado

Mais procurados

Mais procurados (9)

Uml3
Uml3Uml3
Uml3
 
Software design principles
Software design principlesSoftware design principles
Software design principles
 
Chtp401
Chtp401Chtp401
Chtp401
 
Program development tools
Program development toolsProgram development tools
Program development tools
 
Acher PhD thesis defense
Acher PhD thesis defense Acher PhD thesis defense
Acher PhD thesis defense
 
Pitfalls of software product development
Pitfalls of software product developmentPitfalls of software product development
Pitfalls of software product development
 
Software Engineering of Component-Based Systems-of-Systems: A Reference Frame...
Software Engineering of Component-Based Systems-of-Systems: A Reference Frame...Software Engineering of Component-Based Systems-of-Systems: A Reference Frame...
Software Engineering of Component-Based Systems-of-Systems: A Reference Frame...
 
You need to extend your models? EMF Facet vs. EMF Profiles
You need to extend your models? EMF Facet vs. EMF ProfilesYou need to extend your models? EMF Facet vs. EMF Profiles
You need to extend your models? EMF Facet vs. EMF Profiles
 
Greenstreeet
GreenstreeetGreenstreeet
Greenstreeet
 

Destaque

A Brief Tour of Responsability Driven Design
A Brief Tour of Responsability Driven DesignA Brief Tour of Responsability Driven Design
A Brief Tour of Responsability Driven Designelliando dias
 
Assembling wall panels with robotic technologies
Assembling wall panels with robotic technologiesAssembling wall panels with robotic technologies
Assembling wall panels with robotic technologieselliando dias
 
Programmable Matter with Modular Robots
Programmable Matter with Modular RobotsProgrammable Matter with Modular Robots
Programmable Matter with Modular Robotselliando dias
 
Scaling Rails with memcached
Scaling Rails with memcachedScaling Rails with memcached
Scaling Rails with memcachedelliando dias
 
Scrum in five minutes
Scrum in five minutesScrum in five minutes
Scrum in five minuteselliando dias
 
How To Build A Better Arduino
How To Build A Better ArduinoHow To Build A Better Arduino
How To Build A Better ArduinoAlastairDSilva
 
HTML5: The New html for the web
HTML5: The New html for the webHTML5: The New html for the web
HTML5: The New html for the webelliando dias
 
Model-Driven Software Development
Model-Driven Software DevelopmentModel-Driven Software Development
Model-Driven Software Developmentelliando dias
 
Gerenciamento de Projetos OO
Gerenciamento de Projetos OOGerenciamento de Projetos OO
Gerenciamento de Projetos OOelliando dias
 
Interfaces de Usuário Ubíquas - UUI
Interfaces de Usuário Ubíquas - UUIInterfaces de Usuário Ubíquas - UUI
Interfaces de Usuário Ubíquas - UUIelliando dias
 
hardware de um sistema de computação
hardware de um sistema de computaçãohardware de um sistema de computação
hardware de um sistema de computaçãoelliando dias
 
Enabling White-Box Reuse in a Pure Composition Language
Enabling White-Box Reuse in a Pure Composition LanguageEnabling White-Box Reuse in a Pure Composition Language
Enabling White-Box Reuse in a Pure Composition Languageelliando dias
 
Representação de Números
Representação de NúmerosRepresentação de Números
Representação de Númeroselliando dias
 
Linguagens de Transformação de Modelos
Linguagens de Transformação de ModelosLinguagens de Transformação de Modelos
Linguagens de Transformação de Modeloselliando dias
 
UML-Based Web Engineering
UML-Based Web EngineeringUML-Based Web Engineering
UML-Based Web Engineeringelliando dias
 
Gerenciamento de Projeto para Desenvolvimento de Sistema
Gerenciamento de Projeto para Desenvolvimento de SistemaGerenciamento de Projeto para Desenvolvimento de Sistema
Gerenciamento de Projeto para Desenvolvimento de Sistemaelliando dias
 
Banco De Dados Básico
Banco De Dados BásicoBanco De Dados Básico
Banco De Dados Básicoelliando dias
 

Destaque (20)

A Brief Tour of Responsability Driven Design
A Brief Tour of Responsability Driven DesignA Brief Tour of Responsability Driven Design
A Brief Tour of Responsability Driven Design
 
Assembling wall panels with robotic technologies
Assembling wall panels with robotic technologiesAssembling wall panels with robotic technologies
Assembling wall panels with robotic technologies
 
Programmable Matter with Modular Robots
Programmable Matter with Modular RobotsProgrammable Matter with Modular Robots
Programmable Matter with Modular Robots
 
Scaling Rails with memcached
Scaling Rails with memcachedScaling Rails with memcached
Scaling Rails with memcached
 
Scrum in five minutes
Scrum in five minutesScrum in five minutes
Scrum in five minutes
 
How To Build A Better Arduino
How To Build A Better ArduinoHow To Build A Better Arduino
How To Build A Better Arduino
 
Algoritmo Genetico
Algoritmo GeneticoAlgoritmo Genetico
Algoritmo Genetico
 
HTML5: The New html for the web
HTML5: The New html for the webHTML5: The New html for the web
HTML5: The New html for the web
 
Model-Driven Software Development
Model-Driven Software DevelopmentModel-Driven Software Development
Model-Driven Software Development
 
Acme Total
Acme TotalAcme Total
Acme Total
 
Gerenciamento de Projetos OO
Gerenciamento de Projetos OOGerenciamento de Projetos OO
Gerenciamento de Projetos OO
 
Interfaces de Usuário Ubíquas - UUI
Interfaces de Usuário Ubíquas - UUIInterfaces de Usuário Ubíquas - UUI
Interfaces de Usuário Ubíquas - UUI
 
hardware de um sistema de computação
hardware de um sistema de computaçãohardware de um sistema de computação
hardware de um sistema de computação
 
Enabling White-Box Reuse in a Pure Composition Language
Enabling White-Box Reuse in a Pure Composition LanguageEnabling White-Box Reuse in a Pure Composition Language
Enabling White-Box Reuse in a Pure Composition Language
 
Representação de Números
Representação de NúmerosRepresentação de Números
Representação de Números
 
Linguagens de Transformação de Modelos
Linguagens de Transformação de ModelosLinguagens de Transformação de Modelos
Linguagens de Transformação de Modelos
 
Robótica Móvel
Robótica MóvelRobótica Móvel
Robótica Móvel
 
UML-Based Web Engineering
UML-Based Web EngineeringUML-Based Web Engineering
UML-Based Web Engineering
 
Gerenciamento de Projeto para Desenvolvimento de Sistema
Gerenciamento de Projeto para Desenvolvimento de SistemaGerenciamento de Projeto para Desenvolvimento de Sistema
Gerenciamento de Projeto para Desenvolvimento de Sistema
 
Banco De Dados Básico
Banco De Dados BásicoBanco De Dados Básico
Banco De Dados Básico
 

Semelhante a How to Design Frameworks

Introduction to Extreme Programming
Introduction to Extreme ProgrammingIntroduction to Extreme Programming
Introduction to Extreme ProgrammingNaresh Jain
 
Reverse engineering
Reverse engineeringReverse engineering
Reverse engineeringSaswat Padhi
 
IPC07 Talk - Beautiful Code with AOP and DI
IPC07 Talk - Beautiful Code with AOP and DIIPC07 Talk - Beautiful Code with AOP and DI
IPC07 Talk - Beautiful Code with AOP and DIRobert Lemke
 
プレゼンビフォアアフタ
プレゼンビフォアアフタプレゼンビフォアアフタ
プレゼンビフォアアフタTsuyoshi Ushio
 
Rhapsody reverseengineering
Rhapsody reverseengineeringRhapsody reverseengineering
Rhapsody reverseengineeringScott Althouse
 
Faster deep learning solutions from training to inference - Michele Tameni - ...
Faster deep learning solutions from training to inference - Michele Tameni - ...Faster deep learning solutions from training to inference - Michele Tameni - ...
Faster deep learning solutions from training to inference - Michele Tameni - ...Codemotion
 
Practical OOP In Java
Practical OOP In JavaPractical OOP In Java
Practical OOP In Javawiradikusuma
 
Factory Design Pattern
Factory Design PatternFactory Design Pattern
Factory Design PatternJaswant Singh
 
8. design patterns
8. design patterns8. design patterns
8. design patternsAPU
 
Pragmatic Model Driven Development In Java Using Smart Use Cases
Pragmatic Model Driven Development In Java Using Smart Use CasesPragmatic Model Driven Development In Java Using Smart Use Cases
Pragmatic Model Driven Development In Java Using Smart Use CasesRody Middelkoop
 
Java compilation
Java compilationJava compilation
Java compilationMike Kucera
 
Domino X Pages 8.5
Domino X Pages 8.5Domino X Pages 8.5
Domino X Pages 8.5John Head
 
Native extensions webinar
Native extensions webinarNative extensions webinar
Native extensions webinarimmanuelnoel
 
xTreme Programming by Sejo Ćesić and Enis Zeherović
xTreme Programming by Sejo Ćesić and Enis ZeherovićxTreme Programming by Sejo Ćesić and Enis Zeherović
xTreme Programming by Sejo Ćesić and Enis ZeherovićBosnia Agile
 
Profiling PHP - WordPress Meetup Nijmegen 2015-03-11
Profiling PHP - WordPress Meetup Nijmegen 2015-03-11Profiling PHP - WordPress Meetup Nijmegen 2015-03-11
Profiling PHP - WordPress Meetup Nijmegen 2015-03-11Dennis de Greef
 
Reverse Engineering - Protecting and Breaking the Software
Reverse Engineering - Protecting and Breaking the SoftwareReverse Engineering - Protecting and Breaking the Software
Reverse Engineering - Protecting and Breaking the SoftwareSatria Ady Pradana
 

Semelhante a How to Design Frameworks (20)

Introduction to Extreme Programming
Introduction to Extreme ProgrammingIntroduction to Extreme Programming
Introduction to Extreme Programming
 
Reverse engineering
Reverse engineeringReverse engineering
Reverse engineering
 
IPC07 Talk - Beautiful Code with AOP and DI
IPC07 Talk - Beautiful Code with AOP and DIIPC07 Talk - Beautiful Code with AOP and DI
IPC07 Talk - Beautiful Code with AOP and DI
 
プレゼンビフォアアフタ
プレゼンビフォアアフタプレゼンビフォアアフタ
プレゼンビフォアアフタ
 
Rhapsody reverseengineering
Rhapsody reverseengineeringRhapsody reverseengineering
Rhapsody reverseengineering
 
Faster deep learning solutions from training to inference - Michele Tameni - ...
Faster deep learning solutions from training to inference - Michele Tameni - ...Faster deep learning solutions from training to inference - Michele Tameni - ...
Faster deep learning solutions from training to inference - Michele Tameni - ...
 
Practical OOP In Java
Practical OOP In JavaPractical OOP In Java
Practical OOP In Java
 
Factory Design Pattern
Factory Design PatternFactory Design Pattern
Factory Design Pattern
 
8. design patterns
8. design patterns8. design patterns
8. design patterns
 
Pragmatic Model Driven Development In Java Using Smart Use Cases
Pragmatic Model Driven Development In Java Using Smart Use CasesPragmatic Model Driven Development In Java Using Smart Use Cases
Pragmatic Model Driven Development In Java Using Smart Use Cases
 
Java compilation
Java compilationJava compilation
Java compilation
 
Effective Java
Effective JavaEffective Java
Effective Java
 
Domino X Pages 8.5
Domino X Pages 8.5Domino X Pages 8.5
Domino X Pages 8.5
 
Native extensions webinar
Native extensions webinarNative extensions webinar
Native extensions webinar
 
Oop 1
Oop 1Oop 1
Oop 1
 
xTreme Programming by Sejo Ćesić and Enis Zeherović
xTreme Programming by Sejo Ćesić and Enis ZeherovićxTreme Programming by Sejo Ćesić and Enis Zeherović
xTreme Programming by Sejo Ćesić and Enis Zeherović
 
Profiling PHP - WordPress Meetup Nijmegen 2015-03-11
Profiling PHP - WordPress Meetup Nijmegen 2015-03-11Profiling PHP - WordPress Meetup Nijmegen 2015-03-11
Profiling PHP - WordPress Meetup Nijmegen 2015-03-11
 
Java By Sai NagaVenkata BuchiBabu Manepalli
Java By Sai NagaVenkata BuchiBabu ManepalliJava By Sai NagaVenkata BuchiBabu Manepalli
Java By Sai NagaVenkata BuchiBabu Manepalli
 
Java By Sai NagaVenkata BuchiBabu Manepalli
Java By Sai NagaVenkata BuchiBabu ManepalliJava By Sai NagaVenkata BuchiBabu Manepalli
Java By Sai NagaVenkata BuchiBabu Manepalli
 
Reverse Engineering - Protecting and Breaking the Software
Reverse Engineering - Protecting and Breaking the SoftwareReverse Engineering - Protecting and Breaking the Software
Reverse Engineering - Protecting and Breaking the Software
 

Mais de elliando dias

Clojurescript slides
Clojurescript slidesClojurescript slides
Clojurescript slideselliando dias
 
Why you should be excited about ClojureScript
Why you should be excited about ClojureScriptWhy you should be excited about ClojureScript
Why you should be excited about ClojureScriptelliando dias
 
Functional Programming with Immutable Data Structures
Functional Programming with Immutable Data StructuresFunctional Programming with Immutable Data Structures
Functional Programming with Immutable Data Structureselliando dias
 
Nomenclatura e peças de container
Nomenclatura  e peças de containerNomenclatura  e peças de container
Nomenclatura e peças de containerelliando dias
 
Polyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better AgilityPolyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better Agilityelliando dias
 
Javascript Libraries
Javascript LibrariesJavascript Libraries
Javascript Librarieselliando dias
 
How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!elliando dias
 
A Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the WebA Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the Webelliando dias
 
Introdução ao Arduino
Introdução ao ArduinoIntrodução ao Arduino
Introdução ao Arduinoelliando dias
 
Incanter Data Sorcery
Incanter Data SorceryIncanter Data Sorcery
Incanter Data Sorceryelliando dias
 
Fab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine DesignFab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine Designelliando dias
 
The Digital Revolution: Machines that makes
The Digital Revolution: Machines that makesThe Digital Revolution: Machines that makes
The Digital Revolution: Machines that makeselliando dias
 
Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.elliando dias
 
Hadoop and Hive Development at Facebook
Hadoop and Hive Development at FacebookHadoop and Hive Development at Facebook
Hadoop and Hive Development at Facebookelliando dias
 
Multi-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case StudyMulti-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case Studyelliando dias
 

Mais de elliando dias (20)

Clojurescript slides
Clojurescript slidesClojurescript slides
Clojurescript slides
 
Why you should be excited about ClojureScript
Why you should be excited about ClojureScriptWhy you should be excited about ClojureScript
Why you should be excited about ClojureScript
 
Functional Programming with Immutable Data Structures
Functional Programming with Immutable Data StructuresFunctional Programming with Immutable Data Structures
Functional Programming with Immutable Data Structures
 
Nomenclatura e peças de container
Nomenclatura  e peças de containerNomenclatura  e peças de container
Nomenclatura e peças de container
 
Geometria Projetiva
Geometria ProjetivaGeometria Projetiva
Geometria Projetiva
 
Polyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better AgilityPolyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better Agility
 
Javascript Libraries
Javascript LibrariesJavascript Libraries
Javascript Libraries
 
How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!
 
Ragel talk
Ragel talkRagel talk
Ragel talk
 
A Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the WebA Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the Web
 
Introdução ao Arduino
Introdução ao ArduinoIntrodução ao Arduino
Introdução ao Arduino
 
Minicurso arduino
Minicurso arduinoMinicurso arduino
Minicurso arduino
 
Incanter Data Sorcery
Incanter Data SorceryIncanter Data Sorcery
Incanter Data Sorcery
 
Rango
RangoRango
Rango
 
Fab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine DesignFab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine Design
 
The Digital Revolution: Machines that makes
The Digital Revolution: Machines that makesThe Digital Revolution: Machines that makes
The Digital Revolution: Machines that makes
 
Hadoop + Clojure
Hadoop + ClojureHadoop + Clojure
Hadoop + Clojure
 
Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.
 
Hadoop and Hive Development at Facebook
Hadoop and Hive Development at FacebookHadoop and Hive Development at Facebook
Hadoop and Hive Development at Facebook
 
Multi-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case StudyMulti-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case Study
 

Último

SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 

Último (20)

SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 

How to Design Frameworks

  • 1. How to Design Frameworks Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 567 Framework is • the design of an application or subsystem • expressed as • a set of abstract classes and • the way objects in those classes collaborate. Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 568 1
  • 2. Use framework to build application by: • Creating new subclasses • Configuring objects together • Modifying working examples (editing scripts) Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 569 Inversion of Control Subroutine library • User's program calls reused code. • User designs structure of program. Framework • Reused code calls user's program • Structure of program determined primarily by reused code. Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 570 2
  • 3. Parts of Framework Application New classes Script that specifies classes of components by • creating components • connecting components • parameterizing components Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 571 Testing Framework Classes - Test, TestResult, TestSuite Use by subclassing Test Define instance methods to set up test, to perform tests Define class methods to create a test suite Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 572 3
  • 4. Model/View/Controller Classes - Model, View, Controller, ApplicationModel, ValueModel, etc. Use by using GUI builder to make a screen; the GUI builder automatically builds an ApplicationModel and a window-spec that later gets interpreted to build a window. Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 573 HotDraw Classes - Figure, Drawing, Handle, Tool, DrawingEditor Subclass DrawingEditor, Figure, rarely Drawing Parameterize Handle, Tool. There is a graphical tool for defining new Tools. Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 574 4
  • 5. White-box vs. Black-box White-box Black-box Customize by Customize by subclassing configuring Emphasize Emphasize inheritance polymorphism Must know Must know internals interfaces Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 575 (continued) White-box Black-box Simpler, easier to Complex, harder to design design Harder to learn, Easier to learn, requires more requires less programming. programming. Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 576 5
  • 6. First Rule of Framework Design Don’t. Buy one, instead. Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 577 Relevant Principles Frameworks are abstractions: people generalize from concrete examples Designing reusable code requires iteration Frameworks encode domain knowledge Customer of framework is application programmer Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 578 6
  • 7. Generalize from Concrete Cases People think concretely, not abstractly. Abstractions are found bottom-up, by examining concrete examples. Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 579 To Generalize: • find things with different names that are really the same, • parameterize to eliminate differences, • break large things into small things so that similar components can be found, and • categorize things that are similar. Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 580 7
  • 8. Finding Abstract Classes Abstract classes are discovered by generalizing from concrete classes. To give classes a common superclass: • give operations common interface • move operations with same implementation to superclass • make operations with different implementation abstract Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 581 (continued) • give them common interface • + rename operations so classes use same names • + reorder arguments, change types of arguments, etc. • + refactor (split or combine) operations Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 582 8
  • 9. Frameworks Require Iteration Reusable code requires many iterations. Basic law of software engineering If it hasn’t been tested, it doesn’t work. Corollary: software that hasn’t been reused is not reusable. Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 583 Frameworks Encode Domain Knowledge Frameworks solve a particular set of problems. Not always application-domain specific, but domain specific. (GUI, distribution, structured drawing editor, business transaction processing, workflow) Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 584 9
  • 10. Customers are Programmers Purpose of framework is to make it easier to build applications. Apply these slogans to application programmers: • The customer is always right. • We are customer-driven. • Understand your customer. Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 585 Example-driven Design Generalization Examples Framework Generalization is iterative. Most changes are small. A few big changes represent new ways of looking at the problem. Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 586 10
  • 11. System size Time To generalize faster: • • get different points of view • • explain/defend current design Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 587 Ideal Way to Develop Framework Analysis Design Test 1) Analyze problem domain • Learn well-known abstractions. • Collect examples of programs to be built from framework. (Minimum of 4 or 5). Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 588 11
  • 12. Ideal Way to Design Framework 2) Design abstraction that covers examples. 3) Test framework by using it to solve the examples. • • Each example is a separate application. • • Performing a test means writing software. Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 589 Designing Abstractions Design phase: look for commonalities, represent each idea once. Use design patterns • implies that experience is needed Insight and ingenuity is always useful, but hard to schedule. Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 590 12
  • 13. Design Patterns Design patterns make designs more black- box. Show how to represent something that changes as an object • • Strategy -- algorithm • • Prototype -- products • • State -- state of an object • • Mediator -- way objects interact Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 591 Using design patterns Each pattern makes design more complex. Each pattern makes design more flexible. Do you need that flexibility? Is the complexity worth while? Only use a pattern when it results in a simpler design than the alternatives. Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 592 13
  • 14. Why Ideal is Never Followed Analyzing domain requires analyzing individual examples, which is already very hard. • Only practical if examples have already been analyzed. • Analyzing and implementing examples is large fraction of the cost of the project. • People need the concrete feedback of implementation. Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 593 Good Way to Develop Framework Pick two similar applications. Include developers experienced in the same domain. One framework group Two application groups Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 594 14
  • 15. • framework group • Give and take software • Consider other applications • Explain and teach framework • 2 application groups • Try to reuse as much software as possible • Complain about how hard software is to use Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 595 Typical Way to Develop Framework Notice that many applications are similar. Develop next application in that domain in an OO language. Divide software into reusable and nonreusable parts. Develop next application reusing as much software as possible. Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 596 15
  • 16. • Surprise! Framework is not very reusable. • Fix it. • Develop next application reusing as much software as possible. Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 597 Problems with Reuse as a Side- effect Conflicting goals • get system out on time • make it reusable Hard to pay for reusability Hard to enforce reusability Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 598 16
  • 17. Advantages with Reuse as a Side- effect Framework developers experience being framework users. Only add features that are cost-effective. Helps prevent frameworks that are too complex and too abstract. Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 599 Another Strategy Design framework - prototype several small applications. Build real application. Refactor and extend framework and old applications. Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 600 17
  • 18. Summary of Process Start with examples of desired applications Iteratively develop abstractions Test by building applications Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 601 More detail 1) Three Examples 2) White-box Framework 3) Component Library 4) Hot Spots 5) Puggable Objects Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 602 18
  • 19. (continued) 6) Fine-grained Objects 7) Black-box Framework 8) Visual Builder 9) Language Tools http://st- www.cs.uiuc.edu/users/droberts/evolve.ht ml Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 603 Application Generators Black-box frameworks make it easier to: • specify application with a picture • generate code from a picture Visual programming languages let non- programmers build applications. Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 604 19
  • 20. Disadvantages of Black-box Framework Black-box framework tends to have • more kinds of objects • more artificial kinds of objects • more complex relationships between objects • more objects Not-quite-ultimate framework forces you to debug more complex system. Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 605 Patterns and Refactoring Refactoring -- changing the structure of a program, but not its function. -- the most common way to fix reusability problems. -- making a quot;hot spotquot; flexible -- often is applying a pattern Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 606 20
  • 21. Refactoring to Help Find Composites Component Composite Component Container Children Leaf Composite Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 607 Hints for Framework Design Use object composition instead of inheritance Incrementally apply patterns / lazy generalization Framework should work out of the box Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 608 21
  • 22. Strategic Concerns Developing a framework is expensive, so look before you leap. • Framework development requires long term commitment. • Pick frameworks that will give you competitive advantage. Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 609 Start small and work up. • get experience with OOP • select and train good abstractors • build small frameworks first • generalize existing systems • keep user base small at first Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 610 22
  • 23. Customers are Crucial Get customers involved early, and use their feedback. Make your initial customers succeed. First set of customers are really part of the development team. Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 611 Reuse Scenarios Ideal: Framework grows along with customer base. Actual: Projects may customize the initial framework, and start competing streams of development. Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 612 23
  • 24. Dealing with Iteration Don’t claim framework is useful until your customers say it is. Keep customer base small while framework is evolving. A successful framework must evolve to meet new customer needs. Don’t constantly tinker. Plan releases and coordinate with customers. Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 613 Documentation and Training Documentation for framework costs several times usual • how to use • how to extend / how it works Software must be understandable to be usable. Improving documentation can make software more reusable. Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 614 24
  • 25. Documentation and Training Base documentation on examples. Must debug documentation and training. Documenting system shows how to change it. Framework developers must be intimately involved. Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 615 NIH vs. TILI Problem with reuse is NOT fault of customer. Software is not as reusable as it is claimed. It is hard to make software reusable. Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 616 25
  • 26. Reusable Design is Hard • Must be abstract and powerful - theory of application domain. • Must be customizable - theory of what users want to change. • Must be easy to understand • -- simplicity is crucial • -- needs good documentation Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 617 26