#WISSENTEILEN
„Lightweight“-Architectures
Lars Röwekamp | CIO New Technologies | @mobileLarson
open knowledge | #WISSENTEILEN
ÜBER OPEN KNOWLEDGE
Branchenneutrale Softwareentwicklung und IT-Beratung
#WISSENTEILEN
ÜBER MICH
Wer bin ich - und wen ja, wie viele?
• CIO New Technologies
• Enterprise & Mobile
• Autor, Speaker, Coach & Mentor
• Snowboard & MTB Enthusiast
• mehrfacher Vater, einfacher Ehemann
Lars Röwekamp (a.k.a. @mobileLarson)
#WISSENTEILEN
LR
#WISSENTEILEN
Lightweight-Architecture!
Ok, aber warum?
Motivation
An Era of „Mindshift“
„The expectation that I can get what i want in
my immediate context and moments of need!“
Mindshift
„Mindshift“ in ...
Verhalten, Erwartungen, Kontrolle
#WISSENTEILEN
„Where do
you use the
following
devices in a
typical week?“
Motivation
(Quelle: Mobile Mindshift Online Survey USA)
„We DO new Things.“
“We EXPEXT new Things.“
NOW!
#WISSENTEILEN
Motivation
Die Multi-Channel Challenge
#WISSENTEILEN
„Multi-Channel, na klar!
Wo liegt das Problem?“
Motivation
#WISSENTEILEN
Multi-Channel
Responsive Design
#WISSENTEILEN
Multi-Channel
„Geht das
mit unserem
klassischen
Backend?“
#WISSENTEILEN
Multi-Channel
„Geht das
mit unserem
klassischen
Backend?“
„Ja klar geht
das, aber ...“
#WISSENTEILEN
Multi-Channel
„Geht das
mit unserem
klassischen
Backend?“
„Ja klar geht
das, aber ...“
#WISSENTEILEN
Multi-Channel
Old Channel
#WISSENTEILEN
Multi-Channel
Old Channel New Channel
#WISSENTEILEN
Multi-Channel
Old Channel New Channel
#WISSENTEILEN
Multi-ChannelOmni___
#WISSENTEILEN
Multi-Channel
#WISSENTEILEN
Multi-Channel
Cross-Channel Omni-Channel
vs.
#WISSENTEILEN
Multi-Channel
Hmmm, kind of Fail?
Omni___
#WISSENTEILEN
Multi-Channel
„Bros, not Twins!“
Omni___
#WISSENTEILEN
„One single
MONOLITH
to rule them all!“
vs.
„Time to Market“
Multi-ChannelOmni___
#WISSENTEILEN
A responsive Monolith
is still a Monolith!
Monolith
• Umsetzung von Features dauert zu lange
• Architektur-Qualität nimmt ab (an Bedeutung)
• Qualität verwässert
• Technologische „Schulden“ sind bekannt
• „-ility“ Probleme wohin man schaut
• Deplyoment ist kompliziert und dauert lang
• Skalierung hat Limit erreicht
• Replacement/Refactoring ist zu teuer
Omni-Channel Architecture
#WISSENTEILEN
#WISSENTEILEN
Multiple Clients?
Lightweight Architecture
#WISSENTEILEN
Repetitive Now?
Lightweight Architecture
#WISSENTEILEN
Business Flexibility?
Lightweight Architecture
#WISSENTEILEN
You want to be here!
Lightweight Architecture
#WISSENTEILEN
Time-to-Market?
Lightweight Architecture
#WISSENTEILEN
Flexibles Provisioning?
Lightweight Architecture
#WISSENTEILEN
Lightweight Architecture
NoOps?
#WISSENTEILEN
Lightweight Architecture
#WISSENTEILEN
ArchitekturOh, my god!
What have we done?
Microservices!
PaaS, BaaS & FaaS!
Yeah, all Work done!
Really? All Work done!
#WISSENTEILEN
Lightweight Architecture
Migration Steps:
• Resources statt Views
• Push statt Pull
• Domain Services
• Modularization
• PaaS & Cloud
• BaaS & FaaS
#WISSENTEILEN
ArchitekturHighly
Distributed
System
#WISSENTEILEN
Lightweight Architecture
Versionierung
Error Handling
Caching & Sync
Analytics
Security
Versionierung
Error Handling
Analytics
(Web) Security
Caching & Sync
Versionierung
• Client/Server entwickeln sich unterschiedlich
• Request /Response passen nicht zueinander
• Fehlende/unbekannte Request Attribute
• Fehlende/unbekannte Response Attribute
• Geänderte Semantik von Attributen
• Geänderte Semantik von Defaults
Lightweight Architecture
#WISSENTEILEN
Versionierung
Best Practices strategisch
• so lang wie möglich verhindern
• enge Koppelung vermeiden
• Consumer-Driven Contracts
• Semantic Versioning (Major.Minor.Patch)
• Koexistenz verschiedener Endpoints
• konkurrierende Service Versionen
Lightweight Architecture
#WISSENTEILEN
Versionierung
Koexistenz von Endpoints
Versionierung
Koexistenz von Endpoints
Versionierung
Koexistenz von Endpoints
Versionierung
Konkurrierende Service Versionen
Versionierung
Konkurrierende Service Versionen
Versionierung
Konkurrierende Service Versionen
Versionierung
Best Practices technisch
• gar nicht
• gar nicht (via neue Ressourcen)
• gar nicht (via erweiterbarer Datenformate)
• Versionsnummer in der URL
• Version Request Header
• Content Negotiation
Lightweight Architecture
#WISSENTEILEN
Versionierung
Lightweight Architecture
#WISSENTEILEN
// Versioning via adaptable data format
{ "items" : [ {
"name" : "coffee",
"quantity" : 1,
"milk" : "semi",
"size" : "large",
} ],
"location" : ”take-away"
}
Versionierung
Lightweight Architecture
#WISSENTEILEN
// Versioning via adaptable data format
{ ”items" : [ {
"name" : "coffee",
"quantity" : 1,
"milk" : "semi",
"size" : "large",
"price" : "4.00 USD"
} ],
"location" : "take-away"
}
Versionierung
Lightweight Architecture
#WISSENTEILEN
// Versioning via adaptable data format
{ ”items" : [ {
"name" : "coffee",
"quantity" : 1,
"milk" : "semi",
"size" : "large",
"price" : "4.00 USD"
} ],
“total-price" : "4.00 USD"
"location" : "take-away"
}
Versionierung
Lightweight Architecture
#WISSENTEILEN
// Versioning via adaptable data format
{ ”items" : [ {
"name" : "coffee",
"quantity" : 1,
"milk" : "semi",
"size" : "large",
"price" : "4.00 USD"
} ],
“price" : "4.00 USD"
"location" : "take-away"
}
„Are you a
tolerant reader?“
Versionierung
Lightweight Architecture
#WISSENTEILEN
// Versioning via URL (default version)
GET /orders/1234 HTTP/1.1
[various other headers]
// Versioning via URL (version part of path)
GET /v2/orders/1234 HTTP/1.1
[various other headers]
// Versioning via URL (as request parameter)
GET /orders/1234?ver=v2 HTTP/1.1
[various other headers]
Versionierung
Lightweight Architecture
#WISSENTEILEN
// Versioning via Header(default version)
GET /orders/1234 HTTP/1.1
// Versioning via Version Header
GET /orders/1234 HTTP/1.1
Api-version: 2.1
// Versioning via Accept Header
GET /orders/1234 HTTP/1.1
Accept: application/vnd.abc.xyz.v2.1+json
Versionierung
Lightweight Architecture
#WISSENTEILEN
„Be conservative in what you
do, be liberal in what you
accept from others.“ John Postel
Versionierung
Lightweight Architecture
#WISSENTEILEN
„REST APIs don‘t need
a versioning strategy – they
need a change strategy!“
Ben Morris
Versionierung
Error Handling
Analytics
(Web) Security
Caching & Sync
Error Handling
„Is it a bug or a feature?“
• Error Handling
• Compensation Algorithmn
Lightweight Architecture
#WISSENTEILEN
Error Handling
Status Codes - Pro Tipp: Use them!
• 1xx: Hold on ...
• 2xx: Here you go!
• 3xx: Go away!
• 4xx: You f#!?ed up!
• 5xx: I f#!?ed up!
Lightweight Architecture
#WISSENTEILEN
Error Handling
Status Codes - Pro Tipp: Use them!
• 1xx: Hold on ...
• 2xx: Here you go!
• 3xx: Go away!
• 4xx: You f#!?ed up!
• 5xx: I f#!?ed up!
Omni-Channel Architecture
#WISSENTEILEN
Lightweight Architecture
#WISSENTEILEN
// GET order with id 1234
GET /orders/1234 HTTP/1.1
[various other headers]
// Order with id 1234 is not available
HTTP/1.1. 404 Not found
Error Handling
Status
Codes
Lightweight Architecture
#WISSENTEILEN
// GET order with id 1234
GET /orders/1234 HTTP/1.1
[various other headers]
// Order with id 1234 is no more available
HTTP/1.1. 410 Gone
Error Handling
Status
Codes
Lightweight Architecture
#WISSENTEILEN
// GET order with more than 5 items
GET /orders?itemcount>=5 HTTP/1.1
[various other headers]
// No order found for this query.
// Response has no content (by purpose)
HTTP/1.1. 204 No content
Error Handling
Status
Codes
Error Handling
Manchmal kommt es anders als man denkt!
• „Code for Code“: Status Code & Appliction Level Code
• „Message for People“: Für Logs, Ausgaben, ...
• „Payload and Format“: genormte Error-Payload Format
• Kein Stacktrace
• Exception Mapper als Provider auf äußerster Ebene
Lightweight Architecture
#WISSENTEILEN
Error Handling
Compensation Algorithm
• Service not available
• Eventual Consistency
Wichtig: Fachlicher „Plan B“
Lightweight Architecture
#WISSENTEILEN
Error Handling
Compensation Algorithm
• Transactions
• Eventual Consistency
• Service not available
Multi-Channel Architecture
#WISSENTEILEN
„Starbucks does not use
Two-Phase Commit“
http://www.enterpriseintegrationpatterns.com/ramblings/18_starbucks.html
Versionierung
Error Handling
Analytics
(Web) Security
Caching & Sync
Chaching & Sync
Always remember: „The Web is your Friend“
• das Web bietet tolle Möglichkeiten
• RESTful Service nutzen das Web bzw. HTTP
Lightweight Architecture
#WISSENTEILEN
Chaching & Sync
Aber wer cached eigentlich was?
• Client (Web Browser, REST Client, ...)
• Proxy Caches („man in the middle cache“)
• Content Delivery Networks (CDNs)
Lightweight Architecture
#WISSENTEILEN
Chaching & Sync
Wie funktioniert HTTP Caching?
• Expires Header (HTTP 1.0)
• Cache-Control (HTTP 1.1)
• Revalidation & Conditional GETs
Lightweight Architecture
#WISSENTEILEN
Versionierung
Error Handling
Analytics
(Web) Security
Caching & Sync
Security
OWASP Top 10 (Open Web Application Security Project)
1. Injection
2. Broken Authentication & Session Management
3. Cross-Site Scripting (XSS)
4. Insecure Direct Object References
5. Security Misconfiguration
... 5 more to come ...
Lightweight Architecture
#WISSENTEILEN
Versionierung
Error Handling
Analytics
(Web) Security
Caching & Sync
Analytics
Wider dem Kontrollverlust: Analytics als Grundlage für
strategische Entscheidungen
• Was macht der User eigentlich?
• Und in welchem Kontext?
• Werden meine Konzepte und Daten genutzt?
• Wenn ja, wie? Wenn nein, warum nicht?
Lightweight Architecture
#WISSENTEILEN
Analytics
Monitore
• deine Ratings
• deinen Traffic
• deine UX
BTW: App ist nicht Web! Einmal deinstalliert ist immer deinstalliert.
Lightweight Architecture
#WISSENTEILEN
#WISSENTEILEN
FAZIT
Fazit
#WISSENTEILEN
Time-to Market:
„Flexibilität als Build-in Feature
der Lightweight-Architecture“
• -
Fazit
#WISSENTEILEN
Flexibilität:
„Resources statt Views“
„Events statt Request/Response“
„Domain Services statt Application“
„Modularization statt Monolith“
Fazit
#WISSENTEILEN
noch mehr Flexibilität:
„Cloud statt On-Premises“
(IaaS, PaaS, BaaS, FaaS)
Nebenwirkungen nicht
ausgeschlossen!
? ? ?
FRAGEN
#WISSENTEILEN
Kontakt
LARS RÖWEKAMP
CIO NEW TECHNOLOGIES
lars.roewekamp@openknowledge.de
+49 (0)441 4082 – 101
@mobileLarson
@_openknowledge
OFFENKUNDIGGUT
#WISSENTEILEN
Bildnachweise
#1: © Rawpixel.com - shutterstock.com
#5: © OneinchPunch - fotolia.com
#25: © Daniel Steger - openphoto.net
#35, 36: © g-stockstudio - shutterstock.com
#79: © tomertu - shutterstock.com
All other pictures inside this presentation orginate from pixabay.com.
#WISSENTEILEN

Modern Lightweight Enterprise Architectures mit Java