SlideShare a Scribd company logo
Automata Based Programming
Muhammad Hammad
Ali Shahzad
Theory of Automata
11.5.2015
Introduction
• The idea comes from automata theory.
• Automata-programming doesn’t mean
programming with the use of automata, but the
entire programming paradigm and programming
technology is aimed for designing system with
complex behavior
• The approach is being developed since 1991.
• To put it simple, the approach proposes to describe
the behavior of program using automata which are
later converted into code.
Automata-Based Programming As a
Programming Paradigm
• We normally use two types of programming
paradigm : Traditional(Imperitive) , Procedural
• Traditional Imperative program in C :
#include<stdio.h>
int main(void) { c = getchar();
int c; }
do { putchar(‘n’);
c = getchar(); while(c != EOF && c != ‘n’ )
while (c == ‘ ‘) { c = getchar();
c = getchar(); } while ( c != EOF);
while (c != EOF && c ! = ‘ ‘ c != ‘n’) { return 0;
putchar(c); }
AUTOMATA BASED STYLE PROGRAM
Int main(void) {
enum states { case inside:
before,inside,after if (c == ‘ ‘) {
} state; state = after;
int c; } else {
state = before; putchar(c);
while(c = getchar() ! = EOF){ }
if ( c == ‘n’) {
state = before; break;
} else case after;
switch(state) { break;
case before; }
if (c != ‘ ‘) { return 0;
putchar(c); }
state = inside;
break;
}
FSM(Model)
ADVANTAGES
• In automata based programming we propose that each must
not contain only user manual but the project documentation
including relation diagrams and transition graphs for each
manual.
• The manually designed automata is transformed into code
manually or automatically which works right away and needs
minimal debugging.
• As the logic is represented in the visual form instead of usual
text form, making fixes is simpler and it is much easier to
understand the logic for people other than the author.
• Besides that thinking in automata is necessary for event-driven
programming as the only alternative to using parallel
processes or threads.
FSM as program
Event
Controller
=
Finite
State
Machines
Controlled object
Event
Event Controlled object
Controlled object
Example. Traffic Lights
Red
Green
Yellow
Blinking
green
Red
+
yellow
Source code. Controlled object
public class TrafficLight implements ControlledObject {
public void red(StateMachineContext context) {
System.out.println("Red");
}
public void green(StateMachineContext context) {
System.out.println("Green");
}
public void yellow(StateMachineContext context) {
System.out.println("Yellow");
}
public void greenblink(StateMachineContext context) {
System.out.println("Green Blinking");
}
public void redyellow(StateMachineContext context) {
System.out.println("red yellow");
}
}
FSM
Source code. Controller
switch (s) {
case green:
switch (event) {
case next tick:
if (counter_x4 < 20) {
make transition to state “blinking green”;
return new StateMachineConfig("blinking green");
}
if (counter_x4 >= 20) {
make transition to final state;
return new StateMachineConfig(" final state ");
}
…
}
Switch technology
Conclusions
• Modeling system
• Modeling=writing the code
• Step-by-step
• Easier to verify
• Good for modeling reactive systems
Refrences
• http://en.wikipedia.org/wiki/Finite-state_machine
• http://is.ifmo.ru/automata_en/_tech_aut_prog.p
• http://en.wikipedia.org/wiki/Automata-
based_programming

More Related Content

What's hot

Introduction to computer architecture and organization
Introduction to computer architecture and organizationIntroduction to computer architecture and organization
Introduction to computer architecture and organization
Muhammad Ishaq
 
Human Computer Interaction HCI
Human Computer Interaction HCI Human Computer Interaction HCI
Human Computer Interaction HCI
Gaditek
 
Introduction to Computer Programming
Introduction to Computer ProgrammingIntroduction to Computer Programming
Introduction to Computer Programming
Prof. Erwin Globio
 
Socio organizational issues ppt
Socio organizational issues pptSocio organizational issues ppt
Socio organizational issues ppt
tamizh arthanari
 
2's complement
2's complement2's complement
2's complement
Arvenz Gavino
 
Human computer interaction
Human  computer interactionHuman  computer interaction
Human computer interaction
Ayusha Patnaik
 
HCI 3e - Ch 12: Cognitive models
HCI 3e - Ch 12:  Cognitive modelsHCI 3e - Ch 12:  Cognitive models
HCI 3e - Ch 12: Cognitive models
Alan Dix
 
Algorithms Lecture 3: Analysis of Algorithms II
Algorithms Lecture 3: Analysis of Algorithms IIAlgorithms Lecture 3: Analysis of Algorithms II
Algorithms Lecture 3: Analysis of Algorithms II
Mohamed Loey
 
Sequence diagram for employee management system(EMS)
Sequence diagram for employee management system(EMS)Sequence diagram for employee management system(EMS)
Sequence diagram for employee management system(EMS)
Achal (अचल) Porwal
 
Jumps in Assembly Language.
Jumps in Assembly Language.Jumps in Assembly Language.
Jumps in Assembly Language.
NA000000
 
IGNOU Assembly Language Programming
IGNOU Assembly Language ProgrammingIGNOU Assembly Language Programming
IGNOU Assembly Language Programming
Dr. Loganathan R
 
Compiler design lab programs
Compiler design lab programs Compiler design lab programs
Compiler design lab programs
Guru Janbheshver University, Hisar
 
interaction norman model in Human Computer Interaction(HCI)
interaction  norman model in Human Computer Interaction(HCI)interaction  norman model in Human Computer Interaction(HCI)
interaction norman model in Human Computer Interaction(HCI)
Daroko blog(www.professionalbloggertricks.com)
 
Lecture 3 RE NFA DFA
Lecture 3   RE NFA DFA Lecture 3   RE NFA DFA
Lecture 3 RE NFA DFA
Rebaz Najeeb
 
HCI
HCI HCI
Employee Management System
Employee Management SystemEmployee Management System
Employee Management System
Anjali Agrawal
 
54039271 atm-project-report
54039271 atm-project-report54039271 atm-project-report
54039271 atm-project-report
Kalpana Reddy
 
Computer architecture control unit
Computer architecture control unitComputer architecture control unit
Computer architecture control unit
Mazin Alwaaly
 
College Management System project
College Management System projectCollege Management System project
College Management System project
Manish Kushwaha
 
AOA Handwritten Notes'.pdf
AOA Handwritten Notes'.pdfAOA Handwritten Notes'.pdf
AOA Handwritten Notes'.pdf
dhzhnz
 

What's hot (20)

Introduction to computer architecture and organization
Introduction to computer architecture and organizationIntroduction to computer architecture and organization
Introduction to computer architecture and organization
 
Human Computer Interaction HCI
Human Computer Interaction HCI Human Computer Interaction HCI
Human Computer Interaction HCI
 
Introduction to Computer Programming
Introduction to Computer ProgrammingIntroduction to Computer Programming
Introduction to Computer Programming
 
Socio organizational issues ppt
Socio organizational issues pptSocio organizational issues ppt
Socio organizational issues ppt
 
2's complement
2's complement2's complement
2's complement
 
Human computer interaction
Human  computer interactionHuman  computer interaction
Human computer interaction
 
HCI 3e - Ch 12: Cognitive models
HCI 3e - Ch 12:  Cognitive modelsHCI 3e - Ch 12:  Cognitive models
HCI 3e - Ch 12: Cognitive models
 
Algorithms Lecture 3: Analysis of Algorithms II
Algorithms Lecture 3: Analysis of Algorithms IIAlgorithms Lecture 3: Analysis of Algorithms II
Algorithms Lecture 3: Analysis of Algorithms II
 
Sequence diagram for employee management system(EMS)
Sequence diagram for employee management system(EMS)Sequence diagram for employee management system(EMS)
Sequence diagram for employee management system(EMS)
 
Jumps in Assembly Language.
Jumps in Assembly Language.Jumps in Assembly Language.
Jumps in Assembly Language.
 
IGNOU Assembly Language Programming
IGNOU Assembly Language ProgrammingIGNOU Assembly Language Programming
IGNOU Assembly Language Programming
 
Compiler design lab programs
Compiler design lab programs Compiler design lab programs
Compiler design lab programs
 
interaction norman model in Human Computer Interaction(HCI)
interaction  norman model in Human Computer Interaction(HCI)interaction  norman model in Human Computer Interaction(HCI)
interaction norman model in Human Computer Interaction(HCI)
 
Lecture 3 RE NFA DFA
Lecture 3   RE NFA DFA Lecture 3   RE NFA DFA
Lecture 3 RE NFA DFA
 
HCI
HCI HCI
HCI
 
Employee Management System
Employee Management SystemEmployee Management System
Employee Management System
 
54039271 atm-project-report
54039271 atm-project-report54039271 atm-project-report
54039271 atm-project-report
 
Computer architecture control unit
Computer architecture control unitComputer architecture control unit
Computer architecture control unit
 
College Management System project
College Management System projectCollege Management System project
College Management System project
 
AOA Handwritten Notes'.pdf
AOA Handwritten Notes'.pdfAOA Handwritten Notes'.pdf
AOA Handwritten Notes'.pdf
 

Similar to Automata based-programming

OOPS using C++
OOPS using C++OOPS using C++
More about PHP
More about PHPMore about PHP
More about PHP
Jonathan Francis Roscoe
 
Introduction Of C++
Introduction Of C++Introduction Of C++
Introduction Of C++
Sangharsh agarwal
 
Automata based programming
Automata based programmingAutomata based programming
Automata based programming
M Reza Rahmati
 
Week10 final
Week10 finalWeek10 final
Week10 final
Irfan Ali Memon
 
Monolithic and Procedural Programming
Monolithic and Procedural ProgrammingMonolithic and Procedural Programming
Monolithic and Procedural Programming
Deepam Aggarwal
 
Rseminarp
RseminarpRseminarp
Slicing of Object-Oriented Programs
Slicing of Object-Oriented ProgramsSlicing of Object-Oriented Programs
Slicing of Object-Oriented Programs
Praveen Penumathsa
 
Introduction to Algorithms Complexity Analysis
Introduction to Algorithms Complexity Analysis Introduction to Algorithms Complexity Analysis
Introduction to Algorithms Complexity Analysis
Dr. Pankaj Agarwal
 
C program execution and algorithm
C program execution and algorithm C program execution and algorithm
C program execution and algorithm
Kunal Pandhram
 
Fda unit 1 lec 1
Fda unit 1 lec  1Fda unit 1 lec  1
Fda unit 1 lec 1
Eugin Britto
 
Algorithm Analysis.pdf
Algorithm Analysis.pdfAlgorithm Analysis.pdf
Algorithm Analysis.pdf
NayanChandak1
 
C language introduction geeksfor geeks
C language introduction   geeksfor geeksC language introduction   geeksfor geeks
C language introduction geeksfor geeks
AashutoshChhedavi
 
Lab report 201001067_201001104
Lab report 201001067_201001104Lab report 201001067_201001104
Lab report 201001067_201001104
swena_gupta
 
Lab report 201001067_201001104
Lab report 201001067_201001104Lab report 201001067_201001104
Lab report 201001067_201001104
swena_gupta
 
Lab report 201001067_201001104
Lab report 201001067_201001104Lab report 201001067_201001104
Lab report 201001067_201001104
swena_gupta
 
CP Handout#2
CP Handout#2CP Handout#2
CP Handout#2
trupti1976
 
Programming Fundamentals Functions in C and types
Programming Fundamentals  Functions in C  and typesProgramming Fundamentals  Functions in C  and types
Programming Fundamentals Functions in C and types
imtiazalijoono
 
Chapter 1-INTRO TO PF.pptx
Chapter 1-INTRO TO PF.pptxChapter 1-INTRO TO PF.pptx
Chapter 1-INTRO TO PF.pptx
SitiZaharahSidek
 
C programming session9 -
C programming  session9 -C programming  session9 -
C programming session9 -
Keroles karam khalil
 

Similar to Automata based-programming (20)

OOPS using C++
OOPS using C++OOPS using C++
OOPS using C++
 
More about PHP
More about PHPMore about PHP
More about PHP
 
Introduction Of C++
Introduction Of C++Introduction Of C++
Introduction Of C++
 
Automata based programming
Automata based programmingAutomata based programming
Automata based programming
 
Week10 final
Week10 finalWeek10 final
Week10 final
 
Monolithic and Procedural Programming
Monolithic and Procedural ProgrammingMonolithic and Procedural Programming
Monolithic and Procedural Programming
 
Rseminarp
RseminarpRseminarp
Rseminarp
 
Slicing of Object-Oriented Programs
Slicing of Object-Oriented ProgramsSlicing of Object-Oriented Programs
Slicing of Object-Oriented Programs
 
Introduction to Algorithms Complexity Analysis
Introduction to Algorithms Complexity Analysis Introduction to Algorithms Complexity Analysis
Introduction to Algorithms Complexity Analysis
 
C program execution and algorithm
C program execution and algorithm C program execution and algorithm
C program execution and algorithm
 
Fda unit 1 lec 1
Fda unit 1 lec  1Fda unit 1 lec  1
Fda unit 1 lec 1
 
Algorithm Analysis.pdf
Algorithm Analysis.pdfAlgorithm Analysis.pdf
Algorithm Analysis.pdf
 
C language introduction geeksfor geeks
C language introduction   geeksfor geeksC language introduction   geeksfor geeks
C language introduction geeksfor geeks
 
Lab report 201001067_201001104
Lab report 201001067_201001104Lab report 201001067_201001104
Lab report 201001067_201001104
 
Lab report 201001067_201001104
Lab report 201001067_201001104Lab report 201001067_201001104
Lab report 201001067_201001104
 
Lab report 201001067_201001104
Lab report 201001067_201001104Lab report 201001067_201001104
Lab report 201001067_201001104
 
CP Handout#2
CP Handout#2CP Handout#2
CP Handout#2
 
Programming Fundamentals Functions in C and types
Programming Fundamentals  Functions in C  and typesProgramming Fundamentals  Functions in C  and types
Programming Fundamentals Functions in C and types
 
Chapter 1-INTRO TO PF.pptx
Chapter 1-INTRO TO PF.pptxChapter 1-INTRO TO PF.pptx
Chapter 1-INTRO TO PF.pptx
 
C programming session9 -
C programming  session9 -C programming  session9 -
C programming session9 -
 

Recently uploaded

Stack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 MicroprocessorStack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 Microprocessor
JomonJoseph58
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
MJDuyan
 
Nutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour TrainingNutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour Training
melliereed
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
Himanshu Rai
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
haiqairshad
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
EduSkills OECD
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
iammrhaywood
 
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptxRESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
zuzanka
 
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdfREASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
giancarloi8888
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
Celine George
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
National Information Standards Organization (NISO)
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
RAHUL
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
Krassimira Luka
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
MysoreMuleSoftMeetup
 

Recently uploaded (20)

Stack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 MicroprocessorStack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 Microprocessor
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
 
Nutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour TrainingNutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour Training
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
 
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptxRESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
 
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdfREASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
 

Automata based-programming

  • 1. Automata Based Programming Muhammad Hammad Ali Shahzad Theory of Automata 11.5.2015
  • 2. Introduction • The idea comes from automata theory. • Automata-programming doesn’t mean programming with the use of automata, but the entire programming paradigm and programming technology is aimed for designing system with complex behavior • The approach is being developed since 1991. • To put it simple, the approach proposes to describe the behavior of program using automata which are later converted into code.
  • 3. Automata-Based Programming As a Programming Paradigm • We normally use two types of programming paradigm : Traditional(Imperitive) , Procedural • Traditional Imperative program in C : #include<stdio.h> int main(void) { c = getchar(); int c; } do { putchar(‘n’); c = getchar(); while(c != EOF && c != ‘n’ ) while (c == ‘ ‘) { c = getchar(); c = getchar(); } while ( c != EOF); while (c != EOF && c ! = ‘ ‘ c != ‘n’) { return 0; putchar(c); }
  • 4. AUTOMATA BASED STYLE PROGRAM Int main(void) { enum states { case inside: before,inside,after if (c == ‘ ‘) { } state; state = after; int c; } else { state = before; putchar(c); while(c = getchar() ! = EOF){ } if ( c == ‘n’) { state = before; break; } else case after; switch(state) { break; case before; } if (c != ‘ ‘) { return 0; putchar(c); } state = inside; break; }
  • 6. ADVANTAGES • In automata based programming we propose that each must not contain only user manual but the project documentation including relation diagrams and transition graphs for each manual. • The manually designed automata is transformed into code manually or automatically which works right away and needs minimal debugging. • As the logic is represented in the visual form instead of usual text form, making fixes is simpler and it is much easier to understand the logic for people other than the author. • Besides that thinking in automata is necessary for event-driven programming as the only alternative to using parallel processes or threads.
  • 7. FSM as program Event Controller = Finite State Machines Controlled object Event Event Controlled object Controlled object
  • 9. Source code. Controlled object public class TrafficLight implements ControlledObject { public void red(StateMachineContext context) { System.out.println("Red"); } public void green(StateMachineContext context) { System.out.println("Green"); } public void yellow(StateMachineContext context) { System.out.println("Yellow"); } public void greenblink(StateMachineContext context) { System.out.println("Green Blinking"); } public void redyellow(StateMachineContext context) { System.out.println("red yellow"); } }
  • 10. FSM
  • 11. Source code. Controller switch (s) { case green: switch (event) { case next tick: if (counter_x4 < 20) { make transition to state “blinking green”; return new StateMachineConfig("blinking green"); } if (counter_x4 >= 20) { make transition to final state; return new StateMachineConfig(" final state "); } … } Switch technology
  • 12. Conclusions • Modeling system • Modeling=writing the code • Step-by-step • Easier to verify • Good for modeling reactive systems