SlideShare a Scribd company logo
Practical Generative Programming
Schalk W. Cronjé
ysb33r@gmail.com
Even in this new millennium, many engineers will
still build components that have very little reuse
potential due to the inflexible way that they were
constructed.
This leads to excessive time required to adapt a
component for usage in another system.
Welcome to the world of
Generative Programming
Themes
• GP 101
• Building a team
• Building a single system
• Technical footwork
• Building multiple systems
• Integration & maintenance
Definition
It is a software engineering paradigm where the
aim is to automatically manufacture highly
customised and optimised intermediate or end-
products from elementary, reusable components
by means of configuration knowledge.
Automatic programming
• Generative programming is not automatic
programming.
• AP aims for highest level of automation
• GP acknowledges that there are potentialy
different levels of automation possible in a
complete system.
• AP usually involves some form of AI and high
amounts of domain knowledge.
• GP provides practical leverage of state-of-the art
software engineering practices.
Elements of Generative Programming
Problem space Solution space
Configuration
Knowledge
•Illegal feature
combinations
•Default settings &
dependencies
•Construction rules
•Optimisations
•Configured
Components
•Domain-specific
concepts
•Features
Benefits
• Economies of scope
● Less time and effort to produce variety of products
• Software quality improvement
● Reuse of proven components
• Scalability
● Can be applied to parts of a system or to whole
systems
• Optimisation at domain level
● Maximal combinability
● Minimal redundancy
● Maximum reuse
Steps
• Domain scoping
• Feature & concept modelling
• Common architecture design and
implementation technology identification
• Domain-specific notations
• Specify configuration knowledge (metadata)
• Implement generic components
• Apply configuration knowledge using generators
There is no specific order to these steps !
Configuration Knowledge vs
Metadata
• Configuration knowledge is the term preferred
by Czarnecki & Eisenecker
• Configuration knowledge can be considered the
holistic encapsulation of all knowledge related to
building all variants
• Metadata is probably a more codified form of
configuration knowledge.
• Some people find the term metadata easier to
grasp and less confusing than configuration
knowledge
• The rest of this presentation uses the term
metadata
Introducing GP into theProcess
• Start small !
● Use a pilot project or a small subset of an existing
system
● Experiential learning is important – learn to learn.
• Take an iterative and incremental approach to the
different GP steps.
• Don't worry too much about modelling up-front.
Building a Team
• Domain experts
● Require the ability to codify configuration knowledge
into a reusable form.
• Language experts
● Converting configuration knowledge in to
programming language representation.
• Guiding light
● One person whom understands GP well, ensures that
the development process stays on track and not
descend into maintenance hell.
Strategies for C++
• Templates are the C++ way to generic
programming
• Develop elementary components as generic
components
● Fully testable outside of the intended product
configuration
• Configure these components using generated
traits / policy classes
• Aim for zero cyclomatic-complexity in the
generated classes
Template Metaprogramming
• MPL is a key technology to build generic
components
● Best example is Boost C++ MPL
• MPL has been suggested as a domain-specific
language
● Metadata difficult to review to someone not familiar
with MPL
• MPL should rather be used as implementation
strategy
Example #1: Configuration system
Name: NetworkPort
Description: Unrestricted port on which a
service can be started
Type: uint16
Minimum Value: 1024
Maximum Value: 65535
Example #1: Configuration system
template <typename CfgAttr>
typename CfgAttr::value_type
get_config();
std::cout << “The network port we'll use is “ <<
get_config<NetworkPort>();
Example #1: A traits class
struct NetworkPort
{
typedef uint16_t value_type;
static const value_type const_min = 1024;
static const value_type const_max = 65535;
// ... rest to follow
};
Example #1: Alternative traits
Because other non-integral types cannot be
initialised inline, it might be more practical to use
the following alternative.
struct NetworkPort
{
typedef uint16_t value_type;
static value_type min_value() {return 1024;}
static value_type max_value() {return 65535;}
// ... rest to follow
};
Example #1: Basic generic function
std::string get_cfg_string( const char* name );
template <typename CfgAttr>
typename CfgAttr::value_type
get_config()
{
// Calls a basic configuration interface function
std::string tmp=get_cfg_string( CfgAttr::name() );
// Converts to appropriate type, throws exception
// on conversion failure
return boost::lexical_cast<typename
CfgAttr::value_type>(tmp);
}
Introducing run-time safety
• In order to protect the system against external
invalid data we need to add boundary checks.
● Use min_values(), max_value() from traits
● Add a default_value() to handle missing data
• Additional features could include:
● Throwing an exception, instead of defaulting, when
data is missing.
Example #1: Extending the function
template <typename CfgAttr>
typename CfgAttr::value_type
get_config()
{
std::string tmp=get_cfg_string( CfgAttr::name() );
if(tmp.empty())
return CfgAttr::default_value();
else
{
typedef typename CfgAttr::value_type vtype;
vtype ret= boost::lexical_cast<vtype>(tmp);
return CfgAttr::bounded(ret);
}
}
Example #1: Updated traits
struct NetworkPort
{
typedef uint16_t value_type;
static value_type min_value() {return 1024;}
static value_type max_value() {return 65535;}
static value_type default_value {return 4321;}
static value_type& bounded(value_type& v_)
{
return v_=std::max(min_value(),std::min
(v_,max_value()));
}
};
Capturing Configuration Knowledge
• Various methods have been used for codifying
metadata
● Text files
● Graphical Tools
● CASE Tools
• XML is a very convenient form for new projects
● Semi-human readable
● Text – Unrestricted source-control
● Easy to transform to other formats
• Includes non-code artefacts
● Custom editor can be created in Python or Java
Example #1: Configuration system
<ConfigSystem>
<Attr name=”NetworkPort” adt=”uint16”>
<Description>Unrestricted port on which a
service can be started</Description>
<Min>1024</Min>
<Max>65535</Max>
<Default>4321</Default>
</Attr>
</ConfigSystem>
Prefer ADTs
• Use abstract data types (ADTs)
• Use a XML lookup table to go from ADT to C++
type
• Underlying C++ representation can be changed
without changing any of the metadata
Example #1: Simple Generator
<xsl:template match="Attr">
struct <xsl:value-of select="@name"/>
{
typedef <xsl:apply-template select="." mode="adt"/>
value_type;
static const char* name() {return &quot;<xsl:value-
of select="@name"/>&quot;;}
static value_type min_value() {return <xsl:value-of
select="Min/text()"/>;}
static value_type max_value() {return <xsl:value-of
select="Max/text()"/>;}
static value_type default_value() {return
<xsl:value-of select="Default/text()"/>;}
};
</xsl:template>
ADT Lookup Table
<Types>
<Type adt=”uint16” posix-type=”uint16_t” win32-
type=”WORD” embedded-type=”unsigned short”
quoted=”no”/>
<Type adt=”string” posixtype=”std::string” win32-
type=”std::string” embedded-type=”MyFixedString”
quoted=”yes”/>
<!--
adt: ADT name
win32-type: What type to use on a Win32 system
posix-type: Use this type on a POSIX system
embedded-type: Type for embedded systems.
quoted: Whether to quote the type in a traits class
-->
</Types>
Example #2
• Logging is an aspect of most systems that
crosscuts the architecture.
• There might be many requirements in your
system, on how logging and reporting is used.
● Loggable entities
● Levels of logging
● User display issues
● Localisation
• From a C++ point-of-view one important feature
is how logging is generated at logging points
• Using a GP approach it is possible to introduce
compile-time validation
Example #2: Legacy Logging
#define MINOR_FAILURE 1
#define MAJOR_PROBLEM 2
#define GENERAL_PANIC 3
void log_it( int id, const char* text );
// and then some smartie comes along
log_it(
MINOR_PROBLEM|GENERAL_PANIC,
”Voila!! An unsupported error”
);
Example #2: Logging Metadata
<Logging>
<Report id=”1” name=”MINOR_FAILURE”>
<Text>The projector's bulb needs replacing</Text>
</Report>
<Report id=”2” name=”MAJOR_PROBLEM”>
<Text>We're out of Belgium beer</Text>
</Report>
<Report id=”3” name=”GENERAL_PANIC”>
<Text>Elvis has left the building</Text>
</Report>
</Logging>
Example #2: Logging Function
template <typename Report>
void log_it( Report const&, const char* text );
log_it( 3,”My code” ); // compile error
log_it( MAJOR_PROBLEM, “Out of German beer too” );
log_it(
MINOR_FAILURE|MAJOR_PROBLEM,
“No way” ); // Compile error
Example #2: Logging ID Class
// Define type
class Reportable
{
public:
Reportable( unsigned id_ );
unsigned id() const;
};
// then do either, initialising MINOR_FAILURE in .cpp
extern const Reportable MINOR_FAILURE;
// or
namespace { const Reportable MINOR_FAILURE =
Reportable(1); }
Preventing Code-bloat
• Only instantiate what is needed
● For constant objects this is very easy using the MPL-
value idiom
• Due to ways some linkers work, concrete code might be
included in a final link even if the code is not used,
therefore only generate what is needed
● Control the config elements available to a specific
system from metadata
● Only generate the appropriate traits classes
• Cleanly separate common concrete class into a mixin
class
The MPL-value idiom
template <int V>
class A
{
public:
static const A<V> value;
private:
A();
};
template <int V>
static const A<V> A<V>::value;
Logging Reworked
template <unsigned id_>
class Reportable
{
public:
unsigned id() const {return id_;}
static const Reportable<id_> value;
};
const Reportable<id_> Reportable<id_>::value;
typedef Reportable<1> MINOR_FAILURE;
log_it( MINOR_PROBLEM::value,”Only instantiated when
used”);
Adding logging actions
• A user might want to specify that some reports can have
certain associated actions.
• For the logging example we might have
● GO_BUY
● MAKE_ANNOUNCEMENT
● CALL_SECURITY.
• As this is configuration knowledge we can add
this to the metadata and then generate
appropriate metacode.
Example #2: Logging Metadata
<Logging>
<Report id=”1” name=”MINOR_FAILURE”>
<Action>GO_BUY</Action>
</Report>
<Report id=”2” name=”MAJOR_PROBLEM”>
<Action>GO_BUY</Action>
<Action>MAKE_ANNOUNCEMENT</Action>
</Report>
<Report id=”3” name=”GENERAL_PANIC”>
<Action>CALL_SECURITY</Action>
<Action>MAKE_ANNOUNCEMENT</Action>
</Report>
</Logging>
Using MPL as glue
template <unsigned id_,typename actions_list>
class Reportable
{
public:
unsigned id() const {return id_;}
static const Reportable<id_> value;
typedef actions_list valid_actions;
};
// Generated code
typedef Reportable<2,
boost::mpl::vector<GO_BUY,MAKE_ANNOUNCEMENT>
> MAJOR_PROBLEM;
Using SFINAE as validator
template <typename Report,typename Action>
void log_it( const char* text,
boost::enable_if<
boost::mpl::contains<
typename Report::valid_actions, Action
>::type::value
>*_= 0);
// Fails to compile
log_it<GENERAL_PROBLEM>( GO_BUY,”Bought Elvis beer”);
// OK,
log_it<MAJOR_PROBLEM>( GO_BUY,
”Imported some Hoegaarden”);
Multiple Systems
• Examples until now have shown the GP steps
for a configuration system and a logging system.
• The next step is to apply these to three systems:
● System 1 uses XML files for configuration and sends
logs to syslog.
● System2 uses INI files, and sends logs to NT Evlog
● System 3 keeps configuration in a binary format (read-
only) and sends logs via SNMP.
Example Product Metadata
<Products>
<System id=”1”>
<Config type=”xml”/>
<Logging type=”syslog”/>
<Functionality> ... <Functionality>
</System>
<System id=”2”>
<Config type=”ini”/>
<Logging type=”ntevlog”/>
<Functionality> ... <Functionality>
</System>
</Products>
Building Multiple Systems
• Four generators can be applied to this product
metadata.
● Two of them we have already seen
● These will generate configurations and logging aspects
• Another generator looks at logging and
configurations and adds the appropriate
subsystems.
• A fourth generator looks at the functionality and
loads up all of the functional classes for the
system
● A creative exercise for the reader …
Testing
• Can tests be generated?
● There have been various argument around this topic.
• Validate metadata independently
• Test data can be generated from metadata
• DO NOT generate unit tests to validate that the
generated code is correct!
● How can you verify that the generated tests is correct?
Maintenance
• Long-tem maintenance requires upfront
investment in building quality generic
components
• Metadata might have to refactored into smaller
XML files or a tools should be developed to edit
the metadata.
• Refactoring components into more generic
components over time means that you will be
able to configure and customise products even
more.
Integration
• Many modern systems are multi-language /
multi-platform
• These techniques extend easily into other
programming languages / development
environments
• The same configuration knowledge remains the
driver
• Localisation data can be generated in various
formats
• Parts of technical documents can also be
generated.
Further Reading
• www.program-transformation.org
• www.generative-programming.org
• www.research.microsoft.com
In this new millennium, engineers can build high-
quality proven generic components with high reuse
potential and adaptively configure them.
This leads to decreased time required to use a
component in another domain and an increase in
the variety of products that can be assembled.
Did anyone mention competitive edge?

More Related Content

What's hot

Human Resource Management, Ethics, Organizational Culture
Human Resource Management, Ethics, Organizational CultureHuman Resource Management, Ethics, Organizational Culture
Human Resource Management, Ethics, Organizational Culture
Sumbal Noureen
 
PARTIES TO IR AND THEIR ROLES IN IR
PARTIES TO IR AND THEIR ROLES IN IRPARTIES TO IR AND THEIR ROLES IN IR
PARTIES TO IR AND THEIR ROLES IN IR
zohra nafis
 
Value congruence in organization
Value congruence in organization Value congruence in organization
Value congruence in organization
AnShul SharMa
 
Job design and quality of work life
Job design and quality of work lifeJob design and quality of work life
Job design and quality of work life
Mubashir Kocheri Kuzhiyil
 
Pemutusan hubungan kerja
Pemutusan hubungan kerjaPemutusan hubungan kerja
Pemutusan hubungan kerjaFardalaw Labor
 
Labour Relations
Labour RelationsLabour Relations
Labour Relations
Roshan Shanbhag
 
Mnagement Chap 15 motivating employees
Mnagement Chap 15 motivating employeesMnagement Chap 15 motivating employees
Mnagement Chap 15 motivating employees
Dissa MeLina
 
basic factors to determining pay rates
basic factors to determining pay ratesbasic factors to determining pay rates
basic factors to determining pay rates
Sana Rao
 
Pros & Cons of Contracting vs. Permanent Employment
Pros & Cons of Contracting vs. Permanent EmploymentPros & Cons of Contracting vs. Permanent Employment
Pros & Cons of Contracting vs. Permanent Employment
Newforceltd
 
Employment law in india
Employment law in indiaEmployment law in india
Employment law in india
Charan Kumar Mallireddy
 
Job evaluation methods
Job evaluation methodsJob evaluation methods
Job evaluation methods
Photon Interactive
 
Organizational beahviour till personality
Organizational beahviour till personalityOrganizational beahviour till personality
Organizational beahviour till personality
Danish Musthafa
 
Code of discipline
Code of disciplineCode of discipline
Code of discipline
Preeti Bhaskar
 
Risetoperasi 6-metode-transportasi
Risetoperasi 6-metode-transportasiRisetoperasi 6-metode-transportasi
Risetoperasi 6-metode-transportasiAyu Sefryna sari
 
Konflik dan stress di tempat kerja
Konflik dan stress di tempat kerjaKonflik dan stress di tempat kerja
Konflik dan stress di tempat kerja
Firman Bachtiar
 
Human Resources and Management
Human Resources and ManagementHuman Resources and Management
Human Resources and Management
Abdul Wahab Raza
 
Types of compensation
Types of compensationTypes of compensation
Types of compensation
TAYYAB SAGHEER
 
Human resource management chapter 11 ( Pay Structure Decision )
Human resource management chapter 11 ( Pay Structure Decision )Human resource management chapter 11 ( Pay Structure Decision )
Human resource management chapter 11 ( Pay Structure Decision )
ardianfauzan
 
Robbins eob9 inst_ppt_07
Robbins eob9 inst_ppt_07Robbins eob9 inst_ppt_07
Robbins eob9 inst_ppt_07
leng81287
 
perencanaan SDM { ppt manajemen sumber daya manusia }
perencanaan SDM  { ppt manajemen sumber daya manusia } perencanaan SDM  { ppt manajemen sumber daya manusia }
perencanaan SDM { ppt manajemen sumber daya manusia }
joanrawung
 

What's hot (20)

Human Resource Management, Ethics, Organizational Culture
Human Resource Management, Ethics, Organizational CultureHuman Resource Management, Ethics, Organizational Culture
Human Resource Management, Ethics, Organizational Culture
 
PARTIES TO IR AND THEIR ROLES IN IR
PARTIES TO IR AND THEIR ROLES IN IRPARTIES TO IR AND THEIR ROLES IN IR
PARTIES TO IR AND THEIR ROLES IN IR
 
Value congruence in organization
Value congruence in organization Value congruence in organization
Value congruence in organization
 
Job design and quality of work life
Job design and quality of work lifeJob design and quality of work life
Job design and quality of work life
 
Pemutusan hubungan kerja
Pemutusan hubungan kerjaPemutusan hubungan kerja
Pemutusan hubungan kerja
 
Labour Relations
Labour RelationsLabour Relations
Labour Relations
 
Mnagement Chap 15 motivating employees
Mnagement Chap 15 motivating employeesMnagement Chap 15 motivating employees
Mnagement Chap 15 motivating employees
 
basic factors to determining pay rates
basic factors to determining pay ratesbasic factors to determining pay rates
basic factors to determining pay rates
 
Pros & Cons of Contracting vs. Permanent Employment
Pros & Cons of Contracting vs. Permanent EmploymentPros & Cons of Contracting vs. Permanent Employment
Pros & Cons of Contracting vs. Permanent Employment
 
Employment law in india
Employment law in indiaEmployment law in india
Employment law in india
 
Job evaluation methods
Job evaluation methodsJob evaluation methods
Job evaluation methods
 
Organizational beahviour till personality
Organizational beahviour till personalityOrganizational beahviour till personality
Organizational beahviour till personality
 
Code of discipline
Code of disciplineCode of discipline
Code of discipline
 
Risetoperasi 6-metode-transportasi
Risetoperasi 6-metode-transportasiRisetoperasi 6-metode-transportasi
Risetoperasi 6-metode-transportasi
 
Konflik dan stress di tempat kerja
Konflik dan stress di tempat kerjaKonflik dan stress di tempat kerja
Konflik dan stress di tempat kerja
 
Human Resources and Management
Human Resources and ManagementHuman Resources and Management
Human Resources and Management
 
Types of compensation
Types of compensationTypes of compensation
Types of compensation
 
Human resource management chapter 11 ( Pay Structure Decision )
Human resource management chapter 11 ( Pay Structure Decision )Human resource management chapter 11 ( Pay Structure Decision )
Human resource management chapter 11 ( Pay Structure Decision )
 
Robbins eob9 inst_ppt_07
Robbins eob9 inst_ppt_07Robbins eob9 inst_ppt_07
Robbins eob9 inst_ppt_07
 
perencanaan SDM { ppt manajemen sumber daya manusia }
perencanaan SDM  { ppt manajemen sumber daya manusia } perencanaan SDM  { ppt manajemen sumber daya manusia }
perencanaan SDM { ppt manajemen sumber daya manusia }
 

Viewers also liked

Generative Programming In The Large - Applied C++ meta-programming
Generative Programming In The Large - Applied C++ meta-programmingGenerative Programming In The Large - Applied C++ meta-programming
Generative Programming In The Large - Applied C++ meta-programming
Schalk Cronjé
 
A Generative Programming Approach to Developing Pervasive Computing Systems
A Generative Programming Approach to Developing Pervasive Computing SystemsA Generative Programming Approach to Developing Pervasive Computing Systems
A Generative Programming Approach to Developing Pervasive Computing Systems
Damien Cassou
 
Practical Multi-language Generative Programming
Practical Multi-language Generative ProgrammingPractical Multi-language Generative Programming
Practical Multi-language Generative Programming
Schalk Cronjé
 
Generative programming (mostly parser generation)
Generative programming (mostly parser generation)Generative programming (mostly parser generation)
Generative programming (mostly parser generation)
Ralf Laemmel
 
Generative Software Development. Overview and Examples
Generative Software Development. Overview and ExamplesGenerative Software Development. Overview and Examples
Generative Software Development. Overview and Examples
Eelco Visser
 
Seeking Enligtenment - A journey of purpose rather tan instruction
Seeking Enligtenment - A journey of purpose rather tan instructionSeeking Enligtenment - A journey of purpose rather tan instruction
Seeking Enligtenment - A journey of purpose rather tan instruction
Schalk Cronjé
 
Practical Meta Programming
Practical Meta ProgrammingPractical Meta Programming
Practical Meta Programming
Reggie Meisler
 
C++ practical lab
C++ practical labC++ practical lab
C++ practical lab
Bachagul Ghaljai
 
Practical basics on c++
Practical basics on c++Practical basics on c++
Practical basics on c++
Marco Izzotti
 
Generative and Meta-Programming - Modern C++ Design for Parallel Computing
Generative and Meta-Programming - Modern C++ Design for Parallel ComputingGenerative and Meta-Programming - Modern C++ Design for Parallel Computing
Generative and Meta-Programming - Modern C++ Design for Parallel Computing
Joel Falcou
 
An Introduction to the C++ Standard Library
An Introduction to the C++ Standard LibraryAn Introduction to the C++ Standard Library
An Introduction to the C++ Standard Library
Joyjit Choudhury
 
Practical pairing of generative programming with functional programming.
Practical pairing of generative programming with functional programming.Practical pairing of generative programming with functional programming.
Practical pairing of generative programming with functional programming.
Eugene Lazutkin
 
C++:Lab 2
 C++:Lab 2 C++:Lab 2
C++:Lab 2
سلمى شطا
 
Japanese Open and Generative Design
Japanese Open and Generative DesignJapanese Open and Generative Design
Japanese Open and Generative Design
Yuichi Yazaki
 
C++ lab -4
C++ lab -4C++ lab -4
C++ lab -4
سلمى شطا
 
Seri Belajar Mandiri - Pemrograman C# Untuk Pemula
Seri Belajar Mandiri - Pemrograman C# Untuk PemulaSeri Belajar Mandiri - Pemrograman C# Untuk Pemula
Seri Belajar Mandiri - Pemrograman C# Untuk Pemula
Agus Kurniawan
 
c++ lab manual
c++ lab manualc++ lab manual
c++ lab manual
Shrunkhala Wankhede
 
Lab manual of C++
Lab manual of C++Lab manual of C++
Lab manual of C++
thesaqib
 
Probabilistic programming
Probabilistic programmingProbabilistic programming
Probabilistic programming
Eli Gottlieb
 
Summary - Transformational-Generative Theory
Summary - Transformational-Generative TheorySummary - Transformational-Generative Theory
Summary - Transformational-Generative Theory
Marielis VI
 

Viewers also liked (20)

Generative Programming In The Large - Applied C++ meta-programming
Generative Programming In The Large - Applied C++ meta-programmingGenerative Programming In The Large - Applied C++ meta-programming
Generative Programming In The Large - Applied C++ meta-programming
 
A Generative Programming Approach to Developing Pervasive Computing Systems
A Generative Programming Approach to Developing Pervasive Computing SystemsA Generative Programming Approach to Developing Pervasive Computing Systems
A Generative Programming Approach to Developing Pervasive Computing Systems
 
Practical Multi-language Generative Programming
Practical Multi-language Generative ProgrammingPractical Multi-language Generative Programming
Practical Multi-language Generative Programming
 
Generative programming (mostly parser generation)
Generative programming (mostly parser generation)Generative programming (mostly parser generation)
Generative programming (mostly parser generation)
 
Generative Software Development. Overview and Examples
Generative Software Development. Overview and ExamplesGenerative Software Development. Overview and Examples
Generative Software Development. Overview and Examples
 
Seeking Enligtenment - A journey of purpose rather tan instruction
Seeking Enligtenment - A journey of purpose rather tan instructionSeeking Enligtenment - A journey of purpose rather tan instruction
Seeking Enligtenment - A journey of purpose rather tan instruction
 
Practical Meta Programming
Practical Meta ProgrammingPractical Meta Programming
Practical Meta Programming
 
C++ practical lab
C++ practical labC++ practical lab
C++ practical lab
 
Practical basics on c++
Practical basics on c++Practical basics on c++
Practical basics on c++
 
Generative and Meta-Programming - Modern C++ Design for Parallel Computing
Generative and Meta-Programming - Modern C++ Design for Parallel ComputingGenerative and Meta-Programming - Modern C++ Design for Parallel Computing
Generative and Meta-Programming - Modern C++ Design for Parallel Computing
 
An Introduction to the C++ Standard Library
An Introduction to the C++ Standard LibraryAn Introduction to the C++ Standard Library
An Introduction to the C++ Standard Library
 
Practical pairing of generative programming with functional programming.
Practical pairing of generative programming with functional programming.Practical pairing of generative programming with functional programming.
Practical pairing of generative programming with functional programming.
 
C++:Lab 2
 C++:Lab 2 C++:Lab 2
C++:Lab 2
 
Japanese Open and Generative Design
Japanese Open and Generative DesignJapanese Open and Generative Design
Japanese Open and Generative Design
 
C++ lab -4
C++ lab -4C++ lab -4
C++ lab -4
 
Seri Belajar Mandiri - Pemrograman C# Untuk Pemula
Seri Belajar Mandiri - Pemrograman C# Untuk PemulaSeri Belajar Mandiri - Pemrograman C# Untuk Pemula
Seri Belajar Mandiri - Pemrograman C# Untuk Pemula
 
c++ lab manual
c++ lab manualc++ lab manual
c++ lab manual
 
Lab manual of C++
Lab manual of C++Lab manual of C++
Lab manual of C++
 
Probabilistic programming
Probabilistic programmingProbabilistic programming
Probabilistic programming
 
Summary - Transformational-Generative Theory
Summary - Transformational-Generative TheorySummary - Transformational-Generative Theory
Summary - Transformational-Generative Theory
 

Similar to Practical C++ Generative Programming

AdaCore Paris Tech Day 2016: Jose Ruiz - QGen Tech Update
AdaCore Paris Tech Day 2016: Jose Ruiz - QGen Tech UpdateAdaCore Paris Tech Day 2016: Jose Ruiz - QGen Tech Update
AdaCore Paris Tech Day 2016: Jose Ruiz - QGen Tech Update
jamieayre
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best Practices
Inductive Automation
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best Practices
Inductive Automation
 
'Effective node.js development' by Viktor Turskyi at OdessaJS'2020
'Effective node.js development' by Viktor Turskyi at OdessaJS'2020'Effective node.js development' by Viktor Turskyi at OdessaJS'2020
'Effective node.js development' by Viktor Turskyi at OdessaJS'2020
OdessaJS Conf
 
What’s eating python performance
What’s eating python performanceWhat’s eating python performance
What’s eating python performance
Piotr Przymus
 
Viktor Turskyi "Effective NodeJS Application Development"
Viktor Turskyi "Effective NodeJS Application Development"Viktor Turskyi "Effective NodeJS Application Development"
Viktor Turskyi "Effective NodeJS Application Development"
Fwdays
 
Keeping code clean
Keeping code cleanKeeping code clean
Keeping code clean
Brett Child
 
Pragmatic Optimization in Modern Programming - Ordering Optimization Approaches
Pragmatic Optimization in Modern Programming - Ordering Optimization ApproachesPragmatic Optimization in Modern Programming - Ordering Optimization Approaches
Pragmatic Optimization in Modern Programming - Ordering Optimization Approaches
Marina Kolpakova
 
Embedded _c_
Embedded  _c_Embedded  _c_
Embedded _c_
Moorthy Peesapati
 
Software Engineering
Software EngineeringSoftware Engineering
Software Engineering
Tharindu Weerasinghe
 
Rapid app building with loopback framework
Rapid app building with loopback frameworkRapid app building with loopback framework
Rapid app building with loopback framework
Thomas Papaspiros
 
GCP Deployment- Vertex AI
GCP Deployment- Vertex AIGCP Deployment- Vertex AI
GCP Deployment- Vertex AI
Triloki Gupta
 
Ultimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on KubernetesUltimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on Kubernetes
kloia
 
Code Optimization
Code OptimizationCode Optimization
Code Optimization
Akhil Kaushik
 
24-02-18 Rejender pratap.pdf
24-02-18 Rejender pratap.pdf24-02-18 Rejender pratap.pdf
24-02-18 Rejender pratap.pdf
FrangoCamila
 
Effective cplusplus
Effective cplusplusEffective cplusplus
Effective cplusplus
Mark Veltzer
 
Architecture presentation 4
Architecture presentation 4Architecture presentation 4
Architecture presentation 4
Anoushiravan M. Ghamsari
 
Deploy 22 microservices from scratch in 30 mins with GitOps
Deploy 22 microservices from scratch in 30 mins with GitOpsDeploy 22 microservices from scratch in 30 mins with GitOps
Deploy 22 microservices from scratch in 30 mins with GitOps
Opsta
 
Developing, testing and distributing elasticsearch beats in a complex, heter...
Developing, testing and distributing elasticsearch beats in  a complex, heter...Developing, testing and distributing elasticsearch beats in  a complex, heter...
Developing, testing and distributing elasticsearch beats in a complex, heter...
Jesper Agerled Wermuth
 
Improving Code Quality Through Effective Review Process
Improving Code Quality Through Effective  Review ProcessImproving Code Quality Through Effective  Review Process
Improving Code Quality Through Effective Review Process
Dr. Syed Hassan Amin
 

Similar to Practical C++ Generative Programming (20)

AdaCore Paris Tech Day 2016: Jose Ruiz - QGen Tech Update
AdaCore Paris Tech Day 2016: Jose Ruiz - QGen Tech UpdateAdaCore Paris Tech Day 2016: Jose Ruiz - QGen Tech Update
AdaCore Paris Tech Day 2016: Jose Ruiz - QGen Tech Update
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best Practices
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best Practices
 
'Effective node.js development' by Viktor Turskyi at OdessaJS'2020
'Effective node.js development' by Viktor Turskyi at OdessaJS'2020'Effective node.js development' by Viktor Turskyi at OdessaJS'2020
'Effective node.js development' by Viktor Turskyi at OdessaJS'2020
 
What’s eating python performance
What’s eating python performanceWhat’s eating python performance
What’s eating python performance
 
Viktor Turskyi "Effective NodeJS Application Development"
Viktor Turskyi "Effective NodeJS Application Development"Viktor Turskyi "Effective NodeJS Application Development"
Viktor Turskyi "Effective NodeJS Application Development"
 
Keeping code clean
Keeping code cleanKeeping code clean
Keeping code clean
 
Pragmatic Optimization in Modern Programming - Ordering Optimization Approaches
Pragmatic Optimization in Modern Programming - Ordering Optimization ApproachesPragmatic Optimization in Modern Programming - Ordering Optimization Approaches
Pragmatic Optimization in Modern Programming - Ordering Optimization Approaches
 
Embedded _c_
Embedded  _c_Embedded  _c_
Embedded _c_
 
Software Engineering
Software EngineeringSoftware Engineering
Software Engineering
 
Rapid app building with loopback framework
Rapid app building with loopback frameworkRapid app building with loopback framework
Rapid app building with loopback framework
 
GCP Deployment- Vertex AI
GCP Deployment- Vertex AIGCP Deployment- Vertex AI
GCP Deployment- Vertex AI
 
Ultimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on KubernetesUltimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on Kubernetes
 
Code Optimization
Code OptimizationCode Optimization
Code Optimization
 
24-02-18 Rejender pratap.pdf
24-02-18 Rejender pratap.pdf24-02-18 Rejender pratap.pdf
24-02-18 Rejender pratap.pdf
 
Effective cplusplus
Effective cplusplusEffective cplusplus
Effective cplusplus
 
Architecture presentation 4
Architecture presentation 4Architecture presentation 4
Architecture presentation 4
 
Deploy 22 microservices from scratch in 30 mins with GitOps
Deploy 22 microservices from scratch in 30 mins with GitOpsDeploy 22 microservices from scratch in 30 mins with GitOps
Deploy 22 microservices from scratch in 30 mins with GitOps
 
Developing, testing and distributing elasticsearch beats in a complex, heter...
Developing, testing and distributing elasticsearch beats in  a complex, heter...Developing, testing and distributing elasticsearch beats in  a complex, heter...
Developing, testing and distributing elasticsearch beats in a complex, heter...
 
Improving Code Quality Through Effective Review Process
Improving Code Quality Through Effective  Review ProcessImproving Code Quality Through Effective  Review Process
Improving Code Quality Through Effective Review Process
 

More from Schalk Cronjé

DocuOps & Asciidoctor in a JVM World
DocuOps & Asciidoctor in a JVM WorldDocuOps & Asciidoctor in a JVM World
DocuOps & Asciidoctor in a JVM World
Schalk Cronjé
 
DocuOps & Asciidoctor
DocuOps & AsciidoctorDocuOps & Asciidoctor
DocuOps & Asciidoctor
Schalk Cronjé
 
What's new in Asciidoctor
What's new in AsciidoctorWhat's new in Asciidoctor
What's new in Asciidoctor
Schalk Cronjé
 
Probability Management
Probability ManagementProbability Management
Probability Management
Schalk Cronjé
 
Seeking Enligtenment - A journey of purpose rather than instruction
Seeking Enligtenment  - A journey of purpose rather than instructionSeeking Enligtenment  - A journey of purpose rather than instruction
Seeking Enligtenment - A journey of purpose rather than instruction
Schalk Cronjé
 
Idiomatic Gradle Plugin Writing - GradleSummit 2016
Idiomatic Gradle Plugin Writing - GradleSummit 2016Idiomatic Gradle Plugin Writing - GradleSummit 2016
Idiomatic Gradle Plugin Writing - GradleSummit 2016
Schalk Cronjé
 
Gradle in 45min - JBCN2-16 version
Gradle in 45min - JBCN2-16 versionGradle in 45min - JBCN2-16 version
Gradle in 45min - JBCN2-16 version
Schalk Cronjé
 
Cool Jvm Tools to Help you Test - Aylesbury Testers Version
Cool Jvm Tools to Help you Test - Aylesbury Testers VersionCool Jvm Tools to Help you Test - Aylesbury Testers Version
Cool Jvm Tools to Help you Test - Aylesbury Testers Version
Schalk Cronjé
 
Cool JVM Tools to Help You Test
Cool JVM Tools to Help You TestCool JVM Tools to Help You Test
Cool JVM Tools to Help You Test
Schalk Cronjé
 
Using the Groovy Ecosystem for Rapid JVM Development
Using the Groovy Ecosystem for Rapid JVM DevelopmentUsing the Groovy Ecosystem for Rapid JVM Development
Using the Groovy Ecosystem for Rapid JVM Development
Schalk Cronjé
 
Gradle in 45min
Gradle in 45minGradle in 45min
Gradle in 45min
Schalk Cronjé
 
Basic Gradle Plugin Writing
Basic Gradle Plugin WritingBasic Gradle Plugin Writing
Basic Gradle Plugin Writing
Schalk Cronjé
 
Idiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin WritingIdiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin Writing
Schalk Cronjé
 
Beyond Estimates - Probability Management
Beyond Estimates - Probability ManagementBeyond Estimates - Probability Management
Beyond Estimates - Probability Management
Schalk Cronjé
 
Documentation An Engineering Problem Unsolved
Documentation  An Engineering Problem UnsolvedDocumentation  An Engineering Problem Unsolved
Documentation An Engineering Problem Unsolved
Schalk Cronjé
 
Idiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin WritingIdiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin Writing
Schalk Cronjé
 
Gradle in a Polyglot World
Gradle in a Polyglot WorldGradle in a Polyglot World
Gradle in a Polyglot World
Schalk Cronjé
 
Idiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin WritingIdiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin Writing
Schalk Cronjé
 
Death of Agile : Welcome to Value-focused Testing
Death of Agile : Welcome to Value-focused TestingDeath of Agile : Welcome to Value-focused Testing
Death of Agile : Welcome to Value-focused Testing
Schalk Cronjé
 
Asciidoctor in 15min
Asciidoctor in 15minAsciidoctor in 15min
Asciidoctor in 15min
Schalk Cronjé
 

More from Schalk Cronjé (20)

DocuOps & Asciidoctor in a JVM World
DocuOps & Asciidoctor in a JVM WorldDocuOps & Asciidoctor in a JVM World
DocuOps & Asciidoctor in a JVM World
 
DocuOps & Asciidoctor
DocuOps & AsciidoctorDocuOps & Asciidoctor
DocuOps & Asciidoctor
 
What's new in Asciidoctor
What's new in AsciidoctorWhat's new in Asciidoctor
What's new in Asciidoctor
 
Probability Management
Probability ManagementProbability Management
Probability Management
 
Seeking Enligtenment - A journey of purpose rather than instruction
Seeking Enligtenment  - A journey of purpose rather than instructionSeeking Enligtenment  - A journey of purpose rather than instruction
Seeking Enligtenment - A journey of purpose rather than instruction
 
Idiomatic Gradle Plugin Writing - GradleSummit 2016
Idiomatic Gradle Plugin Writing - GradleSummit 2016Idiomatic Gradle Plugin Writing - GradleSummit 2016
Idiomatic Gradle Plugin Writing - GradleSummit 2016
 
Gradle in 45min - JBCN2-16 version
Gradle in 45min - JBCN2-16 versionGradle in 45min - JBCN2-16 version
Gradle in 45min - JBCN2-16 version
 
Cool Jvm Tools to Help you Test - Aylesbury Testers Version
Cool Jvm Tools to Help you Test - Aylesbury Testers VersionCool Jvm Tools to Help you Test - Aylesbury Testers Version
Cool Jvm Tools to Help you Test - Aylesbury Testers Version
 
Cool JVM Tools to Help You Test
Cool JVM Tools to Help You TestCool JVM Tools to Help You Test
Cool JVM Tools to Help You Test
 
Using the Groovy Ecosystem for Rapid JVM Development
Using the Groovy Ecosystem for Rapid JVM DevelopmentUsing the Groovy Ecosystem for Rapid JVM Development
Using the Groovy Ecosystem for Rapid JVM Development
 
Gradle in 45min
Gradle in 45minGradle in 45min
Gradle in 45min
 
Basic Gradle Plugin Writing
Basic Gradle Plugin WritingBasic Gradle Plugin Writing
Basic Gradle Plugin Writing
 
Idiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin WritingIdiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin Writing
 
Beyond Estimates - Probability Management
Beyond Estimates - Probability ManagementBeyond Estimates - Probability Management
Beyond Estimates - Probability Management
 
Documentation An Engineering Problem Unsolved
Documentation  An Engineering Problem UnsolvedDocumentation  An Engineering Problem Unsolved
Documentation An Engineering Problem Unsolved
 
Idiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin WritingIdiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin Writing
 
Gradle in a Polyglot World
Gradle in a Polyglot WorldGradle in a Polyglot World
Gradle in a Polyglot World
 
Idiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin WritingIdiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin Writing
 
Death of Agile : Welcome to Value-focused Testing
Death of Agile : Welcome to Value-focused TestingDeath of Agile : Welcome to Value-focused Testing
Death of Agile : Welcome to Value-focused Testing
 
Asciidoctor in 15min
Asciidoctor in 15minAsciidoctor in 15min
Asciidoctor in 15min
 

Recently uploaded

TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Zilliz
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
Rohit Gautam
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 

Recently uploaded (20)

TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 

Practical C++ Generative Programming

  • 1. Practical Generative Programming Schalk W. Cronjé ysb33r@gmail.com
  • 2. Even in this new millennium, many engineers will still build components that have very little reuse potential due to the inflexible way that they were constructed. This leads to excessive time required to adapt a component for usage in another system.
  • 3. Welcome to the world of Generative Programming
  • 4. Themes • GP 101 • Building a team • Building a single system • Technical footwork • Building multiple systems • Integration & maintenance
  • 5. Definition It is a software engineering paradigm where the aim is to automatically manufacture highly customised and optimised intermediate or end- products from elementary, reusable components by means of configuration knowledge.
  • 6. Automatic programming • Generative programming is not automatic programming. • AP aims for highest level of automation • GP acknowledges that there are potentialy different levels of automation possible in a complete system. • AP usually involves some form of AI and high amounts of domain knowledge. • GP provides practical leverage of state-of-the art software engineering practices.
  • 7. Elements of Generative Programming Problem space Solution space Configuration Knowledge •Illegal feature combinations •Default settings & dependencies •Construction rules •Optimisations •Configured Components •Domain-specific concepts •Features
  • 8. Benefits • Economies of scope ● Less time and effort to produce variety of products • Software quality improvement ● Reuse of proven components • Scalability ● Can be applied to parts of a system or to whole systems • Optimisation at domain level ● Maximal combinability ● Minimal redundancy ● Maximum reuse
  • 9. Steps • Domain scoping • Feature & concept modelling • Common architecture design and implementation technology identification • Domain-specific notations • Specify configuration knowledge (metadata) • Implement generic components • Apply configuration knowledge using generators There is no specific order to these steps !
  • 10. Configuration Knowledge vs Metadata • Configuration knowledge is the term preferred by Czarnecki & Eisenecker • Configuration knowledge can be considered the holistic encapsulation of all knowledge related to building all variants • Metadata is probably a more codified form of configuration knowledge. • Some people find the term metadata easier to grasp and less confusing than configuration knowledge • The rest of this presentation uses the term metadata
  • 11. Introducing GP into theProcess • Start small ! ● Use a pilot project or a small subset of an existing system ● Experiential learning is important – learn to learn. • Take an iterative and incremental approach to the different GP steps. • Don't worry too much about modelling up-front.
  • 12. Building a Team • Domain experts ● Require the ability to codify configuration knowledge into a reusable form. • Language experts ● Converting configuration knowledge in to programming language representation. • Guiding light ● One person whom understands GP well, ensures that the development process stays on track and not descend into maintenance hell.
  • 13. Strategies for C++ • Templates are the C++ way to generic programming • Develop elementary components as generic components ● Fully testable outside of the intended product configuration • Configure these components using generated traits / policy classes • Aim for zero cyclomatic-complexity in the generated classes
  • 14. Template Metaprogramming • MPL is a key technology to build generic components ● Best example is Boost C++ MPL • MPL has been suggested as a domain-specific language ● Metadata difficult to review to someone not familiar with MPL • MPL should rather be used as implementation strategy
  • 15. Example #1: Configuration system Name: NetworkPort Description: Unrestricted port on which a service can be started Type: uint16 Minimum Value: 1024 Maximum Value: 65535
  • 16. Example #1: Configuration system template <typename CfgAttr> typename CfgAttr::value_type get_config(); std::cout << “The network port we'll use is “ << get_config<NetworkPort>();
  • 17. Example #1: A traits class struct NetworkPort { typedef uint16_t value_type; static const value_type const_min = 1024; static const value_type const_max = 65535; // ... rest to follow };
  • 18. Example #1: Alternative traits Because other non-integral types cannot be initialised inline, it might be more practical to use the following alternative. struct NetworkPort { typedef uint16_t value_type; static value_type min_value() {return 1024;} static value_type max_value() {return 65535;} // ... rest to follow };
  • 19. Example #1: Basic generic function std::string get_cfg_string( const char* name ); template <typename CfgAttr> typename CfgAttr::value_type get_config() { // Calls a basic configuration interface function std::string tmp=get_cfg_string( CfgAttr::name() ); // Converts to appropriate type, throws exception // on conversion failure return boost::lexical_cast<typename CfgAttr::value_type>(tmp); }
  • 20. Introducing run-time safety • In order to protect the system against external invalid data we need to add boundary checks. ● Use min_values(), max_value() from traits ● Add a default_value() to handle missing data • Additional features could include: ● Throwing an exception, instead of defaulting, when data is missing.
  • 21. Example #1: Extending the function template <typename CfgAttr> typename CfgAttr::value_type get_config() { std::string tmp=get_cfg_string( CfgAttr::name() ); if(tmp.empty()) return CfgAttr::default_value(); else { typedef typename CfgAttr::value_type vtype; vtype ret= boost::lexical_cast<vtype>(tmp); return CfgAttr::bounded(ret); } }
  • 22. Example #1: Updated traits struct NetworkPort { typedef uint16_t value_type; static value_type min_value() {return 1024;} static value_type max_value() {return 65535;} static value_type default_value {return 4321;} static value_type& bounded(value_type& v_) { return v_=std::max(min_value(),std::min (v_,max_value())); } };
  • 23. Capturing Configuration Knowledge • Various methods have been used for codifying metadata ● Text files ● Graphical Tools ● CASE Tools • XML is a very convenient form for new projects ● Semi-human readable ● Text – Unrestricted source-control ● Easy to transform to other formats • Includes non-code artefacts ● Custom editor can be created in Python or Java
  • 24. Example #1: Configuration system <ConfigSystem> <Attr name=”NetworkPort” adt=”uint16”> <Description>Unrestricted port on which a service can be started</Description> <Min>1024</Min> <Max>65535</Max> <Default>4321</Default> </Attr> </ConfigSystem>
  • 25. Prefer ADTs • Use abstract data types (ADTs) • Use a XML lookup table to go from ADT to C++ type • Underlying C++ representation can be changed without changing any of the metadata
  • 26. Example #1: Simple Generator <xsl:template match="Attr"> struct <xsl:value-of select="@name"/> { typedef <xsl:apply-template select="." mode="adt"/> value_type; static const char* name() {return &quot;<xsl:value- of select="@name"/>&quot;;} static value_type min_value() {return <xsl:value-of select="Min/text()"/>;} static value_type max_value() {return <xsl:value-of select="Max/text()"/>;} static value_type default_value() {return <xsl:value-of select="Default/text()"/>;} }; </xsl:template>
  • 27. ADT Lookup Table <Types> <Type adt=”uint16” posix-type=”uint16_t” win32- type=”WORD” embedded-type=”unsigned short” quoted=”no”/> <Type adt=”string” posixtype=”std::string” win32- type=”std::string” embedded-type=”MyFixedString” quoted=”yes”/> <!-- adt: ADT name win32-type: What type to use on a Win32 system posix-type: Use this type on a POSIX system embedded-type: Type for embedded systems. quoted: Whether to quote the type in a traits class --> </Types>
  • 28. Example #2 • Logging is an aspect of most systems that crosscuts the architecture. • There might be many requirements in your system, on how logging and reporting is used. ● Loggable entities ● Levels of logging ● User display issues ● Localisation • From a C++ point-of-view one important feature is how logging is generated at logging points • Using a GP approach it is possible to introduce compile-time validation
  • 29. Example #2: Legacy Logging #define MINOR_FAILURE 1 #define MAJOR_PROBLEM 2 #define GENERAL_PANIC 3 void log_it( int id, const char* text ); // and then some smartie comes along log_it( MINOR_PROBLEM|GENERAL_PANIC, ”Voila!! An unsupported error” );
  • 30. Example #2: Logging Metadata <Logging> <Report id=”1” name=”MINOR_FAILURE”> <Text>The projector's bulb needs replacing</Text> </Report> <Report id=”2” name=”MAJOR_PROBLEM”> <Text>We're out of Belgium beer</Text> </Report> <Report id=”3” name=”GENERAL_PANIC”> <Text>Elvis has left the building</Text> </Report> </Logging>
  • 31. Example #2: Logging Function template <typename Report> void log_it( Report const&, const char* text ); log_it( 3,”My code” ); // compile error log_it( MAJOR_PROBLEM, “Out of German beer too” ); log_it( MINOR_FAILURE|MAJOR_PROBLEM, “No way” ); // Compile error
  • 32. Example #2: Logging ID Class // Define type class Reportable { public: Reportable( unsigned id_ ); unsigned id() const; }; // then do either, initialising MINOR_FAILURE in .cpp extern const Reportable MINOR_FAILURE; // or namespace { const Reportable MINOR_FAILURE = Reportable(1); }
  • 33. Preventing Code-bloat • Only instantiate what is needed ● For constant objects this is very easy using the MPL- value idiom • Due to ways some linkers work, concrete code might be included in a final link even if the code is not used, therefore only generate what is needed ● Control the config elements available to a specific system from metadata ● Only generate the appropriate traits classes • Cleanly separate common concrete class into a mixin class
  • 34. The MPL-value idiom template <int V> class A { public: static const A<V> value; private: A(); }; template <int V> static const A<V> A<V>::value;
  • 35. Logging Reworked template <unsigned id_> class Reportable { public: unsigned id() const {return id_;} static const Reportable<id_> value; }; const Reportable<id_> Reportable<id_>::value; typedef Reportable<1> MINOR_FAILURE; log_it( MINOR_PROBLEM::value,”Only instantiated when used”);
  • 36. Adding logging actions • A user might want to specify that some reports can have certain associated actions. • For the logging example we might have ● GO_BUY ● MAKE_ANNOUNCEMENT ● CALL_SECURITY. • As this is configuration knowledge we can add this to the metadata and then generate appropriate metacode.
  • 37. Example #2: Logging Metadata <Logging> <Report id=”1” name=”MINOR_FAILURE”> <Action>GO_BUY</Action> </Report> <Report id=”2” name=”MAJOR_PROBLEM”> <Action>GO_BUY</Action> <Action>MAKE_ANNOUNCEMENT</Action> </Report> <Report id=”3” name=”GENERAL_PANIC”> <Action>CALL_SECURITY</Action> <Action>MAKE_ANNOUNCEMENT</Action> </Report> </Logging>
  • 38. Using MPL as glue template <unsigned id_,typename actions_list> class Reportable { public: unsigned id() const {return id_;} static const Reportable<id_> value; typedef actions_list valid_actions; }; // Generated code typedef Reportable<2, boost::mpl::vector<GO_BUY,MAKE_ANNOUNCEMENT> > MAJOR_PROBLEM;
  • 39. Using SFINAE as validator template <typename Report,typename Action> void log_it( const char* text, boost::enable_if< boost::mpl::contains< typename Report::valid_actions, Action >::type::value >*_= 0); // Fails to compile log_it<GENERAL_PROBLEM>( GO_BUY,”Bought Elvis beer”); // OK, log_it<MAJOR_PROBLEM>( GO_BUY, ”Imported some Hoegaarden”);
  • 40. Multiple Systems • Examples until now have shown the GP steps for a configuration system and a logging system. • The next step is to apply these to three systems: ● System 1 uses XML files for configuration and sends logs to syslog. ● System2 uses INI files, and sends logs to NT Evlog ● System 3 keeps configuration in a binary format (read- only) and sends logs via SNMP.
  • 41. Example Product Metadata <Products> <System id=”1”> <Config type=”xml”/> <Logging type=”syslog”/> <Functionality> ... <Functionality> </System> <System id=”2”> <Config type=”ini”/> <Logging type=”ntevlog”/> <Functionality> ... <Functionality> </System> </Products>
  • 42. Building Multiple Systems • Four generators can be applied to this product metadata. ● Two of them we have already seen ● These will generate configurations and logging aspects • Another generator looks at logging and configurations and adds the appropriate subsystems. • A fourth generator looks at the functionality and loads up all of the functional classes for the system ● A creative exercise for the reader …
  • 43. Testing • Can tests be generated? ● There have been various argument around this topic. • Validate metadata independently • Test data can be generated from metadata • DO NOT generate unit tests to validate that the generated code is correct! ● How can you verify that the generated tests is correct?
  • 44. Maintenance • Long-tem maintenance requires upfront investment in building quality generic components • Metadata might have to refactored into smaller XML files or a tools should be developed to edit the metadata. • Refactoring components into more generic components over time means that you will be able to configure and customise products even more.
  • 45. Integration • Many modern systems are multi-language / multi-platform • These techniques extend easily into other programming languages / development environments • The same configuration knowledge remains the driver • Localisation data can be generated in various formats • Parts of technical documents can also be generated.
  • 46. Further Reading • www.program-transformation.org • www.generative-programming.org • www.research.microsoft.com
  • 47. In this new millennium, engineers can build high- quality proven generic components with high reuse potential and adaptively configure them. This leads to decreased time required to use a component in another domain and an increase in the variety of products that can be assembled. Did anyone mention competitive edge?