Episode 58: Product Line Engineering Pt. 2

Topics covered
Popular Clips
Episode Highlights
C Preprocessor
The C preprocessor is a powerful tool for implementing variability in software, particularly through its use of macros. explains how this mechanism was crucial for projects like the Adaptive Communication Environment, which required extensive operating system and compiler combinations 1. However, the preprocessor's lack of locality can lead to complex and unmanageable code, as changes for a single feature might be scattered across multiple locations 1.
The problem with this mechanism is that it provides absolutely no locality. So if a certain feature requires changes in 25 different places in the source code, then you have this if dev such and such feature in 25 different locations.
---
Despite its drawbacks, it was once the only option for fast, runtime-free variability implementation in C.
Runtime Binding
Runtime binding offers flexibility by allowing decisions to be made during execution, but this comes at the cost of performance. notes that while runtime binding provides the greatest flexibility, it often results in larger code size and slower performance 2. This method includes various mechanisms like virtual function calls and metaprogramming, which can complicate debugging due to the dynamic nature of the code 2.
At runtime you have of course the greatest flexibility. But as always, flexibility bites performance.
---
Choosing the right variability mechanism involves balancing performance, code size, and flexibility.
Aspect-Oriented Programming
Aspect-Oriented Programming (AOP) is a technique that localizes both behavioral and structural changes, enhancing code manageability. highlights how AOP tools like AspectJ allow developers to introduce additional operations or attributes into existing classes, thus centralizing changes 3. This approach can simplify the management of code variants by weaving in aspects that encapsulate specific features or behaviors 3.
You can localize the structures, members, classes, attributes and so on that you need for a given feature into a separate aspect and then weave in this aspect.
---
While AOP can be used to patch existing code, its true potential lies in pre-planning variability hooks during the design phase.
Template Mechanisms
C templates offer compile-time variability, providing efficiency but increasing code size. explains that templates allow for the generation of machine code for each variant, resulting in fast execution but potentially large binaries 4. This trade-off between speed and size is a key consideration when using templates for variability 4.
If you have 25 different element types for your collection, your code size increases by a factor of 25 because machine code is generated for each of the alternatives.
---
Despite the increase in code size, templates remain a popular choice for scenarios where performance is critical.
Related Episodes


Episode 53: Product Line Engineering Pt. 1
Answers 383 questions

Episode 90: Product Line Engineering, Pt. 3, with Charles Krueger
Answers 383 questions

Episode 112: Roles in Software Engineering II
Answers 383 questions
Episode 172: Feature-Oriented Software Development with Sven Apel – Pt 1
Answers 383 questions
seradio-episode90-ProductLineEngineering_Pt2_CharlesKrueger.mp3
Answers 383 questions

Episode 25: Architecture Pt. 2
Answers 383 questions

Episode 43: eXtreme Programming Pt.2
Answers 383 questions

Episode 2: Dependencies
Answers 383 questions

Episode 55: Refactoring Pt. 2
Answers 383 questions

Episode 5: Model-Driven Software Development Pt. 1
Answers 383 questions
Episode 173: Feature-Oriented Software Development with Sven Apel – Pt 2
Answers 383 questions

Episode 57: Compile-Time Metaprogramming
Answers 383 questions

Episode 161: Agile Product Management with Roman Pichler
Answers 383 questions

Episode 47: Interview Grady Booch
Answers 383 questions
Episode 125: Performance Engineering with Chris Grindstaff
Answers 383 questions














