SlideShare a Scribd company logo
SMC
The State Machine Compiler               (40 ’)




  François Perrad
  francois.perrad@gadz.org




                   fperrad@OSDC.fr2009
The State Machine Compiler
   Introduction
   Basic concepts
   Advanced concepts
   More features
   A case study : a Telephone
   Conclusion



                 fperrad@OSDC.fr2009
FSM are everywhere
   FSM : Finite State Machine
   Not a new technology
   Strong theorical base
   Reactive systems / Transformational
    systems
   Event driven
   Applications :
       Telephones, automobiles, communication
        networks, avionic systems, man-machine
        interface

                  fperrad@OSDC.fr2009
FSM graphical view
   Moore
   Mealy
   Grafcet
   UML = Harel statechart




                  fperrad@OSDC.fr2009
A SourceForge project
   Some facts :
       registered in 2000
       ~500 downloads / month
       ~100 bugs (closed)
       written in Java
       mature codebase
       well documented
       3 developers
       Licence MPL

   See :
    http://www.ohloh.net/projects/7339?p=SMC

                     fperrad@OSDC.fr2009
The State Machine Compiler
   Introduction
   Basic concepts
   Advanced concepts
   More features
   A case study : a Telephone
   Conclusion



                 fperrad@OSDC.fr2009
A Compiler
   A input source .sm (yacc-like syntax)
   A output source (readable) in your language
   Currently 14 target languages :
       C, C++, C#, Groovy, Java, Lua, Objective-C, Perl, PHP,
        Python, Ruby, Scala, Tcl and VB.net
   An Object Oriented design :
       your class has a member which is the FSM generated class
   A small RunTime Library
   Parser & Lexer of SMC are written with SMC
   The root of SMC is ATN (Augmented Transition
    Network)
   Robert C. Martin (uncle bob) is the author of the
    initial SMC implementation
                           fperrad@OSDC.fr2009
A Simple Transition
// State 
Idle {
   // Trans    Next State        Actions 
   Run         Running           {} 
} 




                 fperrad@OSDC.fr2009
A Reflexive Transition
// State 
Idle { 
   // Trans    Next State  Actions 
   Timeout     Idle        {} 
} 




                 fperrad@OSDC.fr2009
A Internal Event
// State
Idle { 
   // Trans    Next State  Actions 
   Timeout     nil         {} 
} 




                 fperrad@OSDC.fr2009
A Transition with Actions
// State 
Idle 
{ 
   // Trans 
   Run 
      // Next State 
      Running 
             // Actions 
             { 
                 StopTimer("Idle"); 
                 DoWork(); 
             } 
} 



                     fperrad@OSDC.fr2009
Transition Guards
// State 
Idle 
{ 
    // Trans 
    Run 
    // Guard condition 
    [ctxt.isValid()] 
       // Next State 
       Running 
              // Actions 
              { 
                  StopTimer("Idle"); 
                  DoWork(); 
              } 

    Run       Idle    { RejectRequest(); } 
} 
                        fperrad@OSDC.fr2009
Transition Arguments
// State 
Idle 
{ 
    // Transition 
    Run(msg: const Message&) 
    // Guard condition 
    [msg.isValid()] 
        // Next State 
        Running 
       // Actions 
       { 
           StopTimer("Idle"); 
           DoWork(msg); 
       } 
    Run(msg: const Message&) 
        // Next State Actions 
        Idle          { RejectRequest(msg); } 
} 
                          fperrad@OSDC.fr2009
Entry and Exit Actions
// State 
Idle 
Entry { StartTimer("Idle", 1); CheckQueue(); } 
Exit { StopTimer("Idle"); } 
{ 
   // Transitions 

} 




                     fperrad@OSDC.fr2009
the State Machine Compiler
   Introduction
   Basic concepts
   Advanced concepts
   More features
   A case study : a Telephone
   Conclusion



                 fperrad@OSDC.fr2009
Advanced Features
   Map : state container
       only one level (multiple with UML)
   Push/Pop
       with stack context
       see UML History
   Default state
        factorisation of common behavior
        in a map
   No concurrency (ie //)
                 fperrad@OSDC.fr2009
The Design Pattern




       fperrad@OSDC.fr2009
the State Machine Compiler
   Introduction
   Basic concepts
   Advanced concepts
   More features
   A case study : a Telephone
   Conclusion



                 fperrad@OSDC.fr2009
More features
   Event management is yours
   Graphviz output generation
   HTML table generation
   Dynamic trace
   Namespace support
   Reflection/Introspection (for MMI)




               fperrad@OSDC.fr2009
Graphviz output




       fperrad@OSDC.fr2009
the State Machine Compiler
   Introduction
   Basic concepts
   Advanced concepts
   More Features
   A case study : a Telephone
   Conclusion



               fperrad@OSDC.fr2009
A Telephone
   Go to the WEB
   Play with the demo (Applet Java)
@   http://smc.sourceforge.net/SmcDemo.htm




                   fperrad@OSDC.fr2009
the State Machine Compiler
   Introduction
   Basic concepts
   Advanced concepts
   More Features
   A case study : a Telephone
   Conclusion



                 fperrad@OSDC.fr2009
all contributions welcomed
   Eclipse plugin
   Debian packaging
   Pluggable language support
   New target language
   Regression test
   …




                fperrad@OSDC.fr2009
Bibliography / Webography
- SMC : http://smc.sourceforge.net/
- Robert C. Martin, "Agile Software Development"
- http://en.wikipedia.org/wiki/Finite_state_machine
- http://en.wikipedia.org/wiki/Statechart
- D. Harel, "Statecharts: A Visual Formalism for Complex
     Systems"
- http://www.uml.org/
- http://fr.wikipedia.org/wiki/Grafcet
- NF C03-190 - Diagramme fonctionnel "GRAFCET"
- http://en.wikipedia.org/wiki/Augmented_transition_network




                         fperrad@OSDC.fr2009

More Related Content

Similar to The State Machine Compiler

Open Source XMPP for Cloud Services
Open Source XMPP for Cloud ServicesOpen Source XMPP for Cloud Services
Open Source XMPP for Cloud Services
mattjive
 
ECI OpenFlow 2.0 the Future of SDN
ECI OpenFlow 2.0 the Future of SDN ECI OpenFlow 2.0 the Future of SDN
ECI OpenFlow 2.0 the Future of SDN
ECI – THE ELASTIC NETWORK™
 
Model_Driven_Development_SDR
Model_Driven_Development_SDRModel_Driven_Development_SDR
Model_Driven_Development_SDR
ADLINK Technology IoT
 
Crushing Latency with Vert.x
Crushing Latency with Vert.xCrushing Latency with Vert.x
Crushing Latency with Vert.x
Paulo Lopes
 
Infrastructure as Code in your CD pipelines - London Microsoft DevOps 0423
Infrastructure as Code in your CD pipelines - London Microsoft DevOps 0423Infrastructure as Code in your CD pipelines - London Microsoft DevOps 0423
Infrastructure as Code in your CD pipelines - London Microsoft DevOps 0423
Giulio Vian
 
Virtual platform
Virtual platformVirtual platform
Virtual platform
sean chen
 
Erlang OTP
Erlang OTPErlang OTP
Erlang OTP
Zvi Avraham
 
PLUG : Presentation Layer Universal Generator
 PLUG : Presentation Layer Universal Generator PLUG : Presentation Layer Universal Generator
PLUG : Presentation Layer Universal Generator
Emmanuel Fuchs
 
Preparing to program Aurora at Exascale - Early experiences and future direct...
Preparing to program Aurora at Exascale - Early experiences and future direct...Preparing to program Aurora at Exascale - Early experiences and future direct...
Preparing to program Aurora at Exascale - Early experiences and future direct...
inside-BigData.com
 
Glomosim adding routing protocol
Glomosim   adding routing protocolGlomosim   adding routing protocol
Glomosim adding routing protocol
Kathirvel Ayyaswamy
 
DDD Framework for Java: JdonFramework
DDD Framework for Java: JdonFrameworkDDD Framework for Java: JdonFramework
DDD Framework for Java: JdonFramework
banq jdon
 
First Failure Data Capture for your enterprise application with WebSphere App...
First Failure Data Capture for your enterprise application with WebSphere App...First Failure Data Capture for your enterprise application with WebSphere App...
First Failure Data Capture for your enterprise application with WebSphere App...
Rohit Kelapure
 
Python Streaming Pipelines with Beam on Flink
Python Streaming Pipelines with Beam on FlinkPython Streaming Pipelines with Beam on Flink
Python Streaming Pipelines with Beam on Flink
Aljoscha Krettek
 
20081114 Friday Food iLabt Bart Joris
20081114 Friday Food iLabt Bart Joris20081114 Friday Food iLabt Bart Joris
20081114 Friday Food iLabt Bart Joris
imec.archive
 
C Programming Language Tutorial for beginners - JavaTpoint
C Programming Language Tutorial for beginners - JavaTpointC Programming Language Tutorial for beginners - JavaTpoint
C Programming Language Tutorial for beginners - JavaTpoint
JavaTpoint.Com
 
Ob1k presentation at Java.IL
Ob1k presentation at Java.ILOb1k presentation at Java.IL
Ob1k presentation at Java.IL
Eran Harel
 
Cloud RPI4 tomcat ARM64
Cloud RPI4 tomcat ARM64Cloud RPI4 tomcat ARM64
Cloud RPI4 tomcat ARM64
Jean-Frederic Clere
 
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...
Flink Forward
 
MS Day EPITA 2010: Visual Studio 2010 et Framework .NET 4.0
MS Day EPITA 2010: Visual Studio 2010 et Framework .NET 4.0MS Day EPITA 2010: Visual Studio 2010 et Framework .NET 4.0
MS Day EPITA 2010: Visual Studio 2010 et Framework .NET 4.0
Thomas Conté
 
Eclipse RT Day
Eclipse RT DayEclipse RT Day
Eclipse RT Day
Brett Hackleman
 

Similar to The State Machine Compiler (20)

Open Source XMPP for Cloud Services
Open Source XMPP for Cloud ServicesOpen Source XMPP for Cloud Services
Open Source XMPP for Cloud Services
 
ECI OpenFlow 2.0 the Future of SDN
ECI OpenFlow 2.0 the Future of SDN ECI OpenFlow 2.0 the Future of SDN
ECI OpenFlow 2.0 the Future of SDN
 
Model_Driven_Development_SDR
Model_Driven_Development_SDRModel_Driven_Development_SDR
Model_Driven_Development_SDR
 
Crushing Latency with Vert.x
Crushing Latency with Vert.xCrushing Latency with Vert.x
Crushing Latency with Vert.x
 
Infrastructure as Code in your CD pipelines - London Microsoft DevOps 0423
Infrastructure as Code in your CD pipelines - London Microsoft DevOps 0423Infrastructure as Code in your CD pipelines - London Microsoft DevOps 0423
Infrastructure as Code in your CD pipelines - London Microsoft DevOps 0423
 
Virtual platform
Virtual platformVirtual platform
Virtual platform
 
Erlang OTP
Erlang OTPErlang OTP
Erlang OTP
 
PLUG : Presentation Layer Universal Generator
 PLUG : Presentation Layer Universal Generator PLUG : Presentation Layer Universal Generator
PLUG : Presentation Layer Universal Generator
 
Preparing to program Aurora at Exascale - Early experiences and future direct...
Preparing to program Aurora at Exascale - Early experiences and future direct...Preparing to program Aurora at Exascale - Early experiences and future direct...
Preparing to program Aurora at Exascale - Early experiences and future direct...
 
Glomosim adding routing protocol
Glomosim   adding routing protocolGlomosim   adding routing protocol
Glomosim adding routing protocol
 
DDD Framework for Java: JdonFramework
DDD Framework for Java: JdonFrameworkDDD Framework for Java: JdonFramework
DDD Framework for Java: JdonFramework
 
First Failure Data Capture for your enterprise application with WebSphere App...
First Failure Data Capture for your enterprise application with WebSphere App...First Failure Data Capture for your enterprise application with WebSphere App...
First Failure Data Capture for your enterprise application with WebSphere App...
 
Python Streaming Pipelines with Beam on Flink
Python Streaming Pipelines with Beam on FlinkPython Streaming Pipelines with Beam on Flink
Python Streaming Pipelines with Beam on Flink
 
20081114 Friday Food iLabt Bart Joris
20081114 Friday Food iLabt Bart Joris20081114 Friday Food iLabt Bart Joris
20081114 Friday Food iLabt Bart Joris
 
C Programming Language Tutorial for beginners - JavaTpoint
C Programming Language Tutorial for beginners - JavaTpointC Programming Language Tutorial for beginners - JavaTpoint
C Programming Language Tutorial for beginners - JavaTpoint
 
Ob1k presentation at Java.IL
Ob1k presentation at Java.ILOb1k presentation at Java.IL
Ob1k presentation at Java.IL
 
Cloud RPI4 tomcat ARM64
Cloud RPI4 tomcat ARM64Cloud RPI4 tomcat ARM64
Cloud RPI4 tomcat ARM64
 
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...
 
MS Day EPITA 2010: Visual Studio 2010 et Framework .NET 4.0
MS Day EPITA 2010: Visual Studio 2010 et Framework .NET 4.0MS Day EPITA 2010: Visual Studio 2010 et Framework .NET 4.0
MS Day EPITA 2010: Visual Studio 2010 et Framework .NET 4.0
 
Eclipse RT Day
Eclipse RT DayEclipse RT Day
Eclipse RT Day
 

Recently uploaded

Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
fredae14
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
Dinusha Kumarasiri
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Tatiana Kojar
 
A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024
Intelisync
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Jeffrey Haguewood
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStrDeep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
saastr
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
SitimaJohn
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 

Recently uploaded (20)

Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
 
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
 
A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStrDeep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 

The State Machine Compiler

  • 1. SMC The State Machine Compiler (40 ’) François Perrad francois.perrad@gadz.org fperrad@OSDC.fr2009
  • 2. The State Machine Compiler  Introduction  Basic concepts  Advanced concepts  More features  A case study : a Telephone  Conclusion fperrad@OSDC.fr2009
  • 3. FSM are everywhere  FSM : Finite State Machine  Not a new technology  Strong theorical base  Reactive systems / Transformational systems  Event driven  Applications :  Telephones, automobiles, communication networks, avionic systems, man-machine interface fperrad@OSDC.fr2009
  • 4. FSM graphical view  Moore  Mealy  Grafcet  UML = Harel statechart fperrad@OSDC.fr2009
  • 5. A SourceForge project  Some facts :  registered in 2000  ~500 downloads / month  ~100 bugs (closed)  written in Java  mature codebase  well documented  3 developers  Licence MPL  See : http://www.ohloh.net/projects/7339?p=SMC fperrad@OSDC.fr2009
  • 6. The State Machine Compiler  Introduction  Basic concepts  Advanced concepts  More features  A case study : a Telephone  Conclusion fperrad@OSDC.fr2009
  • 7. A Compiler  A input source .sm (yacc-like syntax)  A output source (readable) in your language  Currently 14 target languages :  C, C++, C#, Groovy, Java, Lua, Objective-C, Perl, PHP, Python, Ruby, Scala, Tcl and VB.net  An Object Oriented design :  your class has a member which is the FSM generated class  A small RunTime Library  Parser & Lexer of SMC are written with SMC  The root of SMC is ATN (Augmented Transition Network)  Robert C. Martin (uncle bob) is the author of the initial SMC implementation fperrad@OSDC.fr2009
  • 8. A Simple Transition // State  Idle { // Trans  Next State Actions  Run  Running  {}  }  fperrad@OSDC.fr2009
  • 9. A Reflexive Transition // State  Idle {  // Trans  Next State  Actions  Timeout  Idle  {}  }  fperrad@OSDC.fr2009
  • 10. A Internal Event // State Idle {  // Trans  Next State  Actions  Timeout  nil  {}  }  fperrad@OSDC.fr2009
  • 11. A Transition with Actions // State  Idle  {  // Trans  Run  // Next State  Running  // Actions  {      StopTimer("Idle");      DoWork();  }  }  fperrad@OSDC.fr2009
  • 12. Transition Guards // State  Idle  {      // Trans      Run  // Guard condition  [ctxt.isValid()]  // Next State  Running  // Actions  {      StopTimer("Idle");      DoWork();  }      Run  Idle  { RejectRequest(); }  }  fperrad@OSDC.fr2009
  • 13. Transition Arguments // State  Idle  {      // Transition      Run(msg: const Message&)  // Guard condition  [msg.isValid()]      // Next State      Running  // Actions  {      StopTimer("Idle");      DoWork(msg);  }      Run(msg: const Message&)      // Next State Actions      Idle  { RejectRequest(msg); }  }  fperrad@OSDC.fr2009
  • 14. Entry and Exit Actions // State  Idle  Entry { StartTimer("Idle", 1); CheckQueue(); }  Exit { StopTimer("Idle"); }  {  // Transitions  }  fperrad@OSDC.fr2009
  • 15. the State Machine Compiler  Introduction  Basic concepts  Advanced concepts  More features  A case study : a Telephone  Conclusion fperrad@OSDC.fr2009
  • 16. Advanced Features  Map : state container  only one level (multiple with UML)  Push/Pop  with stack context  see UML History  Default state  factorisation of common behavior in a map  No concurrency (ie //) fperrad@OSDC.fr2009
  • 17. The Design Pattern fperrad@OSDC.fr2009
  • 18. the State Machine Compiler  Introduction  Basic concepts  Advanced concepts  More features  A case study : a Telephone  Conclusion fperrad@OSDC.fr2009
  • 19. More features  Event management is yours  Graphviz output generation  HTML table generation  Dynamic trace  Namespace support  Reflection/Introspection (for MMI) fperrad@OSDC.fr2009
  • 20. Graphviz output fperrad@OSDC.fr2009
  • 21. the State Machine Compiler  Introduction  Basic concepts  Advanced concepts  More Features  A case study : a Telephone  Conclusion fperrad@OSDC.fr2009
  • 22. A Telephone  Go to the WEB  Play with the demo (Applet Java) @ http://smc.sourceforge.net/SmcDemo.htm fperrad@OSDC.fr2009
  • 23. the State Machine Compiler  Introduction  Basic concepts  Advanced concepts  More Features  A case study : a Telephone  Conclusion fperrad@OSDC.fr2009
  • 24. all contributions welcomed  Eclipse plugin  Debian packaging  Pluggable language support  New target language  Regression test  … fperrad@OSDC.fr2009
  • 25. Bibliography / Webography - SMC : http://smc.sourceforge.net/ - Robert C. Martin, "Agile Software Development" - http://en.wikipedia.org/wiki/Finite_state_machine - http://en.wikipedia.org/wiki/Statechart - D. Harel, "Statecharts: A Visual Formalism for Complex Systems" - http://www.uml.org/ - http://fr.wikipedia.org/wiki/Grafcet - NF C03-190 - Diagramme fonctionnel "GRAFCET" - http://en.wikipedia.org/wiki/Augmented_transition_network fperrad@OSDC.fr2009