the ouroboros methodology - bguse112/wiki.files/ourb-method.pdf · guy wiener (bgu) the ouroboros...

65
The Ouroboros Methodology Guy Wiener Ben-Gurion University 13/6/2011 Software Engineering 2011 Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 1 / 58

Upload: others

Post on 30-Jun-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

The Ouroboros Methodology

Guy Wiener

Ben-Gurion University

13/6/2011

Software Engineering 2011

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 1 / 58

Page 2: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Software Development Methodologies Today

Agile

Develop

TestRefactor

Model-Based

Itemname

Displayscreen

System

parts

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 2 / 58

Page 3: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Model-Driven Development

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 3 / 58

Page 4: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Model-Driven Development

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 3 / 58

Page 5: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Model-Driven Development

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 3 / 58

Page 6: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Using Software Models

Testing before buildingGuidingValidatingCommunicatingVisualizingReducing complexityRaising the level of abstractionStoring knowledgeGenerating code

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 4 / 58

Page 7: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Model-Driven Development

ProsStores knowledgePowerful tools

ConsAdds ceremonySlows down changes

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 5 / 58

Page 8: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Agile Development

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 6 / 58

Page 9: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Agile Development

The Agile ManifestoIndividuals and interactions over processes and toolsWorking software over comprehensive documentationCustomer collaboration over contract negotiationResponding to change over following a plan

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 7 / 58

Page 10: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Agile Development

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 8 / 58

Page 11: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Agile Development

Agile practicesTime-framed iterations, often shortLow amount of ceremonyCustomer feedbackTestingRefactoring

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 9 / 58

Page 12: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Agile Development

ProsResponsive to changeLess administrativa

ConsLooses knowledgeNo tools support

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 10 / 58

Page 13: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Bridging the Gap

Lightweight modelingLink specs and codeModel queriesRound-trip workflow

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 11 / 58

Page 14: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

The Ouroboros Workflow

Model

Query Link

Code

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 12 / 58

Page 15: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Outline

1 Background

2 Modeling

3 Queries and Views

4 Coding and Linking

5 Summary

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 13 / 58

Page 16: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Background

Outline

1 BackgroundOPMProlog

2 Modeling

3 Queries and Views

4 Coding and Linking

5 Summary

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 14 / 58

Page 17: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Background OPM

Outline

1 BackgroundOPMProlog

2 Modeling

3 Queries and Views

4 Coding and Linking

5 Summary

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 15 / 58

Page 18: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Background OPM

OPMObject-Process Methodology (Dori 2002)

FeaturesSimple: ∼ 20 basic declarationsSingle diagram typeDual representation: Textual and graphicalScaling operators

Language Elements

EntitiesObjectsProcessesStates

RelationsBuilt-inTagged

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 16 / 58

Page 19: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Background OPM

OPD

Object-Process DiagramsObjects are boxesProcesses are ellipses

Object states are octagonsRelations are arrows

Entities and Relations

X Yf

Tagged relation f

X Y X instance Y

X Y Y extends X

X Y X consists Y

X Y X exhibits Y

X Y X implements Y

X Y X invokes Y

X Y X yields Y

X Y Y requires X

X Y X handles Y

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 17 / 58

Page 20: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Background OPM

OPDExample Diagram

person

married

single

couple

man

woman

rabbi

marrying

registry

ring

1..2

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 18 / 58

Page 21: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Background OPM

OPL

Object-Process LanguageA textual format for OPMComposed of sentencesEach sentence is a declaration or a relation

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 19 / 58

Page 22: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Background OPM

OPLExample paragraph

object person states single, married.object man, woman, couple, registry, rabbi, ring.process marrying.man, woman extends person.couple consists man, woman.marrying changes person from single to married.marrying consumes ring(1,2).marrying yields couple.

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 20 / 58

Page 23: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Background Prolog

Outline

1 BackgroundOPMProlog

2 Modeling

3 Queries and Views

4 Coding and Linking

5 Summary

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 21 / 58

Page 24: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Background Prolog

Prolog

Origin1972 — Alain Colmerauer designs the logic language Prolog. Hisgoal is to create a language with the intelligence of a two year old.He proves he has reached his goal by showing a Prolog session thatsays "No." to every query.

(Taken from the brief, incomplete, and mostly wrong history ofprogramming languages by James Iry)

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 22 / 58

Page 25: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Background Prolog

Prolog in a Nutshell

father(john, jack).mother(jane, jack).father(john, jill).mother(jane, jill).father(jim, jules).mother(jill, jules).

parent(X, Y) :- father(X, Y).parent(X, Y) :- mother(X, Y).

sibling(X, Y) :-parent(Z, X),parent(Z, Y),X \= Y.

only_child(X) :-\+ sibling(X, _).

?- father(john, X), mother(Y, X).X = jack, Y = jane ;X = jill, Y = jane

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58

Page 26: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Background Prolog

Prolog in a Nutshell

father(john, jack).mother(jane, jack).father(john, jill).mother(jane, jill).father(jim, jules).mother(jill, jules).

parent(X, Y) :- father(X, Y).parent(X, Y) :- mother(X, Y).

sibling(X, Y) :-parent(Z, X),parent(Z, Y),X \= Y.

only_child(X) :-\+ sibling(X, _).

?- father(john, X), mother(Y, X).X = jack, Y = jane ;X = jill, Y = jane

Atom

Functor

Variable

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58

Page 27: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Background Prolog

Prolog in a Nutshell

father(john, jack).mother(jane, jack).father(john, jill).mother(jane, jill).father(jim, jules).mother(jill, jules).

parent(X, Y) :- father(X, Y).parent(X, Y) :- mother(X, Y).

sibling(X, Y) :-parent(Z, X),parent(Z, Y),X \= Y.

only_child(X) :-\+ sibling(X, _).

?- father(john, X), mother(Y, X).X = jack, Y = jane ;X = jill, Y = jane

Fact

Rule

HeadBody

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58

Page 28: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Background Prolog

Prolog in a Nutshell

father(john, jack).mother(jane, jack).father(john, jill).mother(jane, jill).father(jim, jules).mother(jill, jules).

parent(X, Y) :- father(X, Y).parent(X, Y) :- mother(X, Y).

sibling(X, Y) :-parent(Z, X),parent(Z, Y),X \= Y.

only_child(X) :-\+ sibling(X, _).

?- father(john, X), mother(Y, X).X = jack, Y = jane ;X = jill, Y = jane

Query

Assignment

Goal

Negation

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58

Page 29: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Modeling

Outline

1 Background

2 Modeling

3 Queries and Views

4 Coding and Linking

5 Summary

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 24 / 58

Page 30: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Modeling

Ouroboros Models

An example model

object person states single, married.object man, woman, couple, registry, rabbi, ring.process marrying.man, woman extends person.couple consists man, woman.marrying changes person from single to married.marrying consumes ring(1,2).marrying yields couple.

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 25 / 58

Page 31: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Modeling

Ouroboros Models

Prolog predicates for the example model

object(person).object(man).object(woman)....process(marrying).state(person::single).state(person::married).

extends(man, person).extends(woman, person).consists(couple, man).consists(couple, woman).consumes(marrying, ring).produces(marrying, couple)....

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 26 / 58

Page 32: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Modeling

Model Programming

Model rules

process(listener(W)) :- instance(W, window).requires(listener(W), W) :- instance(W, window).

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 27 / 58

Page 33: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Queries and Views

Outline

1 Background

2 Modeling

3 Queries and ViewsQueriesViews

4 Coding and Linking

5 Summary

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 28 / 58

Page 34: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Queries and Views Queries

Outline

1 Background

2 Modeling

3 Queries and ViewsQueriesViews

4 Coding and Linking

5 Summary

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 29 / 58

Page 35: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Queries and Views Queries

Queries

Objects in the system

?- object(X).X = person ;X = man ;X = woman; ...

What extends a base?

?- extends(X, person).X = man ;X = woman

Relations in the system

?- relation(R).R = consists ;R = extends ; ...

How two things arerelated?

?- relation(R),call(R, couple, man).

R = consists.

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 30 / 58

Page 36: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Queries and Views Queries

More Queries

Use cases

use_case(Proc) :-process(Proc),object(User),handles(User, Proc),\+ (process(Top), consists(Top, Proc)).

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 31 / 58

Page 37: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Queries and Views Queries

More Queries

Conversion functions

convert(Proc, From, To) :-process(Proc),consumes(Proc, From),yields(Proc, To),\+ requires(Proc, _),\+ handles(_, Proc),\+ (consumes(Proc, X), X \= From),\+ (yields(Proc, Y), Y \= To).

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 32 / 58

Page 38: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Queries and Views Views

Outline

1 Background

2 Modeling

3 Queries and ViewsQueriesViews

4 Coding and Linking

5 Summary

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 33 / 58

Page 39: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Queries and Views Views

Views

How to partition a complex system?1 Define a view predicate2 Run graphical or textual visualizations

Example view – A system diagram

sd(object(X)) :- use_case(U), handles(X, U).sd(process(U)) :- use_case(U).sd(handles(X, U)) :- handles(X, U).

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 34 / 58

Page 40: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Queries and Views Views

Views

Example view – A system diagram

?- sd(X).X = process(marrying) ;X = object(rabbi) ;X = handles(rabbi, marrying)

Textual

process marrying.object rabbi.rabbi handles marrying.

Graphical

rabbi marrying

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 35 / 58

Page 41: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Coding and Linking

Outline

1 Background

2 Modeling

3 Queries and Views

4 Coding and LinkingCode SummaryLinking Code and SpecsIntegrated Queries

5 Summary

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 36 / 58

Page 42: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Coding and Linking Code Summary

Outline

1 Background

2 Modeling

3 Queries and Views

4 Coding and LinkingCode SummaryLinking Code and SpecsIntegrated Queries

5 Summary

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 37 / 58

Page 43: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Coding and Linking Code Summary

From Source Code To Facts

What is needed?Syntactic parsingRepresent parsed code in knowledge base

Existing logic parsersErlang The parsed code is part of the debug infoJava JTransformer (over Eclipse), JTL

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 38 / 58

Page 44: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Coding and Linking Code Summary

Importing Parsed Code

An Erlang Program — Records

-module(login_srv).-record(user,{username, password, name}).-record(login_ok,{username, time}).-record(login_fail,{username, password, time}).

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 39 / 58

Page 45: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Coding and Linking Code Summary

Importing Parsed Code

An Erlang Program — Functions

start() ->% Server init code...

login(Username, Password) ->Users = get(users),Log = get(log), ...

last_attempt(Username) ->Log = get(log), ...

failed_attempts(Username) ->Log = get(log), ...

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 40 / 58

Page 46: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Coding and Linking Code Summary

Importing Parsed Code

Parsed Code — Records

erl_file(’login_srv.erl’,[attribute(1, file, ’login_srv.erl’(1)),attribute(1, module, login_srv),attribute(2, export, [...]),attribute(4, record,user([record_field(4, atom(4, username)),

record_field(4, atom(4, password)),record_field(4, atom(4, name))])),

...

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 41 / 58

Page 47: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Coding and Linking Code Summary

Importing Parsed Code

Parsed Code — Functions

function(12, login, 2,[clause(12,

[var(13, ’Username’), var(13, ’Password’)], [],[match(15, var(14, ’Users’),

call(14, atom(14, get),[atom(14, users)])),

match(15, var(15, ’Log’),call(15, atom(15, get),

[atom(15, log)])),...]

)])...]).

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 42 / 58

Page 48: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Coding and Linking Code Summary

Code Summary

Code

create_disk_log(Filename,MaxBytes, MaxFiles,ConfigList) ->Format = proplists:get_value(disk_log_fmt,ConfigList, external),open(Filename, MaxBytes,MaxFiles, Format).

Summary

create_disk_log

get_value open

proplists

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 43 / 58

Page 49: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Coding and Linking Code Summary

Code Summary

Code

create_disk_log(Filename,MaxBytes, MaxFiles,ConfigList) ->Format = proplists:get_value(disk_log_fmt,ConfigList, external),open(Filename, MaxBytes,MaxFiles, Format).

Summary

create_disk_log

get_value open

proplists

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 43 / 58

Page 50: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Coding and Linking Code Summary

Code Summary

Rules

object(erl:Record) :- erl_record(Record).object(erl:Field) :- erl_record_field(_, Field).exhibits(erl:Record, erl:Field) :-erl_record_field(Record, Field).

object(erl:Module) :- erl_module(Module).process(erl:Name) :-erl_func(_, _, _, Name).

exhibits(erl:Module, erl:Name) :-erl_func(Module, _, _, Name).

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 44 / 58

Page 51: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Coding and Linking Code Summary

Code Summary

erl:log

erl:login_srv

erl:users

erl:login_srv:failed_attempts

erl:login_srv:last_attempt

erl:login_srv:loginerl:login_srv:start

erl:login_fail

erl:password erl:timeerl:username

erl:login_ok

erl:name

erl:user

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 45 / 58

Page 52: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Coding and Linking Linking Code and Specs

Outline

1 Background

2 Modeling

3 Queries and Views

4 Coding and LinkingCode SummaryLinking Code and SpecsIntegrated Queries

5 Summary

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 46 / 58

Page 53: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Coding and Linking Linking Code and Specs

Synchronizing the Model and Code

The implements relationimplements(Imp, Spec) The entity Imp implements Spec.

Detecting where the model and the code arenot synchronized\+implements(_, Thing) Thing has no implementation.\+implements(Thing, _) Thing has no specification.

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 47 / 58

Page 54: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Coding and Linking Linking Code and Specs

Synchronizing the Model and Code

The implements relationimplements(Imp, Spec) The entity Imp implements Spec.

Detecting where the model and the code arenot synchronized\+implements(_, Thing) Thing has no implementation.\+implements(Thing, _) Thing has no specification.

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 47 / 58

Page 55: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Coding and Linking Linking Code and Specs

Linking Specs and Code SummaryThe specifications

log_entry

login_fail

login_ok

time

username password

login_srv

log

0..n

userusers

0..n

failed_attempts

last_attempt

login

start

name

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 48 / 58

Page 56: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Coding and Linking Linking Code and Specs

Linking Specs and Code SummarySpecification and Implementation

The implements relation

erl:login_ok implements login_ok.erl:time implements time.

implements(erl:X, Y) :- ...

Specs and SummarySummary reflects codestructureSpecs use modelingabstractions

log_entrytimeusername

login_fail

password

login_ok

erl:login_fail

erl:password

erl:timeerl:username

erl:login_ok

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 49 / 58

Page 57: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Coding and Linking Integrated Queries

Outline

1 Background

2 Modeling

3 Queries and Views

4 Coding and LinkingCode SummaryLinking Code and SpecsIntegrated Queries

5 Summary

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 50 / 58

Page 58: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Coding and Linking Integrated Queries

Compatibility

Persistency check

no_persistency :-object(X),\+ (process(P),

consist(P, X)),\+ implements(sql:_, X).

Compatibility queriesValidate policyFind irregulars

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 51 / 58

Page 59: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Coding and Linking Integrated Queries

Impact Analysis

Connected

connected(X, Y, R) :-relation(R),call(R, X, Y).

Also has a recursive version

Context queriesTraceabilityImpactProximity

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 52 / 58

Page 60: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Coding and Linking Integrated Queries

Incremental Changes

Missing implementation Update code and re-linkMissing specification Update specs and re-linkFailed policy check Fix matched codePlanned changes Consult impact analysis

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 53 / 58

Page 61: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Summary

Outline

1 Background

2 Modeling

3 Queries and Views

4 Coding and Linking

5 Summary

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 54 / 58

Page 62: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Summary

Software Modeling in an Agile Environment

Modeling with minimaladded ceremonyQueries provide immediatebenefitPreserves domainknowledgeIdentifies and supportsincremental changes

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 55 / 58

Page 63: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Summary

Not Discussed Here

Model programming (in depth)Code generation

Compatibility rules + Existing code factbase =Generate missing code

Model extractionPatterns, platforms and their properties

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 56 / 58

Page 64: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Summary

Links and References

OPM “Object-Process Methodology: A Holistic SystemPardigm”, Dov Dori, 2002

Erlang http://www.erlang.org/

JTransformer http://sewiki.iai.uni-bonn.de/research/jtransformer/

Ouroboros http://www.cs.bgu.ac.il/~gwiener/software/opmpl/

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 57 / 58

Page 65: The Ouroboros Methodology - BGUse112/wiki.files/ourb-method.pdf · Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 23 / 58. Modeling Outline 1 Background 2 Modeling 3 QueriesandViews

Summary

Thank you!

Questions?

Guy Wiener (BGU) The Ouroboros Methodology 13/6/2011 58 / 58