Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
What Do You Know: StateCharts
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
geoffreyd
February 28, 2012
Programming
1
160
What Do You Know: StateCharts
Presentation for the WebDirections What Do You Know night.
geoffreyd
February 28, 2012
Tweet
Share
Other Decks in Programming
See All in Programming
なぜSQLはAIぽく見えるのか/why does SQL look AI like
florets1
0
470
FOSDEM 2026: STUNMESH-go: Building P2P WireGuard Mesh Without Self-Hosted Infrastructure
tjjh89017
0
170
AI巻き込み型コードレビューのススメ
nealle
2
400
AI時代の認知負荷との向き合い方
optfit
0
160
AIと一緒にレガシーに向き合ってみた
nyafunta9858
0
240
AI時代のキャリアプラン「技術の引力」からの脱出と「問い」へのいざない / tech-gravity
minodriven
21
7.3k
20260127_試行錯誤の結晶を1冊に。著者が解説 先輩データサイエンティストからの指南書 / author's_commentary_ds_instructions_guide
nash_efp
1
980
AIで開発はどれくらい加速したのか?AIエージェントによるコード生成を、現場の評価と研究開発の評価の両面からdeep diveしてみる
daisuketakeda
1
2.5k
LLM Observabilityによる 対話型音声AIアプリケーションの安定運用
gekko0114
2
430
コントリビューターによるDenoのすゝめ / Deno Recommendations by a Contributor
petamoriken
0
200
AI Schema Enrichment for your Oracle AI Database
thatjeffsmith
0
300
プロダクトオーナーから見たSOC2 _SOC2ゆるミートアップ#2
kekekenta
0
220
Featured
See All Featured
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
3.9k
It's Worth the Effort
3n
188
29k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7k
WENDY [Excerpt]
tessaabrams
9
36k
New Earth Scene 8
popppiees
1
1.5k
Mobile First: as difficult as doing things right
swwweet
225
10k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
1
440
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
54
Abbi's Birthday
coloredviolet
1
4.8k
Balancing Empowerment & Direction
lara
5
890
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
310
Technical Leadership for Architectural Decision Making
baasie
1
250
Transcript
Simplify your Events Geoffrey Donaldson @geoffreyd
So you’re building an App?
The Cool Cats Say • Design: MVC, MVVM, MVP •
Framework: Backbone, Batman, Sammy, SproutCore, JavascriptMVC ... • Templates: Handlebars, Moustache, Jade, Plain old HTML ...
View View Controller Model
View View Controller Model
View View Controller Model
Data View Controller Model
Data View Controller Model
Events ? View Controller Model
Events ? View Controller Model
Events ? View Controller Model
Errrr
Events ? View Controller Model
Events ? View Controller Model
Which One? Views User Controller Models Contact Controller Client Controller
Booking Controller Login Controller
StateCharts Logic Controllers for your App Login (Is NOT logged
in) CHECK AUTHORIZATION endLogin Show Login Running (Is Logged in) beginLogin
Which One? Views Models User Controller Contact Controller Client Controller
Booking Controller Login Controller
StateCharts - Logic Controllers Views User Controller Models Contact Controller
Client Controller Booking Controller Login Controller StateChart
Data Goes to Views Views User Controller Models Contact Controller
Client Controller Booking Controller Login Controller StateChart
Events Goes to StateChart Views User Controller Models Contact Controller
Client Controller Booking Controller Login Controller StateChart
StateChart Respond to Events Views User Controller Models Contact Controller
Client Controller Booking Controller Login Controller StateChart
Responsible for View Setup Views User Controller Models Contact Controller
Client Controller Booking Controller Login Controller StateChart
So How does it work? Show me already!!
Login (Is NOT logged in) CHECK AUTHORIZATION endLogin Show Login
Running (Is Logged in) beginLogin
Login (Is NOT logged in) CHECK AUTHORIZATION endLogin Show Login
Running (Is Logged in) beginLogin statechart.addState({ parentState: “App”, name: “login”, initialSubState: “checkAuthorization” })
statechart.addState({ name: “checkAuthorization”, parentState: “login”, enterState: function() { if (userLoggedIn())
{ this.goToState(“Running”) } else { this.goToState(“ShowLogin”) } } }) Login (Is NOT logged in) CHECK AUTHORIZATION endLogin Show Login Running (Is Logged in) beginLogin
statechart.addState({ name: “showLogin”, parentState: “login”, enterState: function() { // Show
Login View }, exitState: function() { // Hide Login View }, beginLogin: function() { // Send data to server }, endLogin: function() { // Receive response, Then go to Running State } }) Login (Is NOT logged in) CHECK AUTHORIZATION endLogin Show Login Running (Is Logged in) beginLogin
statechart.addState({ name: “Running”, parentState: “App”, enterState: function() { // Show
App Views }, exitState: function() { // Hide App Views } }) Login (Is NOT logged in) CHECK AUTHORIZATION endLogin Show Login Running (Is Logged in) beginLogin
Login (Is NOT logged in) CHECK AUTHORIZATION endLogin Show Login
Running (Is Logged in) beginLogin Testing
Login (Is NOT logged in) CHECK AUTHORIZATION endLogin Show Login
Running (Is Logged in) beginLogin Testing Pass 1 Logged Out, Successful response
Login (Is NOT logged in) CHECK AUTHORIZATION endLogin Show Login
Running (Is Logged in) beginLogin Pass 1 Logged Out, Successful response Pass 2 Logged Out, Failed response Testing
Login (Is NOT logged in) CHECK AUTHORIZATION endLogin Show Login
Running (Is Logged in) beginLogin Pass 1 Logged Out, Successful response Pass 2 Logged Out, Failed response Pass 3 Already Logged In Testing
Login (Is NOT logged in) CHECK AUTHORIZATION endLogin Show Login
Running (Is Logged in) beginLogin Pass 1 Logged Out, Successful response Pass 2 Logged Out, Failed response Pass 3 Already Logged In Testing DONE!
StateCharts • Put your App logic in the right place
• Each State is responsible for it’s visual state • Separate concerns • Easy to Test
StateCharts You to can use them github.com/etgryphon/stativus