SlideShare ist ein Scribd-Unternehmen logo
1 von 54
Downloaden Sie, um offline zu lesen
gytis@ .lt
state machines
and
symfony workflow
gytis semėnas
gytis@helis.lt || gytis@semenas.lt
gytis@ .lt
state machines?
gytis@ .lt
symfony workflow?
gytis@ .lt
What to expect?
1. State machines
2. Petri nets
3. Symfony workflow
4. Code smells
gytis@ .lt
finite state machines
(FSM)
gytis@ .lt
old
gytis@ .lt
mathematical model of computation
gytis@ .lt
all among us
gytis@ .lt
(Q, Σ, δ, q0, F)
gytis@ .lt
finite state machine
● list of states
● initial state
● conditions for each transition
● can be in one state at a time
gytis@ .lt
moore
output on state
gytis@ .lt
moore oven
State: OFF
output: no heat
State Heating
output: heat
State Idling
output: no
heat
BAKE
pressed
OFF
pressed
too hot
too cold
OFF
pressed
gytis@ .lt
mealy
output on transition (based on state and input)
gytis@ .lt
mealy oven
Off
Baking
{heat false}
Bake
pressed
{heat on}
OFF
Pressed
{heat off}
too hot
{heat off}
too cold
{heat on}
gytis@ .lt
mealy vs moore
the end result vs the process
gytis@ .lt
why use it
● helps with the design process
● easy to read
● easy to test
● easy to maintain
● easy to onboard
● easy to track
gytis@ .lt
represents real world
gytis@ .lt
catch22
gytis@ .lt
gytis@ .lt
petri nets
gytis@ .lt
bipartite graph
place
transition
place
placeplace
gytis@ .lt
bipartite graph + tokens
place
transition
place
placeplace
gytis@ .lt
state is in the marking
gytis@ .lt
state is in the marking
place
transition
place
placeplace
place
transition
gytis@ .lt
state is in the marking
place
transition
place
placeplace
place
transition
gytis@ .lt
state machine?
transition
place
place
place
transition
gytis@ .lt
workflow net
● subset of petri net.
● a single input (source) place with no
previous transitions
● output place (sink) with no following
transitions.
gytis@ .lt
advanced petri nets
mathematical properties:
- boundedness
- safeness
- deadlock free.
- reachability.
parallelization, buffering, resource sharing
optimization, verification
coloured petri nets, weights...
gytis@ .lt
how are the
workflow net, petri net and state machine
related?
gytis@ .lt
how are they related?
petri net
workflow net
FSM
gytis@ .lt
available implementations
state pattern.
custom solution ;>
https://github.com/yohang/Finite
https://github.com/winzou/StateMachineBundle
https://github.com/florianv/petrinet
https://github.com/alterway/component-workflow
gytis@ .lt
symfony workflow
gytis@ .lt
gytis@ .lt
workflow
gytis@ .lt
workflow
gytis@ .lt
configuration
Example by @lyrixx
gytis@ .lt
configuration
Example by @lyrixx
gytis@ .lt
state machine validation
A transition in StateMachine can only have one output.
A transition in StateMachine can only have one input.
A transition from a place/state must have an unique name.
gytis@ .lt
usage
gytis@ .lt
usage in twig
gytis@ .lt
events workflow.leave
workflow.[exact_workflow].leave
workflow.[exact_workflow].leave.[exact_place]
workflow.transition (can be used as mealy)
workflow.enter
workflow.entered (can be used as moore)
workflow.announce
workflow.guard
gytis@ .lt
demo
gytis@ .lt
code smells
gytis@ .lt
looks familiar?
gytis@ .lt
looks familiar?
gytis@ .lt
looks familiar?
gytis@ .lt
what to look for?
● an attribute named state or
status e.g. $chair->getState()
gytis@ .lt
what to look for?
● an attribute named state or status e.g. $reservation->getStatus()
gytis@ .lt
what to look for?
● methods that return
boolean values
gytis@ .lt
what to look for?
● methods that return boolean values
gytis@ .lt
what to look for?
● records that are only valid for a certain period of time.
e.g. subscription expiry date
● or records with NULLABLE datetime fields paid_at, deleted_at, published_at, etc.
gytis@ .lt
a way of thinking
© Tobias Nyholm
gytis@ .lt
credits
Grégoire Pineau @lyrixx
Tobias Nyholm @tobiasNyholm
gytis@ .lt
kthxbye
gytis@helis.lt || gytis@semenas.lt

Weitere ähnliche Inhalte

Was ist angesagt?

Мультимедійна презентація " Історія вивчення клітини".
Мультимедійна презентація  " Історія вивчення клітини".Мультимедійна презентація  " Історія вивчення клітини".
Мультимедійна презентація " Історія вивчення клітини".Olena Коленченко
 
MLA Citation, courtesy of Lake-Sumter Community College Libraries
MLA Citation, courtesy of Lake-Sumter Community College LibrariesMLA Citation, courtesy of Lake-Sumter Community College Libraries
MLA Citation, courtesy of Lake-Sumter Community College Librariestyreelibrary
 
Літературний диктант "Байрон. "Мазепа"
Літературний диктант "Байрон. "Мазепа"Літературний диктант "Байрон. "Мазепа"
Літературний диктант "Байрон. "Мазепа"Tomafastov
 
Aula IA - Redes Neurais Artificiais | PML e SOM
Aula IA - Redes Neurais Artificiais  | PML e SOMAula IA - Redes Neurais Artificiais  | PML e SOM
Aula IA - Redes Neurais Artificiais | PML e SOMCloves da Rocha
 
Презентація:Комп"ютери та їх різновиди
Презентація:Комп"ютери та їх різновидиПрезентація:Комп"ютери та їх різновиди
Презентація:Комп"ютери та їх різновидиsveta7940
 
Контрольні питання до теми: "Галицько - Волинська держава"
Контрольні питання до теми: "Галицько - Волинська держава"Контрольні питання до теми: "Галицько - Волинська держава"
Контрольні питання до теми: "Галицько - Волинська держава"160289yfnfif
 
Види речень за метою висловлювання
Види речень за метою висловлюванняВиди речень за метою висловлювання
Види речень за метою висловлюванняNatalya Kunashenko
 
Презентація до конспекту уроку "Усний твір-опис природи за власним спостереже...
Презентація до конспекту уроку "Усний твір-опис природи за власним спостереже...Презентація до конспекту уроку "Усний твір-опис природи за власним спостереже...
Презентація до конспекту уроку "Усний твір-опис природи за власним спостереже...larisanishchyk
 
Autenticación remota y servicios de directorio. LDAP y Kerberos
Autenticación remota y servicios de directorio. LDAP y KerberosAutenticación remota y servicios de directorio. LDAP y Kerberos
Autenticación remota y servicios de directorio. LDAP y Kerberosseguridadelinux
 
дидактичний матер ал мартиненко н.м.
дидактичний матер ал мартиненко н.м.дидактичний матер ал мартиненко н.м.
дидактичний матер ал мартиненко н.м.Helen Golovina
 
Презентація Бази даних Урок 1.pptx
Презентація Бази даних Урок 1.pptxПрезентація Бази даних Урок 1.pptx
Презентація Бази даних Урок 1.pptxssuserceb60a
 
Підручник з біології для 7 класу Шабанов
Підручник з біології для 7 класу ШабановПідручник з біології для 7 класу Шабанов
Підручник з біології для 7 класу ШабановНаталья Полищук
 
мопассан пампушка
мопассан пампушкамопассан пампушка
мопассан пампушкаSnezhanaP10
 
Hoarding power point presentation
Hoarding power point presentationHoarding power point presentation
Hoarding power point presentationShewikar El Bakry
 
Abnormal psychology 1b
Abnormal psychology 1bAbnormal psychology 1b
Abnormal psychology 1bVivie Chabie
 

Was ist angesagt? (20)

Мультимедійна презентація " Історія вивчення клітини".
Мультимедійна презентація  " Історія вивчення клітини".Мультимедійна презентація  " Історія вивчення клітини".
Мультимедійна презентація " Історія вивчення клітини".
 
MLA Citation, courtesy of Lake-Sumter Community College Libraries
MLA Citation, courtesy of Lake-Sumter Community College LibrariesMLA Citation, courtesy of Lake-Sumter Community College Libraries
MLA Citation, courtesy of Lake-Sumter Community College Libraries
 
Літературний диктант "Байрон. "Мазепа"
Літературний диктант "Байрон. "Мазепа"Літературний диктант "Байрон. "Мазепа"
Літературний диктант "Байрон. "Мазепа"
 
Aula IA - Redes Neurais Artificiais | PML e SOM
Aula IA - Redes Neurais Artificiais  | PML e SOMAula IA - Redes Neurais Artificiais  | PML e SOM
Aula IA - Redes Neurais Artificiais | PML e SOM
 
Ольга Кобилянська біобібліографічний нарис
Ольга Кобилянська біобібліографічний нарисОльга Кобилянська біобібліографічний нарис
Ольга Кобилянська біобібліографічний нарис
 
Презентація:Комп"ютери та їх різновиди
Презентація:Комп"ютери та їх різновидиПрезентація:Комп"ютери та їх різновиди
Презентація:Комп"ютери та їх різновиди
 
Vasco da gama revd
Vasco da gama revdVasco da gama revd
Vasco da gama revd
 
Контрольні питання до теми: "Галицько - Волинська держава"
Контрольні питання до теми: "Галицько - Волинська держава"Контрольні питання до теми: "Галицько - Волинська держава"
Контрольні питання до теми: "Галицько - Волинська держава"
 
Види речень за метою висловлювання
Види речень за метою висловлюванняВиди речень за метою висловлювання
Види речень за метою висловлювання
 
182
182182
182
 
Презентація до конспекту уроку "Усний твір-опис природи за власним спостереже...
Презентація до конспекту уроку "Усний твір-опис природи за власним спостереже...Презентація до конспекту уроку "Усний твір-опис природи за власним спостереже...
Презентація до конспекту уроку "Усний твір-опис природи за власним спостереже...
 
Autenticación remota y servicios de directorio. LDAP y Kerberos
Autenticación remota y servicios de directorio. LDAP y KerberosAutenticación remota y servicios de directorio. LDAP y Kerberos
Autenticación remota y servicios de directorio. LDAP y Kerberos
 
дидактичний матер ал мартиненко н.м.
дидактичний матер ал мартиненко н.м.дидактичний матер ал мартиненко н.м.
дидактичний матер ал мартиненко н.м.
 
Презентація Бази даних Урок 1.pptx
Презентація Бази даних Урок 1.pptxПрезентація Бази даних Урок 1.pptx
Презентація Бази даних Урок 1.pptx
 
Підручник з біології для 7 класу Шабанов
Підручник з біології для 7 класу ШабановПідручник з біології для 7 класу Шабанов
Підручник з біології для 7 класу Шабанов
 
вересовий мед
вересовий медвересовий мед
вересовий мед
 
мопассан пампушка
мопассан пампушкамопассан пампушка
мопассан пампушка
 
Hoarding power point presentation
Hoarding power point presentationHoarding power point presentation
Hoarding power point presentation
 
Abnormal psychology 1b
Abnormal psychology 1bAbnormal psychology 1b
Abnormal psychology 1b
 
Verdi
VerdiVerdi
Verdi
 

Ähnlich wie State Machines and Symfony Workflow

Introduction to State Machines
Introduction to State MachinesIntroduction to State Machines
Introduction to State Machinescodeofficer
 
Improving your workflow with git
Improving your workflow with gitImproving your workflow with git
Improving your workflow with gitDídac Ríos
 
Golangにおける端末制御 リッチなターミナルUIの実現方法
Golangにおける端末制御 リッチなターミナルUIの実現方法Golangにおける端末制御 リッチなターミナルUIの実現方法
Golangにおける端末制御 リッチなターミナルUIの実現方法Masashi Shibata
 
Svn to-git
Svn to-gitSvn to-git
Svn to-gitjwausle
 
Getting Started with Git
Getting Started with GitGetting Started with Git
Getting Started with GitRick Umali
 
How to use git from vim @vim conf2013
How to use git from vim @vim conf2013How to use git from vim @vim conf2013
How to use git from vim @vim conf2013cohama
 

Ähnlich wie State Machines and Symfony Workflow (11)

Introduction to State Machines
Introduction to State MachinesIntroduction to State Machines
Introduction to State Machines
 
Improving your workflow with git
Improving your workflow with gitImproving your workflow with git
Improving your workflow with git
 
Golangにおける端末制御 リッチなターミナルUIの実現方法
Golangにおける端末制御 リッチなターミナルUIの実現方法Golangにおける端末制御 リッチなターミナルUIの実現方法
Golangにおける端末制御 リッチなターミナルUIの実現方法
 
Svn to-git
Svn to-gitSvn to-git
Svn to-git
 
Grokking opensource with github
Grokking opensource with githubGrokking opensource with github
Grokking opensource with github
 
Metrics with Ganglia
Metrics with GangliaMetrics with Ganglia
Metrics with Ganglia
 
Getting Started with Git
Getting Started with GitGetting Started with Git
Getting Started with Git
 
How to use git from vim @vim conf2013
How to use git from vim @vim conf2013How to use git from vim @vim conf2013
How to use git from vim @vim conf2013
 
ch6_EN_BK_syn1.pdf
ch6_EN_BK_syn1.pdfch6_EN_BK_syn1.pdf
ch6_EN_BK_syn1.pdf
 
Git presentation
Git presentationGit presentation
Git presentation
 
Git & GitHub
Git & GitHubGit & GitHub
Git & GitHub
 

Kürzlich hochgeladen

chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
software engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxsoftware engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxnada99848
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 

Kürzlich hochgeladen (20)

chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
software engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxsoftware engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptx
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 

State Machines and Symfony Workflow