From UML State-Machine Diagrams to Erlang Ake Fredlund, ´ ıguez , Lars-˚ Ricardo J. Rodr´ Angel Herranz � All wrongs reversed { rjrodriguez, lfredlund, aherranz } @fi.upm.es Universidad Polit´ ecnica de Madrid Madrid, Spain September 20th, 2013 XIII Jornadas sobre Programaci´ on y Lenguajes (PROLE) Facultad de Inform´ atica, Universidad Complutense de Madrid
Agenda Outline Motivation 1 A Transformation Approach 2 Related Work 3 Conclusions and Future Work 4 R.J. Rodr´ ıguez, L. Fredlund, A. Herranz From UML State-Machine Diagrams to Erlang PROLE 2013 2 / 19
Motivation Outline Motivation 1 A Transformation Approach 2 Related Work 3 Conclusions and Future Work 4 R.J. Rodr´ ıguez, L. Fredlund, A. Herranz From UML State-Machine Diagrams to Erlang PROLE 2013 3 / 19
Motivation Motivation (I) Software Development Life-Cycle Phased involved for developing (and maintaining) software systems and code Deployment (production): what happens when faults (or changes) raise? R.J. Rodr´ ıguez, L. Fredlund, A. Herranz From UML State-Machine Diagrams to Erlang PROLE 2013 4 / 19
Motivation Motivation (I) Software Development Life-Cycle Phased involved for developing (and maintaining) software systems and code Deployment (production): what happens when faults (or changes) raise? Were they initially taken into account? Otherwise → need to redesign R.J. Rodr´ ıguez, L. Fredlund, A. Herranz From UML State-Machine Diagrams to Erlang PROLE 2013 4 / 19
Motivation Motivation (I) Software Development Life-Cycle Phased involved for developing (and maintaining) software systems and code Deployment (production): what happens when faults (or changes) raise? Were they initially taken into account? Otherwise → need to redesign Model-Driven Engineering Increase productivity, simplifying design Maximise compatibility between systems R.J. Rodr´ ıguez, L. Fredlund, A. Herranz From UML State-Machine Diagrams to Erlang PROLE 2013 4 / 19
Motivation Motivation (I) Software Development Life-Cycle Phased involved for developing (and maintaining) software systems and code Deployment (production): what happens when faults (or changes) raise? Were they initially taken into account? Otherwise → need to redesign Model-Driven Engineering Increase productivity, simplifying design Maximise compatibility between systems Verify correctness BEFORE deployment R.J. Rodr´ ıguez, L. Fredlund, A. Herranz From UML State-Machine Diagrams to Erlang PROLE 2013 4 / 19
Motivation Motivation (I) Software Development Life-Cycle Phased involved for developing (and maintaining) software systems and code Deployment (production): what happens when faults (or changes) raise? Were they initially taken into account? Otherwise → need to redesign Model-Driven Engineering Increase productivity, simplifying design Maximise compatibility between systems Verify correctness BEFORE deployment How?: Using model-checking Proofs of correctness Counter-examples (why not correct) R.J. Rodr´ ıguez, L. Fredlund, A. Herranz From UML State-Machine Diagrams to Erlang PROLE 2013 4 / 19
Motivation Motivation (II) We have mixed. . . UML: standard de facto as modelling language UML State Machines (UML-SMs): dynamic system behaviour Assumption: intercommunication through asynchronous channels Erlang: functional and concurrent programming language Native support for concurrency, distribution and fault tolerance Concurrency based on asynchronous message passing Widely used in the industry: T-Mobile, Ericsson, FB, WhatsApp. . . R.J. Rodr´ ıguez, L. Fredlund, A. Herranz From UML State-Machine Diagrams to Erlang PROLE 2013 5 / 19
Motivation Motivation (II) We have mixed. . . UML: standard de facto as modelling language UML State Machines (UML-SMs): dynamic system behaviour Assumption: intercommunication through asynchronous channels Erlang: functional and concurrent programming language Native support for concurrency, distribution and fault tolerance Concurrency based on asynchronous message passing Widely used in the industry: T-Mobile, Ericsson, FB, WhatsApp. . . Contributions Minimise development time Automatically generate Erlang code from UML-SMs R.J. Rodr´ ıguez, L. Fredlund, A. Herranz From UML State-Machine Diagrams to Erlang PROLE 2013 5 / 19
Motivation Motivation (II) We have mixed. . . UML: standard de facto as modelling language UML State Machines (UML-SMs): dynamic system behaviour Assumption: intercommunication through asynchronous channels Erlang: functional and concurrent programming language Native support for concurrency, distribution and fault tolerance Concurrency based on asynchronous message passing Widely used in the industry: T-Mobile, Ericsson, FB, WhatsApp. . . Contributions Minimise development time Automatically generate Erlang code from UML-SMs Detect problems in early stages (save efforts and costs) Apply Erlang-based model checking techniques into UML-SMs R.J. Rodr´ ıguez, L. Fredlund, A. Herranz From UML State-Machine Diagrams to Erlang PROLE 2013 5 / 19
A Transformation Approach Outline Motivation 1 A Transformation Approach 2 Related Work 3 Conclusions and Future Work 4 R.J. Rodr´ ıguez, L. Fredlund, A. Herranz From UML State-Machine Diagrams to Erlang PROLE 2013 6 / 19
A Transformation Approach A Transformation Approach: The Dining Philosophers (I) Philosopher Fork acquire(p) Idle BeingUsed entry / p.acquired() acquire / defer release Please note: thinking time and fork grabbing order R.J. Rodr´ ıguez, L. Fredlund, A. Herranz From UML State-Machine Diagrams to Erlang PROLE 2013 7 / 19
A Transformation Approach A Transformation Approach: The Dining Philosophers (II) Philosopher R.J. Rodr´ ıguez, L. Fredlund, A. Herranz From UML State-Machine Diagrams to Erlang PROLE 2013 8 / 19
A Transformation Approach A Transformation Approach: The Dining Philosophers (II) Philosopher Thinking [TOUT expired] / fL.acquire(self) Hungry fL, fR do / setTimeout(1000) acquired / fR.acquire(self) Eating Waiting do / eatSpaghetti() exit / fL.release(); fR.release() acquired P = { fL , fR } E = { acquired } R.J. Rodr´ ıguez, L. Fredlund, A. Herranz From UML State-Machine Diagrams to Erlang PROLE 2013 8 / 19
A Transformation Approach A Transformation Approach: The Dining Philosophers (II) Philosopher Thinking [TOUT expired] / fL.acquire(self) Hungry fL, fR do / setTimeout(1000) acquired / fR.acquire(self) Eating Waiting do / eatSpaghetti() exit / fL.release(); fR.release() acquired P = { fL , fR } E = { acquired } -module(philosopher). -export([start/2]). start(FL, FR) -> spawn(fun() -> thinking(FL, FR) end). R.J. Rodr´ ıguez, L. Fredlund, A. Herranz From UML State-Machine Diagrams to Erlang PROLE 2013 8 / 19
A Transformation Approach A Transformation Approach: The Dining Philosophers (II) Philosopher Thinking [TOUT expired] / fL.acquire(self) Hungry fL, fR do / setTimeout(1000) acquired / fR.acquire(self) Eating Waiting do / eatSpaghetti() exit / fL.release(); fR.release() acquired P = { fL , fR } E = { acquired } thinking(FL, FR) -> receive -module(philosopher). X -> thinking(FL, FR) -export([start/2]). start(FL, FR) -> after 1000 -> spawn(fun() -> thinking(FL, FR) end). FL!{acquire, self()}, hungry(FL, FR) end. R.J. Rodr´ ıguez, L. Fredlund, A. Herranz From UML State-Machine Diagrams to Erlang PROLE 2013 8 / 19
A Transformation Approach A Transformation Approach: The Dining Philosophers (II) Philosopher Thinking [TOUT expired] / fL.acquire(self) Hungry fL, fR do / setTimeout(1000) acquired / fR.acquire(self) Eating Waiting do / eatSpaghetti() exit / fL.release(); fR.release() acquired P = { fL , fR } E = { acquired } hungry(FL, FR) -> receive -module(philosopher). -export([start/2]). acquired -> start(FL, FR) -> spawn(fun() -> thinking(FL, FR) end). FR!{acquire, self()}, waiting(FL, FR) thinking(FL, FR) -> ... end. R.J. Rodr´ ıguez, L. Fredlund, A. Herranz From UML State-Machine Diagrams to Erlang PROLE 2013 8 / 19
A Transformation Approach A Transformation Approach: The Dining Philosophers (II) Philosopher Thinking [TOUT expired] / fL.acquire(self) Hungry fL, fR do / setTimeout(1000) acquired / fR.acquire(self) Eating Waiting do / eatSpaghetti() exit / fL.release(); fR.release() acquired P = { fL , fR } E = { acquired } waiting(FL, FR) -> -module(philosopher). receive -export([start/2]). start(FL, FR) -> acquired -> eating(FL, FR) spawn(fun() -> thinking(FL, FR) end). thinking(FL, FR) -> ... end. hungry(FL, FR) -> ... R.J. Rodr´ ıguez, L. Fredlund, A. Herranz From UML State-Machine Diagrams to Erlang PROLE 2013 8 / 19
A Transformation Approach A Transformation Approach: The Dining Philosophers (II) Philosopher Thinking [TOUT expired] / fL.acquire(self) Hungry fL, fR do / setTimeout(1000) acquired / fR.acquire(self) Eating Waiting do / eatSpaghetti() exit / fL.release(); fR.release() acquired P = { fL , fR } E = { acquired } -module(philosopher). eating(FL, FR) -> -export([start/2]). start(FL, FR) -> eatSpaghetti(), spawn(fun() -> thinking(FL, FR) end). thinking(FL, FR) -> ... FL!release, FR!release, hungry(FL, FR) -> ... thinking(FL, FR). waiting(FL, FR) -> ... R.J. Rodr´ ıguez, L. Fredlund, A. Herranz From UML State-Machine Diagrams to Erlang PROLE 2013 8 / 19
Recommend
More recommend