Title: Application Generators
1Application Generators
- Advanced Seminars in Software Reuse
- Leandro Marques do Nascimento
2- Every minute spent on infrastructure programming
is a wasted minute. - Juval Lowy, .NET Software Legend, April 2003
Code generation is a formalized version of
copy-and-paste programming. (CGN, 2005)
3Software Reuse
4(McIlroy, 1968)
- Mass Produced Software Components
- Felt that component libraries could be
effectively used for numerical computation, I/0
conversion, text processing, and dynamic storage
allocation.
5(Freeman, 1983)
- Not only source code can be reused
- Different types of artifacts which are not
limited to source code fragments can be reused
including design structures, module-level
implementation structures, specifications,
documentation, transformations, and so on.
6(Biggerstaff and Perlis, 1989a) (Biggerstaff and
Perlis, 1989b)
- Commonality among the software reuse techniques
used - Abstraction essencial feature in any reuse
activity - Selection selects the appropriate artifacts to
the specific domain. - Specialization specialize the artifacts through
transformations, constraints, parameters or other
refinement - Integration combine a collection of selected and
specialized artifacts into a complete software
system
7(Krueger, 1992)
- Software reuse is the process of creating
software systems from existing software rather
than building software systems from scratch. - Application generators operate like programming
language compilersinput specifications are
automatically translated into executable
programs. - Using Generators the code expansion
(input/output) may reach 2000 lines of code per
day.
System specification
Generators
what to do
System implementation
how to do
8(Krueger, 1992)
System Architecture (Domain Dependent)
Textual Specifcation Languages (4th generation
languages)
Graphical Diagrams
Templates
Interactive menu driven dialogs
Structure-oriented interface
9(Krueger, 1992)
- Selection
- Depends on domain covarage
- Application generators are often highly
specialized, limiting their domain coverage - Specialization
- Primary task of a software developer, by
providing an input specification - Conventional generators business-oriented,
data intensive applications. Report generation,
data processing and displaying - Expert generators expert knowledge to solve
problems in a particular domain - Parser and compilers generators the most known
examples of application generators, such as Lex
(Lesk and Schmidt, 1979) and Yacc (Johnson, 1979) - Integration
- Generators that produce a complete executable
system do not need integration
10(Krueger, 1992)
- Software life-cycle using application generators
(ideally)
Automated
Automated
System specification (requirements)
Architectural design
Detailed design
Coding
Testing
Automated
Unnecessary
11(Sametinger, 1997)
- Reuse techniques
- Compositional Reuse mounting systems from
unmodified components (ideally)
Component repositories
Component composition
Code and design Scavenging
Code
Design
Blocks of code copied from other system
Large blocks of code. Details deleted. Design
retained.
12(Sametinger, 1997)
- Reuse techniques
- Generative Reuse reuse of a generation process
instead of reuse of components. Examples lexical
analysers, parsers and compilers.
Application Generators
Transformation Systems
Language based generators
Programming Languages
13(Sametinger, 1997)
- Generation vs. Composition
14(Czarnecki and Eisenecker, 2000)
- Domain Engineering is the activity of
collecting, organizing, and storing past
experience in building systems or parts of
systems in a particular domain in the form of
reusable assets - Vertical X Horizontal Domains
- It encompasses
15(Czarnecki and Eisenecker, 2000)
16(Czarnecki and Eisenecker, 2000)
- Generative Programming (GP) is about automating
of intermediate and end-products (i.e.,
components and applications) - Domain Engineering helps in GP
System Families
Model Problem Space
Find Components
Model the Config. Knowledge
17(Czarnecki and Eisenecker, 2000)
Domain Scoping
Feature and Concept Modeling
Design Common Architec.
Identify Components
Specify DSLs
Specify Config. Knowledge
Implement Components
Implement DSLs
Implement Using Generators
18Application Generators
19(Neighbors, 1980)
- DRACO
- First system to support the transformation of
high-level domain-specific programs to executable
code - DE based
- Idea organize software construction knowledge
into a number of related domains - DRACO domain encapsulates
DSLs
Optimization Transformations
Transformational Components
Domain-Specific Procedures
Transformation Strategies
Parse Tree
Rules
Refinements
Domain Dependant
When a set of transformations can be performed
algorithmically
20(Neighbors, 1980)
DRACO Practical Example
21(Batory, 1996)
- GenVoca
- ...building software generators based on
composing OO layers of abstraction, whereby
layers are stacked. - Roughly corresponds to the refinement occurring
in OO frameworks - Steps
Identify layers of abstraction
Put more specialized layers on top
Layer below as parameter to the above
Families of parameterized layers
22(Batory, 1996)
- GenVoca Model (layering with Booch C Data
sctructure)
23(CGN, 2005)
- Four key benefits of code generation
- Quality increased because of the fixes in
templates applied to all code base - Consistency generated APIs are consistent in
class structure - Productivity generators use a fraction of time
of an engineer. So, the engineer can concentrate
on more creative solutions - Abstraction layer of abstraction between design
and code base. Definitions input files hold the
business schema in a abstracted declarative form
which can be inspected by domain experts
24(CGN, 2005)
- Code generators models
- Code Munger
- Inline Code Expander
- Mixed Code Generator
- Partial Class Generator
- Tier Generator
- Domain Language
25(CGN, 2005)
- Code Munger Example JavaDOC
- Q accurate with the code
- C consistent and reliable
- P no external docs
- A little abstraction
26(CGN, 2005)
- Inline Code Expander Examples CSQL, JSQL
- Q infra-structure code reduced
- C consistent code adaptable to other DBs
- P save time in DB intensive applications
- A easier inspections in all SQL commands
27(CGN, 2005)
- Mixed Code Generator Examples CSQL, JSQL
- Q infra-structure code reduced. Better with
IDEs - C consistent code adaptable to other DBs
according to templates
- P save time to focus on SQL
- A easily extracted from code
28(CGN, 2005)
- Partial Class Generator Example Visual Studio
.NET
- Q database layer controlled by templates. OO to
DB errors reduced - C consistent in all generated classes and API
- P save time to upper layers and not worrying
with persistence bugs - A abstracted into definition files and templates
29(CGN, 2005)
- Tier Generator Example Hibernate
- Q equivalent to quality in templates
- C class structure reliable
- P entire tier generated reduces much time
- A tier abstraction is held outside of the code
30(CGN, 2005)
- Domain Language Examples Mathematica, Matlab
- Types, syntax and operations mapped directly to
concepts in the domain - Easier to represent specific structures that
general purpose languages do not provide, such as
multi-dimensional matrix - Other examples
- COBOL COmmon Business Oriented Language
- Domain-Specific Language (DSL) Tools for
Microsoft Visual Studio 2005 - CSound to create audio files
- GraphViz define graphs and get a visual
representation
31(CGN, 2005)
32Qualiti Coder (Qualiti, 2005)
- Java e C
- Eclipse Plugin
- Wizard based
- Layer architecture Presentation, Data and
Communication (PDC)
33(Velocity, 2005)
- Based on Model-View-Controller
- Allows to separate Java programmers from web
designers - Can be used to generate SQL, PostScript and XML
from templates - Also can be used to generate source code and
reports
34(Velocity, 2005)
35(J2ME Polish, 2005)
- J2ME GUI Code generation
- Based on CSS (polish.css file)
- Bitmap fonts
36(J2ME Polish, 2005)
- The tool makes use of preprocessing directives
37Conclusions
- Difficulties to be covered
- Domain peculiarities
- Code Size and efficiency
- Libraries for algorithmic problems
- Future to generators
- More readable languages (5th generation)
- Large domain coverage
- Efficient Drag-and-Drop generation
38References
- (MacIlroy, 1968) MacIlroy, M. D. Mass Produced
Software Components. Nato Software Engineering
Conference. 1968. - (Freeman, 1983) Freeman, P. Reusable software
engineering Concepts and research directions. In
Workshop on Reusability in Programming (Newport,
R. I., Sept.). ITT Programming, Stratford, Corm.,
pp. 2-16. - (Biggerstaff and Ritcher, 1987) Biggerstaff, T.
J. Ritcher, C. Reusability framework,
assessment, and directions. IEEE Software. 4, 2
(Mar.), 4149. 1987. - (Biggerstaff and Perlis, 1989a) Biggerstaff, T.
J. Perlis, A. J. Frontier Series So filoare
Reusability Volume IConcepts and Models. ACM
press, New York. EDS. 1989. - (Biggerstaff and Perlis, 1989b) Biggerstaff, T.
J. Perlis, A. J. Frontier Series Software
Reusability Volume IIApplications and
Experience. ACM Press, New York. EDS. 1989. - (Qualiti, 2005) Qualiti Coder. Available on
http//coder.qualiti.com, accessed in November,
2005. - (Sametinger, 1997) Sametinger, J. Software
Engineering with Reusable Components.
Springer-Verlag, 1997. - (Krueger, 1992) Krueger, C. W. Software Reuse.
ACM Computing Surveys, Vol. 24, No. 2, June 1992 - (Lesk and Schmidt, 1979) Lesk, M. E. Schmidt, E.
Lex A Lexical Analyzer Generator in the UNIX
Programmers ManualSupplementary Documents. 7th
ed. AT T Bell Laboratories, Indianapolis, Ind.
1979. - (Johnson, 1979) Johnson, S. C. Yacc Yet Another
Computer-Compiler in the UNIX Programmers
ManualSupplementary Documents. 7th ed. ATT Bell
Laboratories, Indianapolis, Ind. 1979. - (Czarnecki and Eisenecker, 2000) Czarnecki, K.
Eisenecker, U. W. Generative Programming
Methods, Tools, and Applications. Addison-Wesley,
May, 2000.
39References
- (Czarnecki and Eisenecker, 1999) Czarnecki, K.
Eisenecker, U. W. Components and generative
programming. In Proceedings of the 7th European
software engineering conference held jointly with
the 7th ACM SIGSOFT international symposium on
Foundations of software engineering ESEC/FSE-7.
vol. 24. October, 1999. - (CGN, 2005) Code Generation Network. Available on
http//www.codegeneration.net/, accessed in
November, 2005. - (Pulvermüller and Speck, 2000) Pulvermüller, E.
Speck, A. Towards generative components. In ACM
SIGSOFT Software Engineering Notes archive. Vol.
25 Issue 2. pp. 22-24. ACM Press, March, 2000. - (J2ME Polish, 2005) J2ME Polish. Available on
http//www.j2mepolish.org/, accessed in November,
2005. - (Velocity, 2005) Jakarta Velocity. Available on
http//jakarta.apache.org/velocity/, accessed in
November, 2005. - (Neighbors, 1980) Neighbors, J. M. Software
construction using components. Ph. D. Thesis,
Department Information and Computer Science,
University of California, Irvine, 1980. - (Neighbors, 1989) Neighbors, J. M. Draco a
method for engineering reusable software systems.
In Source Software reusability vol. 1, concepts
and models. pp. 295-319. ACM Press, 1989. - (Batory, 1996) Batory, D. Software System
Generators, Architectures, and Reuse. In Fourth
International Conference on Software Reuse.
Tutorial Notes, Orlando, 1996.
40Application Generators
- Advanced Seminars in Software Reuse
- Leandro Marques do Nascimento