Upload
guest2e0b3a
View
1.433
Download
3
Embed Size (px)
Citation preview
About
1
What is a language?
Set of well-defined terms
INFORMAL
Stakeholdersagree on meaning
INFORMAL
MetamodelFORMAL
MetamodelGrammar
FORMAL
MetamodelGrammarNotation
FORMAL
A DSL is a focussed, processable
language for describing a specific
concern when building a system in a
specific domain. The abstractions and
notations used are natural/suitable for
the stakeholders who specify that
particular concern.
2
Architecture DSLs
Architecture
As youunderstandand develop
yourArchitecture…
Develop a language toexpress it!
Language resemblesarchitectural concepts
We express theapplication(s) with
the language.
DEMO I
An architectural DSL for embedded systems
3
Benefits
Clear Understandingfrom building the
language
UnambigiousVocabulary
Concepts independentfrom Technology
Programming Model canbe defined based on
Conceptual Arcitecture
Architecture „executable“(i.e. more than rules and docs)
4
Why Textual?
4
… or: why not graphical?
Languages and Editorsare easier to build
Languages and Editorsare easier to build
Evolve Language and simple editoras you understand and discuss the
architecture, in real time!
Integrates easily withcurrent infrastructure:CVS/SVN diff/merge
Model evolutionis trivial, you canalways use grep.
adapting existingmodels as the DSL evolves
Many Developers prefer textual
notations
When a graphicalnotation
is better, you can
visualize.
5
Tooling
Several tools available.Example: oAW Xtext
Specify Grammar
Antlr Grammar andParser is generated
from this specification
Generated Metamodel
Specify Constraints
Generated Editor
DEMO II
The language-aware editor for our DSL
6
Generating Code
Since we alreadyhave a formal model….
Generate APIMaps Architectural Concepts to
Implementation language (non-trivial!)
Im plem entation
Code
Program m ing
M odel A PI
Runtim e Infrastructure
(Platform /M iddlew are)
G lue Code
ImplementationImplementation only depends on
the generated programming model API
Im plem entation
Code
Program m ing
M odel A PI
Runtim e Infrastructure
(Platform /M iddlew are)
G lue Code
Programming ModelGenerated API + Usage Idioms
Completely Technology-Independent
Im plem entation
Code
Program m ing
M odel A PI
Runtim e Infrastructure
(Platform /M iddlew are)
G lue Code
Runtime InfrastructureSelect based on fit wrt. to architectural
concepts and non-functional requirements
Im plem entation
Code
Program m ing
M odel A PI
Runtim e Infrastructure
(Platform /M iddlew are)
G lue Code
Glue CodeAka Technology Mapping CodeMaps API to selected platform
Im plem entation
Code
Program m ing
M odel A PI
Runtim e Infrastructure
(Platform /M iddlew are)
G lue Code
Glue CodeContains Configuration Files for Platform
Might require „mix in models“
Im plem entation
Code
Program m ing
M odel A PI
Runtim e Infrastructure
(Platform /M iddlew are)
G lue Code
Several PlatformsDifferent Platforms, not Languages
Support for Scaling (non-functional req)
Im plem entation
Code
Program m ing
M odel A PI
Runtim e Infrastructure
(Platform /M iddlew are)
G lue Code
Platform 2
G lue Code 2
Testing!
Benefits:More Efficient Impl.Technology IndependentConsistence/QualityArchitecture-Conformance
Code Gen Sequence
Im plem entation
Code
Program m ing
M odel A PI
P latform
G lue Code
1) Generate API
2) Write Impl Code
3) Select Platform
4) Generate Glue Code
Separate Modelsfor stuff relevant for the APIvs. system/deployment stuff
Program m ing
M odel A PI
M odel 1
(Types)
M odel 2
(System ,
D eploym ent)
G lue Code
DEMO III
Generating C for thetarget device
7
Expressing Variability
Different Variantsof the Systemfor different customers.
How do I express
this in themodels?
Negative Variability:Conditionally taking
something away
Negative Variability:Conditionally taking
something away
Feature Models
System
Failover Monitoring
Graceful
DegradationRedundancy
Data
Management
Centralized Distributed
component DelayCalculator {
provides default: IDelayCalculator
requires screens[0..n]: IInfoScreen
provides mon: IMonitoring feature monitoring
}
component DelayCalculator {
provides default: IDelayCalculator
requires screens[0..n]: IInfoScreen
provides mon: IMonitoring feature monitoring
}
System
Failover Monitoring
Graceful
DegradationRedundancy
Data
Management
Centralized Distributed
namespace monitoringStuff feature monitoring {
component MonitoringConsole {
requires devices:[*]: IMonitor
}
instance monitor: MonitoringConsole
dynamic connect monitor.devices query {
type = IMonitor
}
}
Positive Variability:Conditionally adding
something to a minimal core
Positive Variability:Conditionally adding
something to a minimal core
Aspects
namespace monitoring {
component MonitoringConsole …
instance monitor: …
dynamic connect monitor.devices …
aspect (*) component {
provides mon: IMonitoring
}
}
component DelayCalculator {
…
}
component AircraftModule {
…
}
component InfoScreen {
…
}
component DelayCalculator {
…
}
component AircraftModule {
…
}
component InfoScreen {
…
}component DelayCalculator {
…
provides mon: IMonitoring
}
component AircraftModule {
…
provides mon: IMonitoring
}
component InfoScreen {
…
provides mon: IMmonitoring
}
aspect (*) component {
provides mon: IMonitoring
}
Weaver is generic:
works with all (container)model elements
aspect (*) <type>all instances of type
aspect (tag=bla) <type>all instances with tag bla
aspect (name=S*) <type>all instances whose namestarts with S
namespace monitoring feature monitoring {
component MonitoringConsole …
instance monitor: …
dynamic connect monitor.devices …
aspect (*) component {
provides mon: IMonitoring
}
}
AO + Features
DEMO III
Adding Variability and connectivity to a feature model to the previous DSL
Based on actualpractical experience
Currently in use withfour of my customers
Benchmarked bysuitability for use in today‘s projects
THE END.Thank you.
Questions?