Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Nieder mit dem Spaghetti Code durch Statemachines
Search
Nicolas Byl
April 25, 2018
Technology
170
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Nieder mit dem Spaghetti Code durch Statemachines
Nicolas Byl
April 25, 2018
More Decks by Nicolas Byl
See All by Nicolas Byl
Platform Engineering ❤️ Developer Experience
nbyl
0
71
Die Flucht aus der Prototypen-Hölle
nbyl
0
65
Lean Prototyping for Industrial-IoT Projects
nbyl
0
87
DevSecOps - Vom Unikum zur gut geölten Maschine
nbyl
0
130
Securing your software supply chain
nbyl
0
410
Keeping-Up-WithUpstream.pdf
nbyl
0
200
Dr. Kube und der Helm - Anatomie einer CD-Pipeline
nbyl
0
160
Securing the "other" supply chain
nbyl
0
350
Kubernetes - Auf die Cluster, Fertig, Los!
nbyl
0
230
Other Decks in Technology
See All in Technology
AI駆動で「他アプリの音を加工できる」アプリを作った
satomasahiro2005
0
190
Rust で関数型ドメインモデリング
takonda
0
180
局所最適は悪ではない。壊れているのは指標です。量と質を同時に見る先行指標の設計
recruitengineers
PRO
2
200
Browser Spec: Testing Hotwire with Ruby
takahashim
1
150
Active Record Connection Adaptersにおける長年の課題に再び取り組む
yahonda
0
390
LLM Content Moderationを支える評価・改善ループの実践
suikabar
2
260
AIにシークレットを見せない、WSL2で安全な開発環境
yazm
0
330
アウトプット初心者、半年間のふりかえり
4o1sobblue
0
460
sue445's proposals 2026
sue445
0
120
AI時代のGraphQL
joere
1
290
ソフトウェア ファクトリー - 再現性のあるソフトウェアの工場づくり / Software factory
iktakahiro
7
5.2k
CTO Night|NotionのAIエージェントとFDE
kzkhykw1991
0
300
Featured
See All Featured
Mind Mapping
helmedeiros
1
400
Ethics towards AI in product and experience design
skipperchong
2
440
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Paper Plane (Part 1)
katiecoart
PRO
2
12k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
570
Practical Orchestrator
shlominoach
192
12k
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
120
120k
Bash Introduction
62gerente
615
220k
WCS-LA-2024
lcolladotor
0
900
Designing Powerful Visuals for Engaging Learning
tmiket
1
610
A Soul's Torment
seathinner
8
3.8k
Fashionably flexible responsive web design (full day workshop)
malarkey
409
67k
Transcript
1 NIEDER MIT DEM SPAGHETTI CODE DURCH STATEMACHINES JAX 2018
Nicolas Byl, codecentric AG
2 . 1 EINLEITUNG
None
2 . 2
2 . 3 2 . 4 Wer hat bereits eine
State Machine implementiert?
if (order.getState() == State.COMMISSIONED) { order.setState(State.SHIPPED); order.save(); }
2 . 5 2 . 6 Nochmal: Wer hat bereits
eine State Machine implementiert?
3 . 1 STATE MACHINES
3 . 2 Ein Beispiel Downloading docker pull Blocked docker
create Image is pulled Dependencies satisfied Pending Starting docker start Ready Throttling policy LivenessProbe reports its first OK Failed Time-out
3 . 3 Zustandsänderungen
3 . 4 DISTRIBUTED BALL OF MUD https://commons.wikimedia.org/wiki/File:Taylor%27s_Dorodango_cropped.jpg
3 . 5 Zustandsänderungen konzentrieren
4 . 1 SPRING STATE MACHINES
4 . 2 Spring State Machines State Machine Library Spring
Integration Event-basiert
4 . 3 Integration <dependencies> <dependency> <groupId>org.springframework.statemachine</groupId> <artifactId>spring-statemachine-core</artifactId> <version>1.2.8.RELEASE</version> </dependency>
</dependencies>
4 . 4 Konfiguration @Configuration @EnableStateMachine public class StateMachineConfig extends
EnumStateMachineConfigurerAda @Override public void configure(StateMachineStateConfigurer<CheckStatus, Ch states .withStates() .initial(CheckStatus.Initializing) .states(EnumSet.allOf(CheckStatus.class)); }
4 . 5 Konfiguration (2) @Override public void configure(StateMachineTransitionConfigurer<CheckStatu transitions
.withExternal() .source(CheckStatus.Initializing).target(CheckStatus. .and() .withExternal() .source(CheckStatus.Initializing).target(CheckStatus. .and() [...]; } }
4 . 6 Events auslösen stateMachine.sendEvent(CheckEvents.succeeded);
4 . 7 Zustandsänderungen überwachen @WithStateMachine static class MyBean {
@OnTransition(target = CheckStatus.Operational) void enteredOperational() { } @OnStateChanged public void checkStatusChanged(StateContext<CheckStatus, CheckEve } }
5 . 1 DEMO TIME
5 . 2 Monitoring Demo Monitoring von lokalen Dateien Alarmierung
wenn zwei Checks in Folge fehlschlagen
5 . 3 State Machine
5 . 4 Demo Project https://github.com/nbyl/spring-state-machine-demo
6 . 1 SPRING STATE MACHINE
6 . 2 Advanced Features Verteilte State Machines mittels Zookeeper
Scoping Security State Persistence
7 . 1 THE END Copyright 2018