SlideShare a Scribd company logo
Writing Simple, Readable and
Robust Code: Examples in
Java, Clojure, and Go
freiheit.com technologies - Hamburg, September 30, 2015
code.talks 2015
© freiheit.com 2
Hi! I am Stefan Richter. I started programming on an Apple ][ in
1983. Since 1998, I run my own software company, which is
specialized in large Internet systems.
WHO AM I?
Working as a professional
programmer
Running my own company
20102005199819951990198719831966
Apple II,
Pascal,
C64,
6502
VAX, Unix,
C,
4GLs,
Smalltalk,
Lisp,
Scheme
Unix, C,
4 GLs,
(Windows NT, VB (!))
Linux, Java, Python, Ruby,
Objective-C, C/C++, Common Lisp, Clojure,
JavaScript, Go
...
Future
University studies and work as a
programmer in research institutes
SO LET’S GET STARTED
AND HAVE SOME FUN! :)
According to Wikipedia a domain-
specific language (DSL) is a
“... programming language or
specification language dedicated to
a particular problem domain [...].“
© freiheit.com 4
I guess, we find DSLs so compelling
because sooner or later every
programmer dreams of creating
his/her own programming language. ;)
© freiheit.com 5
Let’s take an example from a person
you all know: Martin Fowler.
In 2005, he posted an article on his
homepage about domain-specific
languages ...
© freiheit.com 6
© freiheit.com 7
Fowler creates a DSL to read files in a fixed-length
format and to convert each line into an object. This is
the file format and the mapping spec:
8© freiheit.com
He uses C#, but as C# is more or less
a Java clone you will agree that the
Java code would look almost exactly
the same.
© freiheit.com 9
Line by line, he reads the file and dispatches the
conversion to a strategy class.
10© freiheit.com
The strategy class is parameterized with the type
code and the target class ...
11© freiheit.com
The individual fields in each line are read by a
FieldExtractor class ...
12© freiheit.com
To process the line, the strategy creates the target
class and uses the extractors to get the field data ...
13© freiheit.com
The FieldExtractor pulls out the data and sets the
correct field in the target class by using reflection ...
14© freiheit.com
Now you have an API that can be configured at
compile time ...
15© freiheit.com
If you would like to do this in a declarative style, you
need an XML configuration ... (arrggh)
16© freiheit.com
Fowler’s example shows about 70 lines
of code (LOC). But the code is not
complete. I guess, the complete example
would be around 200 LOC Java.
© freiheit.com 17
HMM. SO MUCH CODE
FOR A SIMPLE PROBLEM.
Ideally, you would like to have something like this
as a mini DSL:
19© freiheit.com
The Common Lisp Community picked
up Fowler’s article, because he
mentioned Lisp favorably.
© freiheit.com 20
Rainer Joswig then proposed this DSL in comp.
lang.lisp:
21© freiheit.com
His solution is a 12 LOC Lisp macro …,
22© freiheit.com
... which expands to this code:
Let’s examine how macros work. We’ll
use the Common Lisp code as an
example. It’s very close to how macros
look like in Clojure! I’ll show you later! :)
© freiheit.com 23
• Basically, a Lisp macro is a code generator. But you can’t compare Lisp macros with C macros or any other
macro or template system.
• Lisp programs are trees of expressions. Code is data. Data is code.
• This is why a Lisp program can modify itself.
• In a nutshell - “How to read Lisp macros“:
• Macros don’t evaluate their parameters.
• The backtick (`) says: „Don’t evaluate the following code.“
• The comma (,) says: „Evaluate the following code and replace it with the result.“
• Then: Evaluate all resulting code together.
• Read Peter Seibel’s „Practical Common Lisp“ to learn more ...
24© freiheit.com
• defclass creates a new CLOS class. In CLOS methods are defined independently of the class definition, but
getter/setter can be defined implicitly.
• Methods are specialized on their parameters. So each method can be specialized to more than one class! Think about
this for a moment ...
• You can even specialize a method depending on what exact value is passed as a parameter. So you can have special
methods for specific parameter values. In this example, parse-line-for-class is called, when you pass a class with the
name “service-call“. (Which in turn is generated by this macro, too).
• This method then takes the class, instantiates it and sets (side effect) its member variables by taking the format
specification and using a substring function to extract the right bits and pieces from the input line. (This is not pure
functional style, but this is how you use Common Lisp with CLOS.)
25© freiheit.com
To read from a file and apply the mappings
Rainer Joswig then wrote this code:
26© freiheit.com
Obviously, the Common Lisp version
works almost the same as
Martin Fowler’s C# version, with much
less code. Rainer Joswig’s solution is
functionally complete.
Let’s do this in Clojure now!
© freiheit.com 27
One thing: Some people in the Clojure
community say that you should not use
macros. You will soon see why.
But I disagree! Macros are one of the
reasons why you should favor
Lisp-like languages over other languages.
© freiheit.com 28
NOW THAT YOU ARE
EXPERTS ON COMMON
LISP MACRO, I WILL SHOW
YOU THE FIRST CLOJURE
VERSION STRAIGHT AWAY!
30© freiheit.com
• We create a list of the field names because we need them two times in the code.
• defrecord creates a Clojure data structure with the look and feel of a hash table.
• But it is much more: Under the hood, this is a Java class! And even more!
• This is why you need a constructor function to create a “record“. I generate the name of the constructor function by
appending “.“ to the record name.
• I create a multimethod, which is specialized on the value of the mapping parameter. So Clojure “knows“, which method
to call based on the input ...
• Then, I create a list of all values from the input line (in the same order as their field names) and apply this list to the
constructor of the record, which is returned as the function value.
To make it complete: defmethod needs a defmulti
to provide a dispatching function.
31© freiheit.com
• Meaning: Take the first four characters of the value of the parameter “line“ (which should be a java.lang.
String) and then call the multimethod, which is specialized on this value.
• (Note: Of course, you have to handle the cases: What happens when you have an empty line, an
unknown mapping or a comment line. But I leave this out here to keep the example simple, even though
this is just five lines more including another defmethod, which handles all these :default cases).
32© freiheit.com
• In a nutshell “How to read Clojure macros“:
• The backtick (`) says: „Don‘t evaluate the following code.“
• The tilde (~) says: „Evaluate the following code and replace it with the result.“
• ~@ means: “Evaluate the following code and replace it with the result, but don’t put parentheses around the result.“
(This is called „splicing“.)
• The hash sign (#) at the end of a variable is used to automatically create unique variable names in the code created by
the macro. This is called auto-gensyms. This way you can prevent name clashes with call parameters.
Finally, this Clojure macro expands to the following
code. Can you see the automatically generated
variable names?
33© freiheit.com
Now we can define mappings as follows:
34© freiheit.com
Actually, the
leading 0 doesn’t
work here.
Leading zeros
are reserved for
octal numbers.
LET US BUILD
SOMETHING TO
CONVENIENTLY USE
THESE MAPPINGS!
This is a classic with-macro that you often find in
the Common Lisp world.
36© freiheit.com
• It reads the file identified by file name line by line.
• It calls our multimethod parse line for each line.
• It binds the result to a variable that you can hand over to the macro (binding).
• And only if parsing the line has a result (no empty line, no comment line or unknown binding), it executes the body,
meaning the code that you can hand over to this macro, which can contain the variable, which contains the binding.
• Then it returns a list of the results.
• Sounds difficult, but with the example on the next page you will find it to be very simple.
In this example, we just extract the customer name
from each line.
37© freiheit.com
• For each valid line in the file specified by file name (*testdata* contains the file name as a string) a Clojure record is
created.
• Each result is bound in this case to the symbol/variable “obj“.
• In the body code you can use this symbol/variable to access this Clojure record.
• In this case, we use it to extract the customer name from the record.
• with-mappings then returns a list of the results.
Isn’t this awesome?! We have just
defined two new programming
constructs and added them to our
programming language: defmapping,
with-mappings.
© freiheit.com 38
The complete example is about 30 LOC
of Clojure. You don’t need any special
tools (Language Workbench). It’s all
right there in the Clojure language.
And you just need Emacs to unleash
this power ...
© freiheit.com 39
Now I can extend this without breaking
the existing code.
© freiheit.com 40
Let’s add a serializer to create
JSON from the data ...
© freiheit.com 41
We define a protocol and add an implementation to
the record definition.
42© freiheit.com
Now we can convert the data to JSON.
43© freiheit.com
And we can even change the serialize method
„in place“ and on the fly.
© freiheit.com GOTO Conference Copenhagen, 2011
“LISP ISN’T A LANGUAGE,
IT’S A BUILDING
MATERIAL.“
- ALAN KAY
And Clojure gives you powerful
abstractions that you won’t find in
any other programming language.
Some stuff is only possible in a
Lisp-like language ... with all these
parenthesis. ;)
© freiheit.com 45
© freiheit.com GOTO Conference Copenhagen, 2011
IT IS COOL. I LOVE THIS.
BUT IS THIS REALLY
SIMPLE?
LET’S DO THIS IN GO!
© freiheit.com GOTO Conference Copenhagen, 2011
LIVE CODING
THANK YOU
freiheit.com technologies
Budapester Str. 45
20359 Hamburg, Germany
kontakt@freiheit.com
T +49 40 890584 0
F +49 40 890584 20
Hackers wanted.
Join us:
jobs@freiheit.com

More Related Content

What's hot

Typescript Basics
Typescript BasicsTypescript Basics
Typescript Basics
Manikandan [M M K]
 
TypeScript - Silver Bullet for the Full-stack Developers
TypeScript - Silver Bullet for the Full-stack DevelopersTypeScript - Silver Bullet for the Full-stack Developers
TypeScript - Silver Bullet for the Full-stack Developers
Rutenis Turcinas
 
Kubernetes Internals
Kubernetes InternalsKubernetes Internals
Kubernetes Internals
Shimi Bandiel
 
LLVM
LLVMLLVM
Should i Go there
Should i Go thereShould i Go there
Should i Go there
Shimi Bandiel
 
Neodev
NeodevNeodev
Introduction to TypeScript
Introduction to TypeScriptIntroduction to TypeScript
Introduction to TypeScript
KeithMurgic
 
TypeScript 2 in action
TypeScript 2 in actionTypeScript 2 in action
TypeScript 2 in action
Alexander Rusakov
 
Getting started with typescript
Getting started with typescriptGetting started with typescript
Getting started with typescript
C...L, NESPRESSO, WAFAASSURANCE, SOFRECOM ORANGE
 
Typescript
TypescriptTypescript
Typescript
Nikhil Thomas
 
New c sharp4_features_part_iv
New c sharp4_features_part_ivNew c sharp4_features_part_iv
New c sharp4_features_part_iv
Nico Ludwig
 
TypeScript - An Introduction
TypeScript - An IntroductionTypeScript - An Introduction
TypeScript - An Introduction
NexThoughts Technologies
 
Clang: More than just a C/C++ Compiler
Clang: More than just a C/C++ CompilerClang: More than just a C/C++ Compiler
Clang: More than just a C/C++ Compiler
Samsung Open Source Group
 
Getting started with typescript and angular 2
Getting started with typescript  and angular 2Getting started with typescript  and angular 2
Getting started with typescript and angular 2
Knoldus Inc.
 
Blocks & GCD
Blocks & GCDBlocks & GCD
Blocks & GCD
rsebbe
 
Typescript for the programmers who like javascript
Typescript for the programmers who like javascriptTypescript for the programmers who like javascript
Typescript for the programmers who like javascript
Andrei Sebastian Cîmpean
 
Type script - advanced usage and practices
Type script  - advanced usage and practicesType script  - advanced usage and practices
Type script - advanced usage and practices
Iwan van der Kleijn
 
Introduction to TypeScript by Winston Levi
Introduction to TypeScript by Winston LeviIntroduction to TypeScript by Winston Levi
Introduction to TypeScript by Winston Levi
Winston Levi
 
Asynchronous IO in Rust - Enrico Risa - Codemotion Rome 2017
Asynchronous IO in Rust - Enrico Risa - Codemotion Rome 2017Asynchronous IO in Rust - Enrico Risa - Codemotion Rome 2017
Asynchronous IO in Rust - Enrico Risa - Codemotion Rome 2017
Codemotion
 
TypeScript: coding JavaScript without the pain
TypeScript: coding JavaScript without the painTypeScript: coding JavaScript without the pain
TypeScript: coding JavaScript without the pain
Sander Mak (@Sander_Mak)
 

What's hot (20)

Typescript Basics
Typescript BasicsTypescript Basics
Typescript Basics
 
TypeScript - Silver Bullet for the Full-stack Developers
TypeScript - Silver Bullet for the Full-stack DevelopersTypeScript - Silver Bullet for the Full-stack Developers
TypeScript - Silver Bullet for the Full-stack Developers
 
Kubernetes Internals
Kubernetes InternalsKubernetes Internals
Kubernetes Internals
 
LLVM
LLVMLLVM
LLVM
 
Should i Go there
Should i Go thereShould i Go there
Should i Go there
 
Neodev
NeodevNeodev
Neodev
 
Introduction to TypeScript
Introduction to TypeScriptIntroduction to TypeScript
Introduction to TypeScript
 
TypeScript 2 in action
TypeScript 2 in actionTypeScript 2 in action
TypeScript 2 in action
 
Getting started with typescript
Getting started with typescriptGetting started with typescript
Getting started with typescript
 
Typescript
TypescriptTypescript
Typescript
 
New c sharp4_features_part_iv
New c sharp4_features_part_ivNew c sharp4_features_part_iv
New c sharp4_features_part_iv
 
TypeScript - An Introduction
TypeScript - An IntroductionTypeScript - An Introduction
TypeScript - An Introduction
 
Clang: More than just a C/C++ Compiler
Clang: More than just a C/C++ CompilerClang: More than just a C/C++ Compiler
Clang: More than just a C/C++ Compiler
 
Getting started with typescript and angular 2
Getting started with typescript  and angular 2Getting started with typescript  and angular 2
Getting started with typescript and angular 2
 
Blocks & GCD
Blocks & GCDBlocks & GCD
Blocks & GCD
 
Typescript for the programmers who like javascript
Typescript for the programmers who like javascriptTypescript for the programmers who like javascript
Typescript for the programmers who like javascript
 
Type script - advanced usage and practices
Type script  - advanced usage and practicesType script  - advanced usage and practices
Type script - advanced usage and practices
 
Introduction to TypeScript by Winston Levi
Introduction to TypeScript by Winston LeviIntroduction to TypeScript by Winston Levi
Introduction to TypeScript by Winston Levi
 
Asynchronous IO in Rust - Enrico Risa - Codemotion Rome 2017
Asynchronous IO in Rust - Enrico Risa - Codemotion Rome 2017Asynchronous IO in Rust - Enrico Risa - Codemotion Rome 2017
Asynchronous IO in Rust - Enrico Risa - Codemotion Rome 2017
 
TypeScript: coding JavaScript without the pain
TypeScript: coding JavaScript without the painTypeScript: coding JavaScript without the pain
TypeScript: coding JavaScript without the pain
 

Viewers also liked

01 Java Is Architecture Neutral
01 Java Is Architecture Neutral01 Java Is Architecture Neutral
01 Java Is Architecture Neutral
rajuglobal
 
Best practices to optimize code and build robust and scalable web applications
Best practices to optimize code and build robust and scalable web applicationsBest practices to optimize code and build robust and scalable web applications
Best practices to optimize code and build robust and scalable web applications
dheerajpiet
 
High Performance Data Analytics with Java on Large Multicore HPC Clusters
High Performance Data Analytics with Java on Large Multicore HPC ClustersHigh Performance Data Analytics with Java on Large Multicore HPC Clusters
High Performance Data Analytics with Java on Large Multicore HPC Clusters
Saliya Ekanayake
 
Clojure Macros Workshop: LambdaJam 2013 / CUFP 2013
Clojure Macros Workshop: LambdaJam 2013 / CUFP 2013Clojure Macros Workshop: LambdaJam 2013 / CUFP 2013
Clojure Macros Workshop: LambdaJam 2013 / CUFP 2013
Leonardo Borges
 
A Dive Into Clojure
A Dive Into ClojureA Dive Into Clojure
A Dive Into Clojure
Carlo Sciolla
 
不自然なcar/ナチュラルにconsして
不自然なcar/ナチュラルにconsして不自然なcar/ナチュラルにconsして
不自然なcar/ナチュラルにconsして
mitsutaka mimura
 
Clojure: Practical functional approach on JVM
Clojure: Practical functional approach on JVMClojure: Practical functional approach on JVM
Clojure: Practical functional approach on JVM
sunng87
 
Patterns
PatternsPatterns
Patterns
David Nolen
 
A little exercise with clojure macro
A little exercise with clojure macroA little exercise with clojure macro
A little exercise with clojure macro
Zehua Liu
 
Writing Macros
Writing MacrosWriting Macros
Writing Macros
RueiCi Wang
 
Macros in Clojure
Macros in ClojureMacros in Clojure
Macros in Clojuresohta
 
入門ClojureScript
入門ClojureScript入門ClojureScript
入門ClojureScript
sohta
 
Ecom trend
Ecom trendEcom trend
Ecom trend
Huy Dang
 
Continuation Passing Style and Macros in Clojure - Jan 2012
Continuation Passing Style and Macros in Clojure - Jan 2012Continuation Passing Style and Macros in Clojure - Jan 2012
Continuation Passing Style and Macros in Clojure - Jan 2012
Leonardo Borges
 
Clojure的魅力
Clojure的魅力Clojure的魅力
Clojure的魅力
dennis zhuang
 
Clojure概览
Clojure概览Clojure概览
Clojure概览
dennis zhuang
 
Niels Leenheer - Weird browsers - code.talks 2015
Niels Leenheer - Weird browsers - code.talks 2015Niels Leenheer - Weird browsers - code.talks 2015
Niels Leenheer - Weird browsers - code.talks 2015
AboutYouGmbH
 
Clojureシンタックスハイライター開発から考えるこれからのlispに必要なもの
Clojureシンタックスハイライター開発から考えるこれからのlispに必要なものClojureシンタックスハイライター開発から考えるこれからのlispに必要なもの
Clojureシンタックスハイライター開発から考えるこれからのlispに必要なもの
sohta
 
Introduction to JAVA
Introduction to JAVAIntroduction to JAVA
Introduction to JAVA
javatrainingonline
 
Core java lessons
Core java lessonsCore java lessons
Core java lessons
vivek shah
 

Viewers also liked (20)

01 Java Is Architecture Neutral
01 Java Is Architecture Neutral01 Java Is Architecture Neutral
01 Java Is Architecture Neutral
 
Best practices to optimize code and build robust and scalable web applications
Best practices to optimize code and build robust and scalable web applicationsBest practices to optimize code and build robust and scalable web applications
Best practices to optimize code and build robust and scalable web applications
 
High Performance Data Analytics with Java on Large Multicore HPC Clusters
High Performance Data Analytics with Java on Large Multicore HPC ClustersHigh Performance Data Analytics with Java on Large Multicore HPC Clusters
High Performance Data Analytics with Java on Large Multicore HPC Clusters
 
Clojure Macros Workshop: LambdaJam 2013 / CUFP 2013
Clojure Macros Workshop: LambdaJam 2013 / CUFP 2013Clojure Macros Workshop: LambdaJam 2013 / CUFP 2013
Clojure Macros Workshop: LambdaJam 2013 / CUFP 2013
 
A Dive Into Clojure
A Dive Into ClojureA Dive Into Clojure
A Dive Into Clojure
 
不自然なcar/ナチュラルにconsして
不自然なcar/ナチュラルにconsして不自然なcar/ナチュラルにconsして
不自然なcar/ナチュラルにconsして
 
Clojure: Practical functional approach on JVM
Clojure: Practical functional approach on JVMClojure: Practical functional approach on JVM
Clojure: Practical functional approach on JVM
 
Patterns
PatternsPatterns
Patterns
 
A little exercise with clojure macro
A little exercise with clojure macroA little exercise with clojure macro
A little exercise with clojure macro
 
Writing Macros
Writing MacrosWriting Macros
Writing Macros
 
Macros in Clojure
Macros in ClojureMacros in Clojure
Macros in Clojure
 
入門ClojureScript
入門ClojureScript入門ClojureScript
入門ClojureScript
 
Ecom trend
Ecom trendEcom trend
Ecom trend
 
Continuation Passing Style and Macros in Clojure - Jan 2012
Continuation Passing Style and Macros in Clojure - Jan 2012Continuation Passing Style and Macros in Clojure - Jan 2012
Continuation Passing Style and Macros in Clojure - Jan 2012
 
Clojure的魅力
Clojure的魅力Clojure的魅力
Clojure的魅力
 
Clojure概览
Clojure概览Clojure概览
Clojure概览
 
Niels Leenheer - Weird browsers - code.talks 2015
Niels Leenheer - Weird browsers - code.talks 2015Niels Leenheer - Weird browsers - code.talks 2015
Niels Leenheer - Weird browsers - code.talks 2015
 
Clojureシンタックスハイライター開発から考えるこれからのlispに必要なもの
Clojureシンタックスハイライター開発から考えるこれからのlispに必要なものClojureシンタックスハイライター開発から考えるこれからのlispに必要なもの
Clojureシンタックスハイライター開発から考えるこれからのlispに必要なもの
 
Introduction to JAVA
Introduction to JAVAIntroduction to JAVA
Introduction to JAVA
 
Core java lessons
Core java lessonsCore java lessons
Core java lessons
 

Similar to Stefan Richter - Writing simple, readable and robust code: Examples in Java, Clojure, and Go - code.talks 2015

Exciting JavaScript - Part II
Exciting JavaScript - Part IIExciting JavaScript - Part II
Exciting JavaScript - Part II
Eugene Lazutkin
 
What`s New in Java 8
What`s New in Java 8What`s New in Java 8
What`s New in Java 8
Mohsen Zainalpour
 
JUG Münster 2014 - Code Recommenders & Codetrails - Wissenstransfer 2.0
JUG Münster 2014 - Code Recommenders & Codetrails - Wissenstransfer 2.0JUG Münster 2014 - Code Recommenders & Codetrails - Wissenstransfer 2.0
JUG Münster 2014 - Code Recommenders & Codetrails - Wissenstransfer 2.0
Marcel Bruch
 
Core JavaScript
Core JavaScriptCore JavaScript
Core JavaScript
Lilia Sfaxi
 
Introduction Of C++
Introduction Of C++Introduction Of C++
Introduction Of C++
Sangharsh agarwal
 
introduction to server-side scripting
introduction to server-side scriptingintroduction to server-side scripting
introduction to server-side scripting
Amirul Shafeeq
 
Getting started with CATIA V5 Macros
Getting started with CATIA V5 MacrosGetting started with CATIA V5 Macros
Getting started with CATIA V5 Macros
Emmett Ross
 
Programming in Java: Getting Started
Programming in Java: Getting StartedProgramming in Java: Getting Started
Programming in Java: Getting Started
Martin Chapman
 
JAVASCRIPT PPT [Autosaved].pptx
JAVASCRIPT PPT [Autosaved].pptxJAVASCRIPT PPT [Autosaved].pptx
JAVASCRIPT PPT [Autosaved].pptx
AchieversITAravind
 
Full Stack Online Course in Marathahalli| AchieversIT
Full Stack Online Course in Marathahalli| AchieversITFull Stack Online Course in Marathahalli| AchieversIT
Full Stack Online Course in Marathahalli| AchieversIT
AchieversITAravind
 
The Ring programming language version 1.5.2 book - Part 176 of 181
The Ring programming language version 1.5.2 book - Part 176 of 181The Ring programming language version 1.5.2 book - Part 176 of 181
The Ring programming language version 1.5.2 book - Part 176 of 181
Mahmoud Samir Fayed
 
New c sharp4_features_part_vi
New c sharp4_features_part_viNew c sharp4_features_part_vi
New c sharp4_features_part_vi
Nico Ludwig
 
The Ring programming language version 1.5.4 book - Part 180 of 185
The Ring programming language version 1.5.4 book - Part 180 of 185The Ring programming language version 1.5.4 book - Part 180 of 185
The Ring programming language version 1.5.4 book - Part 180 of 185
Mahmoud Samir Fayed
 
Looping and switch cases
Looping and switch casesLooping and switch cases
Looping and switch cases
MeoRamos
 
In-depth look at the Flex compiler and HFCD
In-depth look at the Flex compiler and HFCDIn-depth look at the Flex compiler and HFCD
In-depth look at the Flex compiler and HFCD
Stop Coding
 
JavaScript Miller Columns
JavaScript Miller ColumnsJavaScript Miller Columns
JavaScript Miller Columns
Jonathan Fine
 
Bcsl 031 solve assignment
Bcsl 031 solve assignmentBcsl 031 solve assignment
64-bit Loki
64-bit Loki64-bit Loki
64-bit Loki
PVS-Studio
 
JavaScript
JavaScriptJavaScript
JavaScript
Ivano Malavolta
 
Java - A broad introduction
Java - A broad introductionJava - A broad introduction
Java - A broad introduction
Birol Efe
 

Similar to Stefan Richter - Writing simple, readable and robust code: Examples in Java, Clojure, and Go - code.talks 2015 (20)

Exciting JavaScript - Part II
Exciting JavaScript - Part IIExciting JavaScript - Part II
Exciting JavaScript - Part II
 
What`s New in Java 8
What`s New in Java 8What`s New in Java 8
What`s New in Java 8
 
JUG Münster 2014 - Code Recommenders & Codetrails - Wissenstransfer 2.0
JUG Münster 2014 - Code Recommenders & Codetrails - Wissenstransfer 2.0JUG Münster 2014 - Code Recommenders & Codetrails - Wissenstransfer 2.0
JUG Münster 2014 - Code Recommenders & Codetrails - Wissenstransfer 2.0
 
Core JavaScript
Core JavaScriptCore JavaScript
Core JavaScript
 
Introduction Of C++
Introduction Of C++Introduction Of C++
Introduction Of C++
 
introduction to server-side scripting
introduction to server-side scriptingintroduction to server-side scripting
introduction to server-side scripting
 
Getting started with CATIA V5 Macros
Getting started with CATIA V5 MacrosGetting started with CATIA V5 Macros
Getting started with CATIA V5 Macros
 
Programming in Java: Getting Started
Programming in Java: Getting StartedProgramming in Java: Getting Started
Programming in Java: Getting Started
 
JAVASCRIPT PPT [Autosaved].pptx
JAVASCRIPT PPT [Autosaved].pptxJAVASCRIPT PPT [Autosaved].pptx
JAVASCRIPT PPT [Autosaved].pptx
 
Full Stack Online Course in Marathahalli| AchieversIT
Full Stack Online Course in Marathahalli| AchieversITFull Stack Online Course in Marathahalli| AchieversIT
Full Stack Online Course in Marathahalli| AchieversIT
 
The Ring programming language version 1.5.2 book - Part 176 of 181
The Ring programming language version 1.5.2 book - Part 176 of 181The Ring programming language version 1.5.2 book - Part 176 of 181
The Ring programming language version 1.5.2 book - Part 176 of 181
 
New c sharp4_features_part_vi
New c sharp4_features_part_viNew c sharp4_features_part_vi
New c sharp4_features_part_vi
 
The Ring programming language version 1.5.4 book - Part 180 of 185
The Ring programming language version 1.5.4 book - Part 180 of 185The Ring programming language version 1.5.4 book - Part 180 of 185
The Ring programming language version 1.5.4 book - Part 180 of 185
 
Looping and switch cases
Looping and switch casesLooping and switch cases
Looping and switch cases
 
In-depth look at the Flex compiler and HFCD
In-depth look at the Flex compiler and HFCDIn-depth look at the Flex compiler and HFCD
In-depth look at the Flex compiler and HFCD
 
JavaScript Miller Columns
JavaScript Miller ColumnsJavaScript Miller Columns
JavaScript Miller Columns
 
Bcsl 031 solve assignment
Bcsl 031 solve assignmentBcsl 031 solve assignment
Bcsl 031 solve assignment
 
64-bit Loki
64-bit Loki64-bit Loki
64-bit Loki
 
JavaScript
JavaScriptJavaScript
JavaScript
 
Java - A broad introduction
Java - A broad introductionJava - A broad introduction
Java - A broad introduction
 

More from AboutYouGmbH

Tech talk 01.06.2017
Tech talk 01.06.2017Tech talk 01.06.2017
Tech talk 01.06.2017
AboutYouGmbH
 
Retention Strategies in Mobile E-Commerce
Retention Strategies in Mobile E-CommerceRetention Strategies in Mobile E-Commerce
Retention Strategies in Mobile E-Commerce
AboutYouGmbH
 
Rethinking Fashion E-Commerce
Rethinking Fashion E-CommerceRethinking Fashion E-Commerce
Rethinking Fashion E-Commerce
AboutYouGmbH
 
ABOUT YOU get on board
ABOUT YOU get on boardABOUT YOU get on board
ABOUT YOU get on board
AboutYouGmbH
 
Lars Jankowfsky - Learn or Die - code.talks 2015
Lars Jankowfsky - Learn or Die - code.talks 2015Lars Jankowfsky - Learn or Die - code.talks 2015
Lars Jankowfsky - Learn or Die - code.talks 2015
AboutYouGmbH
 
Dr. Jeremias Rößler - Wenn Affen Testen - Das Ende der Bananensoftware - code...
Dr. Jeremias Rößler - Wenn Affen Testen - Das Ende der Bananensoftware - code...Dr. Jeremias Rößler - Wenn Affen Testen - Das Ende der Bananensoftware - code...
Dr. Jeremias Rößler - Wenn Affen Testen - Das Ende der Bananensoftware - code...
AboutYouGmbH
 
Zeljko Kvesic - Scrum in verteilten Teams / Agil über die Landesgrenzen - cod...
Zeljko Kvesic - Scrum in verteilten Teams / Agil über die Landesgrenzen - cod...Zeljko Kvesic - Scrum in verteilten Teams / Agil über die Landesgrenzen - cod...
Zeljko Kvesic - Scrum in verteilten Teams / Agil über die Landesgrenzen - cod...
AboutYouGmbH
 
Uwe Friedrichsen - CRDT und mehr - über extreme Verfügbarkeit und selbstheile...
Uwe Friedrichsen - CRDT und mehr - über extreme Verfügbarkeit und selbstheile...Uwe Friedrichsen - CRDT und mehr - über extreme Verfügbarkeit und selbstheile...
Uwe Friedrichsen - CRDT und mehr - über extreme Verfügbarkeit und selbstheile...
AboutYouGmbH
 
Kai Voigt - Big Data zum Anfassen - code.talks 2015
Kai Voigt - Big Data zum Anfassen - code.talks 2015Kai Voigt - Big Data zum Anfassen - code.talks 2015
Kai Voigt - Big Data zum Anfassen - code.talks 2015
AboutYouGmbH
 
Dr. Andreas Lattner - Aufsetzen skalierbarer Prognose- und Analysedienste mit...
Dr. Andreas Lattner - Aufsetzen skalierbarer Prognose- und Analysedienste mit...Dr. Andreas Lattner - Aufsetzen skalierbarer Prognose- und Analysedienste mit...
Dr. Andreas Lattner - Aufsetzen skalierbarer Prognose- und Analysedienste mit...
AboutYouGmbH
 
Marcel Hild - Spryker (e)commerce framework als Alternative zu traditioneller...
Marcel Hild - Spryker (e)commerce framework als Alternative zu traditioneller...Marcel Hild - Spryker (e)commerce framework als Alternative zu traditioneller...
Marcel Hild - Spryker (e)commerce framework als Alternative zu traditioneller...
AboutYouGmbH
 
Wolfram Kriesing - EcmaScript6 for real - code.talks 2015
Wolfram Kriesing - EcmaScript6 for real - code.talks 2015Wolfram Kriesing - EcmaScript6 for real - code.talks 2015
Wolfram Kriesing - EcmaScript6 for real - code.talks 2015
AboutYouGmbH
 
Stefanie Grewenig & Johannes Thönes - Internet ausdrucken mit JavaScript - c...
 Stefanie Grewenig & Johannes Thönes - Internet ausdrucken mit JavaScript - c... Stefanie Grewenig & Johannes Thönes - Internet ausdrucken mit JavaScript - c...
Stefanie Grewenig & Johannes Thönes - Internet ausdrucken mit JavaScript - c...
AboutYouGmbH
 
Alex Korotkikh - From 0 to N: Lessons Learned - code.talks 2015
 Alex Korotkikh - From 0 to N: Lessons Learned - code.talks 2015 Alex Korotkikh - From 0 to N: Lessons Learned - code.talks 2015
Alex Korotkikh - From 0 to N: Lessons Learned - code.talks 2015
AboutYouGmbH
 
Christian Haider & Helge Nowak - Mehr Demokratie durch Haushaltstransparenz ...
 Christian Haider & Helge Nowak - Mehr Demokratie durch Haushaltstransparenz ... Christian Haider & Helge Nowak - Mehr Demokratie durch Haushaltstransparenz ...
Christian Haider & Helge Nowak - Mehr Demokratie durch Haushaltstransparenz ...
AboutYouGmbH
 
Bernhard Wick - appserver.io - code.talks 2015
 Bernhard Wick - appserver.io - code.talks 2015 Bernhard Wick - appserver.io - code.talks 2015
Bernhard Wick - appserver.io - code.talks 2015
AboutYouGmbH
 
Moritz Siuts & Robert von Massow - Data Pipeline mit Apache Kafka - code.tal...
 Moritz Siuts & Robert von Massow - Data Pipeline mit Apache Kafka - code.tal... Moritz Siuts & Robert von Massow - Data Pipeline mit Apache Kafka - code.tal...
Moritz Siuts & Robert von Massow - Data Pipeline mit Apache Kafka - code.tal...
AboutYouGmbH
 
Carina Bittihn & Linda Dettmann - Same Same but Different - code.talks 2015
 Carina Bittihn & Linda Dettmann - Same Same but Different - code.talks 2015 Carina Bittihn & Linda Dettmann - Same Same but Different - code.talks 2015
Carina Bittihn & Linda Dettmann - Same Same but Different - code.talks 2015
AboutYouGmbH
 
Dr. Florian Krause - Der Kunde im Fokus: Personalisierte Aussteuerung von Inh...
Dr. Florian Krause - Der Kunde im Fokus: Personalisierte Aussteuerung von Inh...Dr. Florian Krause - Der Kunde im Fokus: Personalisierte Aussteuerung von Inh...
Dr. Florian Krause - Der Kunde im Fokus: Personalisierte Aussteuerung von Inh...
AboutYouGmbH
 
Robert Kubis - gRPC - boilerplate to high-performance scalable APIs - code.t...
 Robert Kubis - gRPC - boilerplate to high-performance scalable APIs - code.t... Robert Kubis - gRPC - boilerplate to high-performance scalable APIs - code.t...
Robert Kubis - gRPC - boilerplate to high-performance scalable APIs - code.t...
AboutYouGmbH
 

More from AboutYouGmbH (20)

Tech talk 01.06.2017
Tech talk 01.06.2017Tech talk 01.06.2017
Tech talk 01.06.2017
 
Retention Strategies in Mobile E-Commerce
Retention Strategies in Mobile E-CommerceRetention Strategies in Mobile E-Commerce
Retention Strategies in Mobile E-Commerce
 
Rethinking Fashion E-Commerce
Rethinking Fashion E-CommerceRethinking Fashion E-Commerce
Rethinking Fashion E-Commerce
 
ABOUT YOU get on board
ABOUT YOU get on boardABOUT YOU get on board
ABOUT YOU get on board
 
Lars Jankowfsky - Learn or Die - code.talks 2015
Lars Jankowfsky - Learn or Die - code.talks 2015Lars Jankowfsky - Learn or Die - code.talks 2015
Lars Jankowfsky - Learn or Die - code.talks 2015
 
Dr. Jeremias Rößler - Wenn Affen Testen - Das Ende der Bananensoftware - code...
Dr. Jeremias Rößler - Wenn Affen Testen - Das Ende der Bananensoftware - code...Dr. Jeremias Rößler - Wenn Affen Testen - Das Ende der Bananensoftware - code...
Dr. Jeremias Rößler - Wenn Affen Testen - Das Ende der Bananensoftware - code...
 
Zeljko Kvesic - Scrum in verteilten Teams / Agil über die Landesgrenzen - cod...
Zeljko Kvesic - Scrum in verteilten Teams / Agil über die Landesgrenzen - cod...Zeljko Kvesic - Scrum in verteilten Teams / Agil über die Landesgrenzen - cod...
Zeljko Kvesic - Scrum in verteilten Teams / Agil über die Landesgrenzen - cod...
 
Uwe Friedrichsen - CRDT und mehr - über extreme Verfügbarkeit und selbstheile...
Uwe Friedrichsen - CRDT und mehr - über extreme Verfügbarkeit und selbstheile...Uwe Friedrichsen - CRDT und mehr - über extreme Verfügbarkeit und selbstheile...
Uwe Friedrichsen - CRDT und mehr - über extreme Verfügbarkeit und selbstheile...
 
Kai Voigt - Big Data zum Anfassen - code.talks 2015
Kai Voigt - Big Data zum Anfassen - code.talks 2015Kai Voigt - Big Data zum Anfassen - code.talks 2015
Kai Voigt - Big Data zum Anfassen - code.talks 2015
 
Dr. Andreas Lattner - Aufsetzen skalierbarer Prognose- und Analysedienste mit...
Dr. Andreas Lattner - Aufsetzen skalierbarer Prognose- und Analysedienste mit...Dr. Andreas Lattner - Aufsetzen skalierbarer Prognose- und Analysedienste mit...
Dr. Andreas Lattner - Aufsetzen skalierbarer Prognose- und Analysedienste mit...
 
Marcel Hild - Spryker (e)commerce framework als Alternative zu traditioneller...
Marcel Hild - Spryker (e)commerce framework als Alternative zu traditioneller...Marcel Hild - Spryker (e)commerce framework als Alternative zu traditioneller...
Marcel Hild - Spryker (e)commerce framework als Alternative zu traditioneller...
 
Wolfram Kriesing - EcmaScript6 for real - code.talks 2015
Wolfram Kriesing - EcmaScript6 for real - code.talks 2015Wolfram Kriesing - EcmaScript6 for real - code.talks 2015
Wolfram Kriesing - EcmaScript6 for real - code.talks 2015
 
Stefanie Grewenig & Johannes Thönes - Internet ausdrucken mit JavaScript - c...
 Stefanie Grewenig & Johannes Thönes - Internet ausdrucken mit JavaScript - c... Stefanie Grewenig & Johannes Thönes - Internet ausdrucken mit JavaScript - c...
Stefanie Grewenig & Johannes Thönes - Internet ausdrucken mit JavaScript - c...
 
Alex Korotkikh - From 0 to N: Lessons Learned - code.talks 2015
 Alex Korotkikh - From 0 to N: Lessons Learned - code.talks 2015 Alex Korotkikh - From 0 to N: Lessons Learned - code.talks 2015
Alex Korotkikh - From 0 to N: Lessons Learned - code.talks 2015
 
Christian Haider & Helge Nowak - Mehr Demokratie durch Haushaltstransparenz ...
 Christian Haider & Helge Nowak - Mehr Demokratie durch Haushaltstransparenz ... Christian Haider & Helge Nowak - Mehr Demokratie durch Haushaltstransparenz ...
Christian Haider & Helge Nowak - Mehr Demokratie durch Haushaltstransparenz ...
 
Bernhard Wick - appserver.io - code.talks 2015
 Bernhard Wick - appserver.io - code.talks 2015 Bernhard Wick - appserver.io - code.talks 2015
Bernhard Wick - appserver.io - code.talks 2015
 
Moritz Siuts & Robert von Massow - Data Pipeline mit Apache Kafka - code.tal...
 Moritz Siuts & Robert von Massow - Data Pipeline mit Apache Kafka - code.tal... Moritz Siuts & Robert von Massow - Data Pipeline mit Apache Kafka - code.tal...
Moritz Siuts & Robert von Massow - Data Pipeline mit Apache Kafka - code.tal...
 
Carina Bittihn & Linda Dettmann - Same Same but Different - code.talks 2015
 Carina Bittihn & Linda Dettmann - Same Same but Different - code.talks 2015 Carina Bittihn & Linda Dettmann - Same Same but Different - code.talks 2015
Carina Bittihn & Linda Dettmann - Same Same but Different - code.talks 2015
 
Dr. Florian Krause - Der Kunde im Fokus: Personalisierte Aussteuerung von Inh...
Dr. Florian Krause - Der Kunde im Fokus: Personalisierte Aussteuerung von Inh...Dr. Florian Krause - Der Kunde im Fokus: Personalisierte Aussteuerung von Inh...
Dr. Florian Krause - Der Kunde im Fokus: Personalisierte Aussteuerung von Inh...
 
Robert Kubis - gRPC - boilerplate to high-performance scalable APIs - code.t...
 Robert Kubis - gRPC - boilerplate to high-performance scalable APIs - code.t... Robert Kubis - gRPC - boilerplate to high-performance scalable APIs - code.t...
Robert Kubis - gRPC - boilerplate to high-performance scalable APIs - code.t...
 

Recently uploaded

快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
3a0sd7z3
 
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
fovkoyb
 
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaalmanuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
wolfsoftcompanyco
 
办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理
办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理
办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理
uehowe
 
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
3a0sd7z3
 
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
rtunex8r
 
一比一原版(USYD毕业证)悉尼大学毕业证如何办理
一比一原版(USYD毕业证)悉尼大学毕业证如何办理一比一原版(USYD毕业证)悉尼大学毕业证如何办理
一比一原版(USYD毕业证)悉尼大学毕业证如何办理
k4ncd0z
 
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
uehowe
 
Ready to Unlock the Power of Blockchain!
Ready to Unlock the Power of Blockchain!Ready to Unlock the Power of Blockchain!
Ready to Unlock the Power of Blockchain!
Toptal Tech
 
Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?
Paul Walk
 
Bengaluru Dreamin' 24 - Personal Branding
Bengaluru Dreamin' 24 - Personal BrandingBengaluru Dreamin' 24 - Personal Branding
Bengaluru Dreamin' 24 - Personal Branding
Tarandeep Singh
 
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
ysasp1
 
HijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process HollowingHijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process Hollowing
Donato Onofri
 
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
xjq03c34
 
Discover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to IndiaDiscover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to India
davidjhones387
 
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
uehowe
 

Recently uploaded (16)

快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
 
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
 
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaalmanuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
 
办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理
办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理
办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理
 
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
 
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
 
一比一原版(USYD毕业证)悉尼大学毕业证如何办理
一比一原版(USYD毕业证)悉尼大学毕业证如何办理一比一原版(USYD毕业证)悉尼大学毕业证如何办理
一比一原版(USYD毕业证)悉尼大学毕业证如何办理
 
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
 
Ready to Unlock the Power of Blockchain!
Ready to Unlock the Power of Blockchain!Ready to Unlock the Power of Blockchain!
Ready to Unlock the Power of Blockchain!
 
Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?
 
Bengaluru Dreamin' 24 - Personal Branding
Bengaluru Dreamin' 24 - Personal BrandingBengaluru Dreamin' 24 - Personal Branding
Bengaluru Dreamin' 24 - Personal Branding
 
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
 
HijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process HollowingHijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process Hollowing
 
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
 
Discover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to IndiaDiscover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to India
 
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
 

Stefan Richter - Writing simple, readable and robust code: Examples in Java, Clojure, and Go - code.talks 2015

  • 1. Writing Simple, Readable and Robust Code: Examples in Java, Clojure, and Go freiheit.com technologies - Hamburg, September 30, 2015 code.talks 2015
  • 2. © freiheit.com 2 Hi! I am Stefan Richter. I started programming on an Apple ][ in 1983. Since 1998, I run my own software company, which is specialized in large Internet systems. WHO AM I? Working as a professional programmer Running my own company 20102005199819951990198719831966 Apple II, Pascal, C64, 6502 VAX, Unix, C, 4GLs, Smalltalk, Lisp, Scheme Unix, C, 4 GLs, (Windows NT, VB (!)) Linux, Java, Python, Ruby, Objective-C, C/C++, Common Lisp, Clojure, JavaScript, Go ... Future University studies and work as a programmer in research institutes
  • 3. SO LET’S GET STARTED AND HAVE SOME FUN! :)
  • 4. According to Wikipedia a domain- specific language (DSL) is a “... programming language or specification language dedicated to a particular problem domain [...].“ © freiheit.com 4
  • 5. I guess, we find DSLs so compelling because sooner or later every programmer dreams of creating his/her own programming language. ;) © freiheit.com 5
  • 6. Let’s take an example from a person you all know: Martin Fowler. In 2005, he posted an article on his homepage about domain-specific languages ... © freiheit.com 6
  • 8. Fowler creates a DSL to read files in a fixed-length format and to convert each line into an object. This is the file format and the mapping spec: 8© freiheit.com
  • 9. He uses C#, but as C# is more or less a Java clone you will agree that the Java code would look almost exactly the same. © freiheit.com 9
  • 10. Line by line, he reads the file and dispatches the conversion to a strategy class. 10© freiheit.com
  • 11. The strategy class is parameterized with the type code and the target class ... 11© freiheit.com
  • 12. The individual fields in each line are read by a FieldExtractor class ... 12© freiheit.com
  • 13. To process the line, the strategy creates the target class and uses the extractors to get the field data ... 13© freiheit.com
  • 14. The FieldExtractor pulls out the data and sets the correct field in the target class by using reflection ... 14© freiheit.com
  • 15. Now you have an API that can be configured at compile time ... 15© freiheit.com
  • 16. If you would like to do this in a declarative style, you need an XML configuration ... (arrggh) 16© freiheit.com
  • 17. Fowler’s example shows about 70 lines of code (LOC). But the code is not complete. I guess, the complete example would be around 200 LOC Java. © freiheit.com 17
  • 18. HMM. SO MUCH CODE FOR A SIMPLE PROBLEM.
  • 19. Ideally, you would like to have something like this as a mini DSL: 19© freiheit.com
  • 20. The Common Lisp Community picked up Fowler’s article, because he mentioned Lisp favorably. © freiheit.com 20
  • 21. Rainer Joswig then proposed this DSL in comp. lang.lisp: 21© freiheit.com
  • 22. His solution is a 12 LOC Lisp macro …, 22© freiheit.com ... which expands to this code:
  • 23. Let’s examine how macros work. We’ll use the Common Lisp code as an example. It’s very close to how macros look like in Clojure! I’ll show you later! :) © freiheit.com 23
  • 24. • Basically, a Lisp macro is a code generator. But you can’t compare Lisp macros with C macros or any other macro or template system. • Lisp programs are trees of expressions. Code is data. Data is code. • This is why a Lisp program can modify itself. • In a nutshell - “How to read Lisp macros“: • Macros don’t evaluate their parameters. • The backtick (`) says: „Don’t evaluate the following code.“ • The comma (,) says: „Evaluate the following code and replace it with the result.“ • Then: Evaluate all resulting code together. • Read Peter Seibel’s „Practical Common Lisp“ to learn more ... 24© freiheit.com
  • 25. • defclass creates a new CLOS class. In CLOS methods are defined independently of the class definition, but getter/setter can be defined implicitly. • Methods are specialized on their parameters. So each method can be specialized to more than one class! Think about this for a moment ... • You can even specialize a method depending on what exact value is passed as a parameter. So you can have special methods for specific parameter values. In this example, parse-line-for-class is called, when you pass a class with the name “service-call“. (Which in turn is generated by this macro, too). • This method then takes the class, instantiates it and sets (side effect) its member variables by taking the format specification and using a substring function to extract the right bits and pieces from the input line. (This is not pure functional style, but this is how you use Common Lisp with CLOS.) 25© freiheit.com
  • 26. To read from a file and apply the mappings Rainer Joswig then wrote this code: 26© freiheit.com
  • 27. Obviously, the Common Lisp version works almost the same as Martin Fowler’s C# version, with much less code. Rainer Joswig’s solution is functionally complete. Let’s do this in Clojure now! © freiheit.com 27
  • 28. One thing: Some people in the Clojure community say that you should not use macros. You will soon see why. But I disagree! Macros are one of the reasons why you should favor Lisp-like languages over other languages. © freiheit.com 28
  • 29. NOW THAT YOU ARE EXPERTS ON COMMON LISP MACRO, I WILL SHOW YOU THE FIRST CLOJURE VERSION STRAIGHT AWAY!
  • 30. 30© freiheit.com • We create a list of the field names because we need them two times in the code. • defrecord creates a Clojure data structure with the look and feel of a hash table. • But it is much more: Under the hood, this is a Java class! And even more! • This is why you need a constructor function to create a “record“. I generate the name of the constructor function by appending “.“ to the record name. • I create a multimethod, which is specialized on the value of the mapping parameter. So Clojure “knows“, which method to call based on the input ... • Then, I create a list of all values from the input line (in the same order as their field names) and apply this list to the constructor of the record, which is returned as the function value.
  • 31. To make it complete: defmethod needs a defmulti to provide a dispatching function. 31© freiheit.com • Meaning: Take the first four characters of the value of the parameter “line“ (which should be a java.lang. String) and then call the multimethod, which is specialized on this value. • (Note: Of course, you have to handle the cases: What happens when you have an empty line, an unknown mapping or a comment line. But I leave this out here to keep the example simple, even though this is just five lines more including another defmethod, which handles all these :default cases).
  • 32. 32© freiheit.com • In a nutshell “How to read Clojure macros“: • The backtick (`) says: „Don‘t evaluate the following code.“ • The tilde (~) says: „Evaluate the following code and replace it with the result.“ • ~@ means: “Evaluate the following code and replace it with the result, but don’t put parentheses around the result.“ (This is called „splicing“.) • The hash sign (#) at the end of a variable is used to automatically create unique variable names in the code created by the macro. This is called auto-gensyms. This way you can prevent name clashes with call parameters.
  • 33. Finally, this Clojure macro expands to the following code. Can you see the automatically generated variable names? 33© freiheit.com
  • 34. Now we can define mappings as follows: 34© freiheit.com Actually, the leading 0 doesn’t work here. Leading zeros are reserved for octal numbers.
  • 35. LET US BUILD SOMETHING TO CONVENIENTLY USE THESE MAPPINGS!
  • 36. This is a classic with-macro that you often find in the Common Lisp world. 36© freiheit.com • It reads the file identified by file name line by line. • It calls our multimethod parse line for each line. • It binds the result to a variable that you can hand over to the macro (binding). • And only if parsing the line has a result (no empty line, no comment line or unknown binding), it executes the body, meaning the code that you can hand over to this macro, which can contain the variable, which contains the binding. • Then it returns a list of the results. • Sounds difficult, but with the example on the next page you will find it to be very simple.
  • 37. In this example, we just extract the customer name from each line. 37© freiheit.com • For each valid line in the file specified by file name (*testdata* contains the file name as a string) a Clojure record is created. • Each result is bound in this case to the symbol/variable “obj“. • In the body code you can use this symbol/variable to access this Clojure record. • In this case, we use it to extract the customer name from the record. • with-mappings then returns a list of the results.
  • 38. Isn’t this awesome?! We have just defined two new programming constructs and added them to our programming language: defmapping, with-mappings. © freiheit.com 38
  • 39. The complete example is about 30 LOC of Clojure. You don’t need any special tools (Language Workbench). It’s all right there in the Clojure language. And you just need Emacs to unleash this power ... © freiheit.com 39
  • 40. Now I can extend this without breaking the existing code. © freiheit.com 40
  • 41. Let’s add a serializer to create JSON from the data ... © freiheit.com 41
  • 42. We define a protocol and add an implementation to the record definition. 42© freiheit.com
  • 43. Now we can convert the data to JSON. 43© freiheit.com And we can even change the serialize method „in place“ and on the fly.
  • 44. © freiheit.com GOTO Conference Copenhagen, 2011 “LISP ISN’T A LANGUAGE, IT’S A BUILDING MATERIAL.“ - ALAN KAY
  • 45. And Clojure gives you powerful abstractions that you won’t find in any other programming language. Some stuff is only possible in a Lisp-like language ... with all these parenthesis. ;) © freiheit.com 45
  • 46. © freiheit.com GOTO Conference Copenhagen, 2011 IT IS COOL. I LOVE THIS. BUT IS THIS REALLY SIMPLE? LET’S DO THIS IN GO!
  • 47. © freiheit.com GOTO Conference Copenhagen, 2011 LIVE CODING
  • 48. THANK YOU freiheit.com technologies Budapester Str. 45 20359 Hamburg, Germany kontakt@freiheit.com T +49 40 890584 0 F +49 40 890584 20