Software-Design
für die Seele
Michael Sperber
@sperbsen
vorbereitet mit:
Nicole Rauch
@nicolerauch
• Individualsoftware
• branchenunabhängig
• funktionale Programmierung
• Scala, Clojure, F#, Haskell, OCaml, Erlang, Elixir, Swift
• Schulungen, Coaching
www.active-group.de
funktionale-programmierung.de
bobkonf.de
Seelenloser Code
package innocent.plugin.adapter;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.ui.views.properties.IPropertySource;
import innocent.plugin.adapter.model.Todo;
public class TodoAdapterFactory implements IAdapterFactory {
@Override
public Object getAdapter(Object adaptableObject, Class adapterType) {
if (adapterType== IPropertySource.class && adaptableObject instanceof Todo){
return new TodoPropertySource((Todo) adaptableObject);
}
return null;
}
@Override
public Class[] getAdapterList() {
return new Class[] { IPropertySource.class };
}
}
Seelenloser Code
public class NativeQueryInterpreterInitiator implements SessionFactoryServiceInitiator<NativeQueryInterpreter> {
public static final NativeQueryInterpreterInitiator INSTANCE = new NativeQueryInterpreterInitiator();
@Override
public NativeQueryInterpreter initiateService(
SessionFactoryImplementor sessionFactory,
SessionFactoryOptions sessionFactoryOptions,
ServiceRegistryImplementor registry) {
return new NativeQueryInterpreterStandardImpl( sessionFactory );
}
@Override
public NativeQueryInterpreter initiateService(SessionFactoryServiceInitiatorContext context) {
return new NativeQueryInterpreterStandardImpl( context.getSessionFactory() );
}
@Override
public Class<NativeQueryInterpreter> getServiceInitiated() {
return NativeQueryInterpreter.class;
}
}
Seelenloser Code
DRecherche::DRecherche()
{
if(DIMAServerModel::iFulltext)
m_pcoImaObjectBuilder =
(DImaObjectBuilder*) new DFTRechercheBuilder;
else
m_pcoImaObjectBuilder =
(DImaObjectBuilder*) new DRechercheBuilder;
}
Seelenloser Code
void DRecherche::Expand(DData* pcoDestData, DBool bRecursive, DBool bCrossOver)
{
if(!bRecursive) {
//m_pcoData->CleanDataContainer();
if(DIMAServerModel::iFulltext)
((DFTRechercheBuilder*)m_pcoImaObjectBuilder)
->VolltextRecherche(m_pcoData, pcoDestData);
else
((DRechercheBuilder*)m_pcoImaObjectBuilder)
->Recherche(m_pcoData,pcoDestData);
// Flag setzen, damit asynchroner Job nach dem Zuruecksenden
// der Objekte aktiviert wird
m_iAsyncFlag = 1;
} // if bRecursive
}
Marktdaten
Theoretical Basket
Volatility
Google
vol surface
Facebook
vol surface
call Google
1y, ATM
call Google
3m, 200
call Facebook
1y, ATM
call Facebook
5m, 150
Quellen für Marktdaten
class MarketData {
double GetSpot(long sicovam);
double GetVolat(long sicovam,
double maturity,
double strike);
}
Marktdaten-Szenarien
class SpotShiftedMarketData
: public MarketData {
double GetSpot(long sicovam) {
return MarketData::GetSpot(sicovam)
* factor;
}
}
Decorator-Pattern
Source: https://en.wikipedia.org/wiki/Decorator_pattern
Veränderte Marktdaten
class MarketDataDecorator : public MarketData {
MarketData* fMarketData;
MarketDataDecorator(MarketData* marketData)
: fMarketData(marketData) {}
double GetSpot(long sicovam) {
return fMarketData->GetSpot(sicovam);
}
}
Baskets
double SpotShiftedMarketData::GetSpot(long sicovam)
{
return fMarketData->GetSpot(sicovam) * factor;
}
double MarketData::GetSpot(long sicovam) {
return f(GetSpot(basketComponent), ...)
}
double CURiskMatrixMarketData::GetVolat( long code,
double startDate,
double endDate,
double strike,
NSREnums::eVolatilityType volat,
Boolean put,
const CSRMarketData *context) const
{
if (CalledFromAPricingFunctionFromLV) {
double init_vol = 0.0;
const CSRInstrument *instrument = GetCSRInstrument(code);
if(instrument
&& instrument->HasAVolatilityFormula()
&& !DoesTheFirstMarketDataDeriveFromTheSecondOne(this,context))
init_vol = fMarketData->GetVolat(code,startDate,endDate,strike,volat,put,fMarketData);
else
init_vol = fMarketData->GetVolat
(code,startDate,endDate,strike,volat,put,(context)?context:this);
return fabsolute_volat_shift_factor + init_vol;
}
else {
const CSRInstrument *instrument = GetCSRInstrument(code);
double vol = HVBMarketDataDelegator::GetVolat(code,startDate,endDate,strike,volat,put,context);
if(instrument && instrument->HasAVolatilityFormula())
return vol;
return vol + fabsolute_volat_shift_factor;
}
}
Seelenloser Code
Funktionale Programmierung!
1. unveränderliche Daten
2. weniger Kopplung
3. Verifikation
Funktionale Programmierung!
1. unveränderliche Daten
2. weniger Kopplung
3. Verifikation
4. Katamorphismen
5. Bifunktoren
Funktionale Programmierung!
1. unveränderliche Daten
2. weniger Kopplung
3. Verifikation
4. Katamorphismen
5. Bifunktoren
6. Monaden
7. monadische Profunktoren
8. Kleisli arrows
Source: @tpierrain, use case driven
Agile Revolution
Nach der agilen Revolution
29%
Neue Features
53%
Wartung,
Komplexität
18%
“Professionalisierung”
Fahd Al-Fatish: Software Engineering - the roots, Karlsruher Entwicklertage 2017
Welt aus Objekten
(© Trustees of the British
Museum)
Source: http://bonkersworld.net/object-world (CC)
Imperative Programmierung
jungle.exit(elephant)
room.enter(elephant)
https://www.flickr.com/photos/tomsaint/3266056756
Realität und Schnappschüsse
MVC
Controller
View Model
Problem
model view
model’ view’
Veränderung hoffentlich
entsprechend
Veränderung
MVC
Alan Kay über OO
Though OOP came from many motivations, two were central.
[...] to find a more flexible version of assignment, and then to
try to eliminate it altogether.
Alan Kay, History of Smalltalk
Communications of the ACM, 1996
OO vs. Zustand
https://www.ntu.edu.sg/home/ehchua/programming/java/J3a_OOPBasics.html
FP FTW!
• einfachere Sprachen
• weniger Komplexität
• höhere Produktivität
• weniger Bugs
FP FTW!
• einfachere Sprachen
• weniger Komplexität
• höhere Produktivität
• weniger Bugs
• mächtige Typsysteme
• Testen von Eigenschaften / QuickCheck
FP for the Win!
• einfachere Sprachen
• weniger Komplexität
• höhere Produktivität
• weniger Bugs
• mächtige Typsysteme
• Testen von Eigenschaften / QuickCheck
• verlässliches Verhalten
• einfacheres Testen
• weniger Kopplung
• weniger Abhängigkeiten
No Silver Bullet!
Fred Brooks No Silver Bullet — Essence and
Accidents of Software Engineering
IEEE Computer, 1987
Yale-Studie
Hudak, Jones: Haskell vs. Ada vs. C++ vs. Awk vs. ...
An Experiment in Software Prototyping Productivity, Yale University, 1993
Dev Day 2019: Mike Sperber – Software Design für die Seele
Dev Day 2019: Mike Sperber – Software Design für die Seele
Halbleiter-Herstellung
Oxidation
(SiO2)
Diffusing
dopant
Lithography
(pattern)
Etch
(remove)
Deposition
(add)
CMP
(polish)
Repeat for each layerTransistor Layer
Extremely Simplified Process Route
Repräsentation
data Operation =
TrackIn | Process | TrackOut
type Route = [Operation]
r1 = [TrackIn, Process, Process, TrackOut]
Funktionen
routeHead :: Route -> Operation
routeHead [] = ???
routeHead (op:_) = op
Optionale Dinge
data Option a where
Some :: a -> Option a
None :: Option a
Funktionen
routeHead :: Route -> Option Operation
routeHead [] = None
routeHead (op:_) = Some op
routeHead r1 ⇒ Some TrackIn
Funktionen
routeAdvance ::
Route -> Option (Operation, Route)
routeAdvance r1
⇒ Some (TrackIn,
[Process,Process,TrackOut])
Funktionen
routeAdvance ::
Route -> Option (Operation, Route)
routeAdvance [] = None
routeAdvance (op:rest) = Some (op, rest)
Q-Time-Zonen
Pro Route:
• 1000 Operationen
• 50 separate Q-Time-Zonen
Q-Time Zone
Eqp A1
Eqp A1
Eqp A1
Eqp A1
Eqp A1
Eqp B1
Eqp A1
Eqp A1
Eqp C1
Eqp A1
Eqp A1
Eqp D1
Eqp A1
Eqp A1
Eqp X1
Eqp A1
Eqp A1
Eqp Y1
WIP
WIP
Q-Time-Zonen
type Route = [RouteElement]
data RouteElement where
RouteOp ::
Operation -> RouteElement
RouteQTZone ::
Duration -> [Operation] -> RouteElement
Beispiele
r1 = [RouteOp TrackIn,
RouteOp Process, RouteOp Process,
RouteOp TrackOut]
r2 = [RouteOp TrackIn,
RouteQTZone 5 [Process, Process],
RouteOp TrackOut]
Q-Time-Zonen
type Route = [RouteElement]
data RouteElement where
RouteOp ::
Operation -> RouteElement
RouteQTZone ::
Duration -> [Operation] -> RouteElement
Q-Time-Zonen
type Route = [RouteElement]
data RouteElement where
RouteOp ::
Operation -> RouteElement
RouteQTZone ::
Duration -> [RouteElement] -> RouteElement
Beispiele
r1 = [RouteOp TrackIn,
RouteOp Process, RouteOp Process,
RouteOp TrackOut]
r2 = [RouteOp TrackIn,
RouteQTZone 5
[RouteOp Process,
RouteOp Process],
RouteOp TrackOut]
Verschachtelte Q-Time-Zonen
r3 = [RouteOp TrackIn,
RouteQTZone 100
[RouteOp Process,
RouteQTZone 5
[RouteOp Process,
RouteOp Process]]]
Q-Time-Zonen
type Route = [RouteElement]
data RouteElement where
RouteOp ::
Operation -> RouteElement
RouteQTZone ::
Duration -> [RouteElement] -> RouteElement
Q-Time-Zonen
type Route = [RouteElement]
data RouteElement where
RouteOp ::
Operation -> RouteElement
RouteQTZone ::
Duration -> Route -> RouteElement
Funktionen
routeHead :: Route -> Option Operation
routeHead [] = None
routeHead (el:rest) =
case routeElementHead el of
None -> routeHead rest
Some op -> Some op
routeElementHead :: RouteElement -> Option Operation
routeElementHead (RouteOp op) = Some op
routeElementHead (RouteQTZone _ rt) = routeHead rt
Fortschritt
routeAdvance ::
Route -> Option (Operation, Route)
routeAdvance [] = None
routeAdvance (el:rest) =
case el of
RouteOp op -> Some (op, rest)
RouteQTZone d rt -> ???
Q-Time-Zonen in Bearbeitung
type Route = [RouteElement]
data RouteElement where
RouteOp :: Operation -> RouteElement
RouteQTZone :: Duration -> Route -> RouteElement
RouteQTLimit :: Time -> Route -> RouteElement
Fortschritt
routeAdvance :: Route -> Time -> Option (Operation, Route)
routeAdvance [] t = None
routeAdvance (el:rest) t =
case el of
RouteOp op -> Some (op, rest)
RouteQTZone d rt ->
routeAdvance (RouteQTLimit (t + d) rt : rest) t
RouteQTLimit tl rt ->
case routeAdvance rt t of
None -> routeAdvance rest t
Some (op, rt') ->
Some (op, RouteQTLimit tl rt' : rest)
Q-Time-Zonen in Bearbeitung
type Route = [RouteElement]
data RouteElement where
RouteOp :: Operation -> RouteElement
RouteQTZone :: Duration -> Route -> RouteElement
RouteQTLimit :: Time -> Route -> RouteElement
Unzulässiger Zustand
r4 = [RouteOp TrackIn,
RouteQTLimit 12
[RouteOp Process,
RouteOp TrackOut]]
Unzulässige Zustände
unmöglich machen
data Route where
Route :: RouteRem -> Route
RouteQTLimit :: Time -> Route -> RouteRem -> Route
type RouteRem = [RouteElement]
data RouteElement where
RouteOp :: Operation -> RouteElement
RouteQTZone :: Duration -> RouteRem -> RouteElement
+
=https://pixabay.com/en/conversation-dialogue-interview-1262311/
https://commons.wikimedia.org/wiki/File:Bullet_train.jpg

More Related Content

PDF
Oredev 2015 - Taming Java Agents
PDF
Con-FESS 2015 - Having Fun With Javassist
PDF
Functional Reactive Programming on Android
PPTX
An introduction to ROP
PDF
java8-patterns
PDF
A deep dive into PEP-3156 and the new asyncio module
PPTX
Going native with less coupling: Dependency Injection in C++
PDF
R ext world/ useR! Kiev
Oredev 2015 - Taming Java Agents
Con-FESS 2015 - Having Fun With Javassist
Functional Reactive Programming on Android
An introduction to ROP
java8-patterns
A deep dive into PEP-3156 and the new asyncio module
Going native with less coupling: Dependency Injection in C++
R ext world/ useR! Kiev

What's hot (20)

PPTX
Async programming and python
PPTX
Lezhin kotlin jetbrain
PDF
Pharo Optimising JIT Internals
PDF
RxJava applied [JavaDay Kyiv 2016]
PDF
Adam Sitnik "State of the .NET Performance"
PPTX
Real world functional reactive programming
PPT
Building a java tracer
PDF
Python, do you even async?
PDF
Modern Programming in Java 8 - Lambdas, Streams and Date Time API
PPTX
모던자바의 역습
PDF
Wait for your fortune without Blocking!
PDF
Facebook Glow Compiler のソースコードをグダグダ語る会
PDF
JRuby 9000 - Taipei Ruby User's Group 2015
PDF
What's New in ES6 for Web Devs
PDF
Java-Jersey 到 Python-Flask 服務不中斷重構之旅
PDF
Рахманов Александр "Что полезного в разборе дампов для .NET-разработчиков?"
KEY
DjangoCon US 2011 - Monkeying around at New Relic
PDF
JRuby and You
PDF
Verilator: Fast, Free, But for Me?
PDF
JRuby 9000 - Optimizing Above the JVM
Async programming and python
Lezhin kotlin jetbrain
Pharo Optimising JIT Internals
RxJava applied [JavaDay Kyiv 2016]
Adam Sitnik "State of the .NET Performance"
Real world functional reactive programming
Building a java tracer
Python, do you even async?
Modern Programming in Java 8 - Lambdas, Streams and Date Time API
모던자바의 역습
Wait for your fortune without Blocking!
Facebook Glow Compiler のソースコードをグダグダ語る会
JRuby 9000 - Taipei Ruby User's Group 2015
What's New in ES6 for Web Devs
Java-Jersey 到 Python-Flask 服務不中斷重構之旅
Рахманов Александр "Что полезного в разборе дампов для .NET-разработчиков?"
DjangoCon US 2011 - Monkeying around at New Relic
JRuby and You
Verilator: Fast, Free, But for Me?
JRuby 9000 - Optimizing Above the JVM
Ad

Similar to Dev Day 2019: Mike Sperber – Software Design für die Seele (20)

PDF
Kotlin+MicroProfile: Ensinando 20 anos para uma linguagem nova
PDF
What to expect from Java 9
PDF
A new execution model for Nashorn in Java 9
PDF
Twins: OOP and FP
PDF
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
PDF
WebNet Conference 2012 - Designing complex applications using html5 and knock...
PPTX
Ontopia tutorial
PDF
Reactive Web-Applications @ LambdaDays
PDF
Google Cloud Endpoints: Building Third-Party APIs on Google AppEngine
KEY
JavaScript Growing Up
KEY
Back to the future with Java 7 (Geekout June/2011)
PDF
JavaScript for real men
PDF
Advanced technic for OS upgrading in 3 minutes
PDF
Foomo / Zugspitze Presentation
PDF
Angular for Java Enterprise Developers: Oracle Code One 2018
PDF
20100730 phpstudy
PPTX
Javascript Design Patterns
PDF
Large-scaled Deploy Over 100 Servers in 3 Minutes
PDF
Presto anatomy
PDF
Kotlin+MicroProfile: Enseñando trucos de 20 años a un nuevo lenguaje
Kotlin+MicroProfile: Ensinando 20 anos para uma linguagem nova
What to expect from Java 9
A new execution model for Nashorn in Java 9
Twins: OOP and FP
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
WebNet Conference 2012 - Designing complex applications using html5 and knock...
Ontopia tutorial
Reactive Web-Applications @ LambdaDays
Google Cloud Endpoints: Building Third-Party APIs on Google AppEngine
JavaScript Growing Up
Back to the future with Java 7 (Geekout June/2011)
JavaScript for real men
Advanced technic for OS upgrading in 3 minutes
Foomo / Zugspitze Presentation
Angular for Java Enterprise Developers: Oracle Code One 2018
20100730 phpstudy
Javascript Design Patterns
Large-scaled Deploy Over 100 Servers in 3 Minutes
Presto anatomy
Kotlin+MicroProfile: Enseñando trucos de 20 años a un nuevo lenguaje
Ad

More from DevDay Dresden (20)

PDF
The Architecture of Uncertainty - Kevlin Henney
PDF
Dev Day 2021 - Stephan Pirnbaum - Anwendungsmodernisierung
PDF
Tobias Nebel - Herausforderungen und Changen in Full-Stack-IoT-Projekten
PDF
Andreas Roth - GraphQL erfolgreich im Backend einsetzen
PDF
Alexander Reelsen - Seccomp for Developers
PDF
DevDay 19 Accessibility: Praxistipps für Entwickler
PDF
Dev Day 2019: Phillip Krenn – Aggregierte Logging Patterns
PDF
Dev Day 2019: Mirko Seifert – Next Level Integration Testing mit Docker und T...
PDF
Dev Day 2019: Nathan Mattes – Kommunikation ist wichtig, scheiße wichtig und ...
PDF
Dev Day 2019: Stephan Birnbaum – Die Glaskugel hat ausgedient, wir machen Sof...
PDF
Dev Day 2019: Markus Winand – Die Mutter aller Abfragesprachen: SQL im 21. Ja...
PDF
Dev Day 2019: Kay Grebenstein – Wie wir müssen das noch testen? - design for ...
PDF
Dev Day 2019: Kathrin Friedrich/Michael Kunze – Design better together - Styl...
PDF
Dev Day 2019: Benjamin Wolf – "Some fixes" - Commit Message 101
PDF
Dev Day 2019: Lucas Fiedler – DevOps-Dashboard: Transparenz für DevOps-Teams
PDF
Dev Day 2019: Ulrich Deiters – Offene Daten und IT-Lösungen für den Radverkehr
PDF
Dev Day 2019: Alexander Lichter - JAMstack - Eine neuartige Webanwendungs-Arc...
PDF
Dev Day 2019: Martin Schurz - Manual Work Is A Bug!
PDF
Dev Day 2019: Stefan Schleyer: How to build an cloud-based IoT application“
PDF
Dev Day 2019: Mirko Zeibig – "Hallo " <> "Elixir"
The Architecture of Uncertainty - Kevlin Henney
Dev Day 2021 - Stephan Pirnbaum - Anwendungsmodernisierung
Tobias Nebel - Herausforderungen und Changen in Full-Stack-IoT-Projekten
Andreas Roth - GraphQL erfolgreich im Backend einsetzen
Alexander Reelsen - Seccomp for Developers
DevDay 19 Accessibility: Praxistipps für Entwickler
Dev Day 2019: Phillip Krenn – Aggregierte Logging Patterns
Dev Day 2019: Mirko Seifert – Next Level Integration Testing mit Docker und T...
Dev Day 2019: Nathan Mattes – Kommunikation ist wichtig, scheiße wichtig und ...
Dev Day 2019: Stephan Birnbaum – Die Glaskugel hat ausgedient, wir machen Sof...
Dev Day 2019: Markus Winand – Die Mutter aller Abfragesprachen: SQL im 21. Ja...
Dev Day 2019: Kay Grebenstein – Wie wir müssen das noch testen? - design for ...
Dev Day 2019: Kathrin Friedrich/Michael Kunze – Design better together - Styl...
Dev Day 2019: Benjamin Wolf – "Some fixes" - Commit Message 101
Dev Day 2019: Lucas Fiedler – DevOps-Dashboard: Transparenz für DevOps-Teams
Dev Day 2019: Ulrich Deiters – Offene Daten und IT-Lösungen für den Radverkehr
Dev Day 2019: Alexander Lichter - JAMstack - Eine neuartige Webanwendungs-Arc...
Dev Day 2019: Martin Schurz - Manual Work Is A Bug!
Dev Day 2019: Stefan Schleyer: How to build an cloud-based IoT application“
Dev Day 2019: Mirko Zeibig – "Hallo " <> "Elixir"

Recently uploaded (20)

PPTX
Trending Python Topics for Data Visualization in 2025
PDF
DNT Brochure 2025 – ISV Solutions @ D365
PDF
DuckDuckGo Private Browser Premium APK for Android Crack Latest 2025
DOC
UTEP毕业证学历认证,宾夕法尼亚克拉里恩大学毕业证未毕业
PDF
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
PPTX
Download Adobe Photoshop Crack 2025 Free
PPTX
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
PPTX
Computer Software - Technology and Livelihood Education
DOCX
How to Use SharePoint as an ISO-Compliant Document Management System
PDF
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
PPTX
CNN LeNet5 Architecture: Neural Networks
PDF
AI Guide for Business Growth - Arna Softech
PPTX
Tech Workshop Escape Room Tech Workshop
PDF
Wondershare Recoverit Full Crack New Version (Latest 2025)
PDF
Introduction to Ragic - #1 No Code Tool For Digitalizing Your Business Proces...
PDF
Type Class Derivation in Scala 3 - Jose Luis Pintado Barbero
PPTX
Matchmaking for JVMs: How to Pick the Perfect GC Partner
PDF
CCleaner 6.39.11548 Crack 2025 License Key
PDF
Workplace Software and Skills - OpenStax
PDF
The Dynamic Duo Transforming Financial Accounting Systems Through Modern Expe...
Trending Python Topics for Data Visualization in 2025
DNT Brochure 2025 – ISV Solutions @ D365
DuckDuckGo Private Browser Premium APK for Android Crack Latest 2025
UTEP毕业证学历认证,宾夕法尼亚克拉里恩大学毕业证未毕业
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
Download Adobe Photoshop Crack 2025 Free
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
Computer Software - Technology and Livelihood Education
How to Use SharePoint as an ISO-Compliant Document Management System
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
CNN LeNet5 Architecture: Neural Networks
AI Guide for Business Growth - Arna Softech
Tech Workshop Escape Room Tech Workshop
Wondershare Recoverit Full Crack New Version (Latest 2025)
Introduction to Ragic - #1 No Code Tool For Digitalizing Your Business Proces...
Type Class Derivation in Scala 3 - Jose Luis Pintado Barbero
Matchmaking for JVMs: How to Pick the Perfect GC Partner
CCleaner 6.39.11548 Crack 2025 License Key
Workplace Software and Skills - OpenStax
The Dynamic Duo Transforming Financial Accounting Systems Through Modern Expe...

Dev Day 2019: Mike Sperber – Software Design für die Seele