from uml state machine diagrams to erlang
play

From UML State-Machine Diagrams to Erlang Ake Fredlund, guez , - PowerPoint PPT Presentation

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


  1. 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

  2. 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

  3. 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

  4. 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

  5. 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

  6. 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

  7. 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

  8. 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

  9. 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

  10. 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

  11. 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

  12. 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

  13. 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

  14. 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

  15. 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

  16. 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

  17. 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

  18. 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

  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

  20. 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