300 likes | 417 Views
Example-Driven Modeling Using. Micha ł Antkiewicz , Kacper B ą k , Krzysztof Czarnecki , Zinovy Diskin , Dina Zayan 1 , and Andrzej W ą sowski 2 mantkiew@gsd.uwaterloo.ca 1 University of Waterloo 2 IT University of Copenhagen MDEBE, MODELS, Miami, Sep. 29, 2013.
E N D
Example-Driven Modeling Using MichałAntkiewicz, KacperBąk, Krzysztof Czarnecki, ZinovyDiskin, Dina Zayan1, and AndrzejWąsowski2 mantkiew@gsd.uwaterloo.ca 1University of Waterloo2IT University of Copenhagen MDEBE, MODELS, Miami, Sep. 29, 2013
Domain Knowledge Transfer Domain Model Bob (BA) Alice (SME) • Domain expert • Domain novice • Novice modeler • examples • Modeling expert • abstractions
Example-Driven Modeling [1] Examples + Abstractions Model = “An approach to systematically using explicitexamples for eliciting, modeling, verifying, and validating complex domain knowledge” [1] Bąk et al., Example-Driven Modeling. Model = Abstractions + Examples, NIER, ICSE'13
Why Apply Example-Driven Modeling? H1: Constructing models with the aid of explicit examples improves the quality of models. H2: Augmenting models with explicit examples improves model comprehension among various stakeholders [2]. [2] Zayan, Antkiewicz, Czarnecki, Effects of Using Examples on Structural Model Comprehension (submitted)
How to do Example-Driven Modeling? H3: Begin with examples or abstractions; switch H4: Tools validate abstractions wrt. examples H5: Variety of examples H6: Positive and negative examples
Languages? Methods? Tools? We present a vision of how EDM should be done in a scenario, and how it can be supported by a language and a tool
class feature referencehttp://clafer.org • Lightweight structural modeling language • One construct (clafer)/many roles • Feature and configuration modeling • Meta- and (partial) instance modeling • Yet powerful • First-order predicate/relational logic • Constraint language inspired by Alloy
Instance Generator • Reasoner for Clafer • Finite-scope analysis • Model consistent • All correct instantiations • Model inconsistent • UnSAT Core + a near-miss instance • Clafer Tools Binary Distributions [3] [3] http://gsd.uwaterloo.ca/clafer-tools-binary-distributions
A Domain Knowledge Elicitation Scenario Bob (BA) Alice (SME)
Our members often book rooms for meetings. Give me an example of a room booking, please. We have a mid-year review meeting in June. It is organized by Steven, a chair, and is held in the meeting room C that provides a whiteboard and audioconferencing equipment to include online participants. June Steven midYearReview month -> June chair -> Steven room -> C participant$1 participant$2 onlineParticipant$1 C whiteboard audioConferencing June Steven 1 midYearReview month -> June chair -> Steven room -> C participant 1..* onlineParticipant+ C whiteboard audioConferencing ClaferIG
Another example is an on-demand meeting organized within work hours. Joanna, a team-leader, sometimes meets other team members in room D. They use a whiteboard and have no online participants. Joanna ondemandMeeting chair -> Joanna participant + onlineParticipant 0 room -> D D whiteboard
Is this example valid? Al John aMeeting chair -> Al, John participant 0 onlineParticipant 25 room -> E E whiteboard No, there are two chairs, but a meeting must have exactly one chair. Also, it is our policy that rooms cannot be booked for meetings with online participants only. The maximum number of online participants supported by our system is 20. Finally, one cannot have a meeting with online participants without audio conferencing equipment!
Is this example valid? Tom Ed aMeeting participant -> Tom onlineParticipant -> Ed room -> F F audioConferencing There's no chair, which is required. I am also unsure if we have any rooms without a whiteboard.
Part 1: Summary Examples helped ground the discussion, elicit the missing constraints, and uncover tacit knowledge
abstractMember abstractRoom abstractMeeting June Steven : Member midYearReview : Meeting month -> June chair -> Steven room -> C participant -> Member + onlineParticipant -> Member 1..20 C : Room whiteboard audioConferencing Joanna : Member ondemandMeeting : Meeting chair -> Joanna room -> D participant -> Member + onlineParticipant -> Member 0 D : Room whiteboard Let’s extract the commonality to the abstractions.
abstract Member abstract Room whiteboard ? audioConferencing ? abstract Meeting chair -> Member room -> Room participant -> Member + onlineParticipant -> Member 0..20 [ some onlineParticipant => some room.audioConferencing ] June Steven : Member C : Room whiteboard 1 audioConferencing midYearReview: Meeting month -> June chair -> Steven room -> C onlineParticipant-> Member 1..20 Joanna : Member D : Room whiteboard audioConferencing 0 ondemandMeeting: Meeting chair -> Member = Joanna room -> D onlineParticipant -> Member 0 redefinition
Part 2: Summary The abstractions look the same as the examples thanks to redefinition [4][5]. The abstractions can capture more general constraints than examples. [4] Bąk et al. Partial Instances via Subclassing, SLE’13 [5] Bąk et al. Unifying class and feature modeling (submitted)
So far, our abstractions look quite good. Let’s automatically derive a few examples. Are they valid? aMember : Member 2..5 aMeeting : Meeting [ someonlineParticipant ] aRoom : Room
aMember$1 : Member aMember$2 : Member aMember$3 : Member aMeeting : Meeting chair -> aMember$3 room -> aRoom participant -> aMember$3 onlineParticipant$1 -> aMember$3 onlineParticipant$2 -> aMember$2 onlineParticipant$3 -> aMember$1 aRoom : Room audioConferencing aMember$1 : Member aMember$2 : Member aMeeting : Meeting chair -> aMember$2 room -> aRoom participant$1 -> aMember$1 participant$2 -> aMember$2 onlineParticipant -> aMember$2 aRoom : Room whiteboard audioConferencing ClaferIG No, they are invalid! A chair cannot be a participant. Also, no member can participate both on-site and on-line.
Then we need to add the missing constraints. abstract Meeting chair -> Member [ chair not in participant.ref ] [ chair not in onlineParticipant.ref ] room -> Room participant -> Member + onlineParticipant -> Member 0..20 [ no participant.ref& onlineParticipant.ref ] [ some onlineParticipant => some room.audioConferencing ]
aMember$1 : Member aMember$2 : Member aMember$3 : Member aMember$4 : Member aMember$5 : Member aMeeting : Meeting chair -> aMember$1 room -> aRoom participant -> aMember$5 onlineParticipant$1 -> aMember$4 onlineParticipant$2 -> aMember$3 onlineParticipant$3 -> aMember$2 aRoom: Room audioConferencing aMember$1 : Member aMember$2 : Member aMember$3 : Member aMember$4 : Member aMeeting : Meeting chair -> aMember$1 room -> aRoom participant$1 -> aMember$4 participant$2 -> aMember$3 onlineParticipant -> aMember$2 aRoom : Room whiteboard audioConferencing ClaferIG These examples are valid!
Part 3: Summary Automatic example derivation helped uncover missing constraints, extend and subsequently validate the model.
Summary • A vision for doing EDM • Applied Clafer & ClaferIG in a scenario • Abstraction inference • Example derivation • Abstractions checking • Demonstrated supporting language features
Conclusions (i) • Variety of examples • Partial examples • Focus on an area • Positive examples • Correct scenarios • Near-miss negative examples • Constraint violations
Conclusions (ii) • Language design to support EDM • Single modeling concept: clafer • Unified syntax for examples and abstractions • Key mechanism: redefinition • Partial examples • Partial typing • Specialization • Extension
Open Questions • Cost/benefit ratio of EDM? • Study industrial use • What type of examples? • How to collect them? • How many are needed? • How diverse are needed? • How to infer abstractions from examples? • How to support co-evolution?
Example-Driven Modeling Using Thank You!