Automatic Code Generation from Design Patterns - PowerPoint PPT Presentation

1 / 14
About This Presentation
Title:

Automatic Code Generation from Design Patterns

Description:

Code generation is the technique of building code using programs. ... small helper scripts, to grand creations that turn abstract models of business ... – PowerPoint PPT presentation

Number of Views:87
Avg rating:3.0/5.0
Slides: 15
Provided by: rohinira
Category:

less

Transcript and Presenter's Notes

Title: Automatic Code Generation from Design Patterns


1
Automatic Code Generation from Design Patterns
  • Rohini Rajagopal

2
Outline
  • Code Generation
  • Design Patterns
  • Generative Design Patterns
  • Code generation from design patterns
  • Requirements for code generation

3
Code Generation
  • Code generation is the technique of building code
    using programs.
  • These programs can range from very small helper
    scripts, to grand creations that turn abstract
    models of business logic into complete
    applications.
  • The unifying feature of code generation is that
    the output of the generator is code that an
    engineer would otherwise have to write by hand.

4
Code Generation when can it be used?
  • Figure out how the problem can be solved by hand
    coding
  • Figure out how to automate the process
  • Once the requirements are known, a decision can
    be made on which generator can be used or if one
    should be developed.

5
Design Patterns
  • A pattern is something designed or used as a
    model for making things
  • Patterns solve problems
  • Patterns build on experience
  • Patterns focus on human comforts
  • Give designers a reference of proven design
    solutions and how to solve them
  • Design patterns are different from code patterns

6
Design Patterns
  • Include a diagram and a description that
    contains
  • Implementations
  • Consequences
  • Sample code
  • Known uses
  • Related Patterns
  • Intent
  • Motivation
  • Applicability
  • Structure
  • Participants
  • Collaborations

7
Problems with design patterns
  • They are not code
  • They must be implemented each time they are
    applied
  • Not enough patterns available for real world
    problems
  • Code reuse is difficult
  • Tools for generating design pattern code are
    still not widely available.

8
Why Generative design patterns work
  • General enough for a wide range of applications
  • Abstraction. Ability to construct a layered
    programming model
  • Tools available for automation

9
Advantages of using generative design patterns
  • Reduces the time needed for the engineering
    process
  • Reduces programmer error
  • Promotes rapid prototyping and code reuse
  • Provides better overall software engineering
    benefits in terms of
  • Quality
  • Maintenance
  • Code reuse

10
Example of design pattern - Phone Order Example
  • The object oriented design shows a unified,
    higher level interface to a subsystem, that makes
    it easier to use.
  • Consumers encounter a Facade when ordering from
    a catalog.
  • The consumer calls one number and speaks with a
    customer service representative.
  • The customer service representative acts as a
    Facade, providing an interface to the order
    fulfillment department, the billing department,
    and the shipping department.

11
Implementation of design patterns
  • Information required to implement design patterns
  • Choices for implementation trade offs and code
    generation options
  • Application specific names for the following
  • Participants
  • Classes
  • Methods
  • Fields
  • Variables

12
Code Generation Requirements
  • Convenient
  • Solution has to be easily understood and be
    usable
  • The solution should be comprehensive and
    complete. The user should not have to spend ages
    tweaking the output
  • Non Irreversible
  • Incorporation of user changes after the code has
    been generated need to be preserved or re
    applied after one of the underlying patterns has
    changed, or a new pattern has been added.

13
Conclusion
  • Automatic code generation adds a dimension of
    utility to design patterns
  • It shows how domain concepts map into code that
    implements the pattern
  • Code generated can be put to use immediately
  • The process is still in its infancy

14
References
  • Automatic Code Generation from Design Patterns by
    Frank Budinsky, Marilyn Finnie, Patsy Yu and John
    Vlissides
  • http//www.research.ibm.com/designpatterns/pubs/co
    degen.pdf
  • Using Generative Design Patterns to Generate
    Parallel Code for a Distributed Memory
    Environment by Kai Tan, Duane Szafron, Jonathan
    Schaeffer, John Anvik, Steve MacDonald
  • http//delivery.acm.org/10.1145/790000/781532/p203
    -tan.pdf?key1781532key20079773111collGUIDEdl
    GUIDECFID43119250CFTOKEN56673799
  • Examples of Software Design Patterns
  • http//www2.ing.puc.cl/jnavon/IIC2142/patexamples
    .htm
  • Code generation FAQ
  • http//codegeneration.net/tiki-index.php?pageFreq
    uentlyAskedQuestions
  • Generating code from design patterns by Ray
    Grimmond and Christie Whitesides
  • http//www.qwan.com/AboutUs/Generate.pdf
Write a Comment
User Comments (0)
About PowerShow.com