150 likes | 164 Views
Generative Programming and Active Libraries. Krzysztof Czarnecki DaimlerChrysler Research and Technology Software Engineering Lab Ulm, Germany www.generative-programming.org. The Vision. Think & program “one of a kind” programming Survey & assembly component-based programming
E N D
Generative Programming and Active Libraries Krzysztof Czarnecki DaimlerChrysler Research and Technology Software Engineering Lab Ulm, Germany www.generative-programming.org
The Vision • Think & program • “one of a kind” programming • Survey & assembly • component-based programming • Order & generate • generative programming
Component-Based Programming • Example: Standard Template Library (STL) • As set of basic, carefully factored data container and algorithm components (minimum redundancy, maximum combinability and reuse) • stack<Element,list<Element> > • Problem of manual assembly in STL • extensive knowledge of implementation detail needed • implementation components, illegal & optimal configurations • poor error reporting
Example of an STL Usage Error stl_algo.h: In function ‘void __merge_sort_loop<_List_iterator <foo,foo &,foo *>, foo *, int>(_List_iterator<foo,foo &,foo *>, _List_iterator<foo,foo &,foo *>, foo *, int)’: stl_algo.h:1448: instantiated from ‘__merge_sort_with_buffer <_List_iterator<foo,foo &,foo *>, foo *, int>( _List_iterator<foo,foo &,foo *>, _List_iterator<foo,foo &,foo *>, foo *, int *)’ stl_algo.h:1485: instantiated from ‘__stable_sort_adaptive< _List_iterator<foo,foo &,foo *>, foo *, int>(_List_iterator <foo,foo &,foo *>, _List_iterator<foo,foo &,foo *>, foo *, int)’ stl_algo.h:1524: instantiated from here stl_algo.h:1377: no match for ‘_List_iterator<foo,foo &,foo *> & -_ ...
Generative Programming The programmer states what she needs... LIST_GENERATOR<Person,cp,poly,with_counter>::RET ACCOUNT_GENERATOR<credit,EUR>::RET MATRIX_GENERATOR<double,structure<up_triang>,speed >::RET and gets the desired component!
Active Libraries • The idea of putting compile-time metacode into domain-specific libraries • Active libraries – in addition to classes and functions – also contain metacode for configuration, generation, optimization, error reporting, debugging and profiling, editing and visualization of code, code refactoring, versioning, ... • Extensible programming environments • e.g. Intentional Programming (Microsoft Research)
Extensible Programming Environments L3 L2 L2 L6 EPE1 EPE2 L3 L1 L4 L5 L2 L6 L5 L1 L4 L3 EPE = Extensible Programming Environment L = Active Library ( compilation, debugging, rendering, type-in & editing, refactoring...)
Generative Domain Model • Configuration Knowledge • Illegal feature combinations • Default settings • Default dependencies • Construction rules • Optimizations • Problem Space • Domain-specificconcepts and • Features • Solution Space • Elementarycomponents • Maximumcombinability • Minimumredundancy Components +System FamilyArchitecture Domain SpecificLanguages (DSLs) Generators
System Family Approach • Domain Engineering • analysis: scoping, common and variable features, feature dependencies (FODA feature diagrams) • design: common architecture for the system family domain-specific languages, configuration generators • implementation: reusable components, domain-specific languages, configuration generators • Application Engineering • production of concrete, highly customized systems and components using the above-mentioned results
Further Information • Czarnecki, Eisenecker: Generative Programming - Methods, Tools, and Applications, Addison-Wesley, 2000 • www.generative-programming.org • Generative and Component-Based Software Development (GCSE 2000), October 10 - 12, 2000, Erfurt, Germany, www.netobjectdays.org/gcse
Industrial Revolution 1980s automated assembly lines first industrial robot installed in 1961 at General Motors; 1970’s advance of microchips 1901 assembly lines introducedby Ransom Olds; popularized and refined by Henry Ford in 1913 1826 interchangeable parts successfully introduced by John Hall (after 25 years of unsuccessful attempts!)
Industrializing Software Production Generating the needed componentsand automatic assembly Generative Programming • Product-Line • Engineering • FODA, ODM, etc. • Better composition automation • active libs, extendible programming environments (e.g. IP), etc. Current practice Searching for and adapting componentsand manual assembly • Better composition technologies • AOP, SOP, APPC, CFs, etc.
Issues to discuss... • DSL design • composability of DSLs
Workshop Issues • Industrial Experiences: experiences with generative techniques for product lines in industrial settings • hard problems in industrial settings that research needs to address • organizational and other problems in industrial settings (how to install and successfully run generative technology projects) • Properties and Design of Domain-Specific Languages DSLs: composability of DSLs • adaptability and parameterization of DSLs • textual vs. GUI DSLs • wizards vs. more complex modeling languages • Approaches to generation: classification of different approaches to generation • properties of a generator architecture • pros and cons of different generative technologies and when to apply which • Approaches to developing generative models: Domain Engineering • Jargons • experiences and managing the process in industrial settings