Declarative Approach to Implementing Automata Classes in Imperative Programming Languages - PowerPoint PPT Presentation

About This Presentation
Title:

Declarative Approach to Implementing Automata Classes in Imperative Programming Languages

Description:

... Approach to Implementing Automata Classes in Imperative Programming ... public class IpodPlayer : Automaton, IIpodPlayer // Play and PlayHold stubs go here ... – PowerPoint PPT presentation

Number of Views:21
Avg rating:3.0/5.0
Slides: 32
Provided by: artyomas
Category:

less

Transcript and Presenter's Notes

Title: Declarative Approach to Implementing Automata Classes in Imperative Programming Languages


1
Declarative Approach to Implementing Automata
Classes in Imperative Programming Languages
Second Spring Young Researchers Colloquium on
Software Engineering May 29th 2008
  • Artyom Astafurov, SPbSUITMO
  • Artyom.Astafurov_at_gmail.com
  • Anatoly Shalyto, SPbSUITMO

2
Before We Start
  • Automata based programming?
  • OOP and Automata?
  • Imperative?
  • Declarative?
  • Our framework
  • Example

3
  • What is Automata based programming?

4
(No Transcript)
5
(No Transcript)
6
  • OOP and Automata

7
Foundation
8
Nesting
9
Inheritance
10
  • What is Imperative?

11
  • Explicit instructions
  • Steps to take
  • Answers the question How?

12
  • What is Declarative?

13
  • Defines the end result
  • Doesnt contain steps to achieve the result
  • Answers the question What?

14
  • This HTML code
  • lthtmlgt
  • Input ltinput value"Hello, world!"gt
  • lt/htmlgt
  • Can produce

15
(No Transcript)
16
  • Whats the catch?

17
  • Hybrid approach!

18
  • Imperative for functionality and logic
  • Declarative for the structure

19
or

InnerState(State1A) public class State1 //
Events go here
20
  • Add some reflection or instrumentalization

21
  • Result working code that doesnt have explicit
    delegation of calls to nested automatons and has
    all the magic behind the inheritance implemented

22
  • Example

23
(No Transcript)
24
  • In a nutshell

25
public interface IAcceptsPlay void
Play() public interface IAcceptsPlayHold
void PlayHold() public interface IIpodPlayer
IAcceptsPlay, IAcceptsPlayHold
26
public class Sleeping State, IAcceptsPlay pub
lic void Play() //... public class
PlayerMode State, IAcceptsPlayHold public
void PlayHold() //... InitialState(Sl
eeping), InnerState(PlayerMode) public class
IpodPlayer Automaton, IIpodPlayer // Play
and PlayHold stubs go here
27
  • More complex now

28
public class Paused State, IAcceptPlay public
void Play() Container.SetState(Playing
) public class Playing State,
IAcceptPlay public void Play()
Container.SetState(Paused)
InitialState(Paused),State(Playing) pub
lic class NewPlayerMode PlayerMode // Thats
it!
29
And the new player is
30
State(PlayerMode, NewPlayerMode) public
class NewIpodPlayer IpodPlayer // Thats
it!
31
  • Spasibo!
Write a Comment
User Comments (0)
About PowerShow.com