Talk on why clojure was created. This talk was given at the first belgian clojure meetup 27th of march 2013 in mechelen.
Read the debriefing of this meetup:
https://tgoossens.wordpress.com/2013/04/04/first-belgian-clojure-meetup-debriefing/
2. Why Clojure?
Why was it created?
What do we mean with
complexity?
How does clojure makes
things more simple?
3. When was Clojure
● 2007: introduction by Rich Hickey
● 2009: version 1.0
....
● 2013: version 1.5
4. What is Clojure
● A Lisp
● for Functional Programming
● Running on the JVM, CLR and browsers
● Designed for concurrency
5. A Lisp
Many concepts of Lisps are taken over by other
languages:
● Conditionals
● First-class functions
● Recursion
● Garbage collection
● Programs made up out of expressions
7. Running on the JVM, CLR, browser
● JVM / CLR have huge benefits:
○ Libraries
○ Memory and resource management
○ Efficient and robust
● JavaScript has a huge reach:
○ It's the most widely deployed language
○ Through ClojureScript, we can target everywhere
JavaScript runs.
● Clojure is symbiotic with its host platform.
8. Designed for Concurrency
● Machines are not getting faster, they just
have more cores.
● Shared access to mutable state makes
multi-core programming a nightmare.
● Immutability makes many of the problems go
away.
● Separating identity and state can solve all
the other problems.
9. Why is Clojure
● Reducing complexity
● to be easy? not exactly...
10. What do we mean with
● Complex
● Simple
● Hard
● Easy
11. Complexity
Complex
Consisting of many different and connected parts.
To Complect
be interwoven or interconnected
13. How I/we made things complex
● Teamwork
● Robots
○ Explore unknown maze
○ Detect barcodes --> action
○ Travel over seesaw
● How to test?
○ We couldn't
● Unmanageable complexity
18. Examples of complexity
● State
● Inheritance
● Objects
○ state
○ identity
○ value
● Memory management
● Variables
19. Why does simple matter?
● Formal reasoning
○ can be hard
● Extendability
○ Composing
● Testability
○ isolation
20. How is Clojure simple(r)
● Functional Programming
○ Pure functions
● Immutable data structures
● Thinking with data
● Decomplecting state / value / identity
21. Immutability
● Numbers are immutable in your language
● If you use Java, Strings are immutable
● Imagine if they're not!
22. Immutable building blocks
● Primitives: numbers, strings
● Collections: lists, vectors, strings, maps, sets
● "Changing" a collection creates an (efficient)
copy. (think: Git)
● Don't worry about state
23. Thinking with data
● data is simple
● Why wrap it in classes
"It is better to have 100 functions operate on one data
structure than 10 functions on 10 data structures."
— Alan Perlis
37. Identity/state/value model
● Value
○ fixed: 42 , "answer"
● Identity
○ series of different values over time
Me, a car,
● State
○ Value of an identity at a certain point in time
38. Identity/state/value model
● OOP
○ complects state and identity
● Clojure
○ Separation value / state / identity
○ Perception becomes possible
○ Consistency management trivial
39. Clojure reference model
Value
:name Heart Of Gold
:position (0,0)
:velocity 100 km/s
Ref
ship1
40. Clojure reference model
Value
:name Heart Of Gold
:position (0,0)
:velocity 100 km/s
Ref
ship1
Value
:name Heart Of Gold
:position (100,100)
:velocity 100 km/s
41. Clojure reference model
Value
:name Heart Of Gold
:position (0,0)
:velocity 100 km/s
Ref
ship1
Value
:name Heart Of Gold
:position (100,100)
:velocity 100 km/s
44. Why Clojure?
Are we there yet?
http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey
Simple made easy
http://www.infoq.com/presentations/Simple-Made-Easy
Out of The Tarpit
http://shaffner.us/cs/papers/tarpit.pdf