SlideShare a Scribd company logo
1 of 45
Download to read offline
Why Clojure?
Why Clojure?
 Why was it created?

What do we mean with
    complexity?

How does clojure makes
 things more simple?
When was Clojure
● 2007: introduction by Rich Hickey

● 2009: version 1.0

  ....

● 2013: version 1.5
What is Clojure
● A Lisp

● for Functional Programming

● Running on the JVM, CLR and browsers

● Designed for concurrency
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
Functional Programming
● Provides a way out of the multi-core
  conundrum

● Makes programs simpler by decomplecting
  them.
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.
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.
Why is Clojure
● Reducing complexity

● to be easy? not exactly...
What do we mean with
● Complex

● Simple

● Hard

● Easy
Complexity




                    Complex

Consisting of many different and connected parts.

   To Complect
   be interwoven or interconnected
Complexity

Simple




Complex
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
Complexity




Simple                Easy
Complexity


Complex                Hard




Simple                 Easy
Complexity
Objective                             Subjective

Complex                                  Hard

      "Elegance and familiarity are
      orthogonal."
              — Rich Hickey




 Simple                                  Easy
Types of Complexity
● Essential Complexity



● Accidental Complexity
Examples of complexity
● State

● Inheritance

● Objects
  ○ state
  ○ identity
  ○ value

● Memory management
● Variables
Why does simple matter?
● Formal reasoning
   ○ can be hard

● Extendability
   ○ Composing


● Testability
   ○ isolation
How is Clojure simple(r)
● Functional Programming
   ○ Pure functions

● Immutable data structures

● Thinking with data

● Decomplecting state / value / identity
Immutability
● Numbers are immutable in your language

● If you use Java, Strings are immutable

● Imagine if they're not!
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
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
Thinking with data
● data is simple

● Clojure map
Thinking with data


; Get the first name
(get-in person [:name :first-name])

; Get all birth dates from a list of persons.
(map :birthdate people)
Identity/state/value model
● Object Oriented Approach
                                   Memory

                                   SpaceShip

ship1                        - name
                             -x
                             -y
                             - velocity
Identity/state/value model
● Object Oriented Approach

● Problems
  ○ Stable value

  ○ history (snapshot)

  ○ Concurrent modification
Stable value
● Spaceship
  ○ position
    ■ x,y
    ■ Position object

  ○ velocity
    ■ MovementState
Stable value
● Spaceship
  ○ position
    ■ x,y
    ■ Position object

  ○ velocity
    ■ MovementState

  ○ ...


  ○ Consistent and stable object!
Stable value
● Spaceship
  ○ position
    ■ x,y
    ■ Position object

  ○ velocity
    ■ MovementState

  ○ ...


  ○ Consistent and stable object! NO!
Stable value
● Creating the object

● Not consistent
Identity/state/value model
● Object Oriented Approach

● Problems
  ○ Stable value

  ○ history (snapshot)

  ○ Concurrent modification
Snapshot & history
● Take a picture

● Look later at it again.
Identity/state/value model
● Object Oriented Approach

● Problems
  ○ Stable value

  ○ history (snapshot)

  ○ Concurrent modification
Concurrent modification
● Guarantee consistency?

● Stop the world!
Clojure approach
● Remove ambiguity of definitions
  ○ value
  ○ state
  ○ identity
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
Identity/state/value model
● OOP
  ○ complects state and identity



● Clojure
  ○ Separation value / state / identity

  ○ Perception becomes possible

  ○ Consistency management trivial
Clojure reference model

                                 Value
                         :name Heart Of Gold
                         :position (0,0)
                         :velocity 100 km/s
              Ref
ship1
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
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
Clojure reference model
● Perception without stopping the world


● Atomic updates
  ○ Transactions
Why Clojure?
  Simplicity

Expressiveness

 Concurrency
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
Why Clojure?




  ?

More Related Content

Similar to Why clojure

"Testing of Helm Charts or There and Back Again", Yura Rochniak
"Testing of Helm Charts or There and Back Again", Yura Rochniak"Testing of Helm Charts or There and Back Again", Yura Rochniak
"Testing of Helm Charts or There and Back Again", Yura RochniakFwdays
 
Object Oriented Programming_combined.ppt.pdf
Object Oriented Programming_combined.ppt.pdfObject Oriented Programming_combined.ppt.pdf
Object Oriented Programming_combined.ppt.pdfAshutoshKumar211882
 
The power of datomic
The power of datomicThe power of datomic
The power of datomicKonrad Szydlo
 
Scala at HUJI PL Seminar 2008
Scala at HUJI PL Seminar 2008Scala at HUJI PL Seminar 2008
Scala at HUJI PL Seminar 2008Yardena Meymann
 
The Bleeding Edge
The Bleeding EdgeThe Bleeding Edge
The Bleeding EdgejClarity
 
Java Building Blocks
Java Building BlocksJava Building Blocks
Java Building BlocksCate Huston
 
Introduction to Clojure - EDGE Lviv
Introduction to Clojure - EDGE LvivIntroduction to Clojure - EDGE Lviv
Introduction to Clojure - EDGE Lvivzenyk
 
Fields in Java and Kotlin and what to expect.pptx
Fields in Java and Kotlin and what to expect.pptxFields in Java and Kotlin and what to expect.pptx
Fields in Java and Kotlin and what to expect.pptxJoão Esperancinha
 
Reactive Software Systems
Reactive Software SystemsReactive Software Systems
Reactive Software SystemsBehrad Zari
 
Design Patterns Illustrated
Design Patterns IllustratedDesign Patterns Illustrated
Design Patterns IllustratedHerman Peeren
 
Concurrency and Multithreading Demistified - Reversim Summit 2014
Concurrency and Multithreading Demistified - Reversim Summit 2014Concurrency and Multithreading Demistified - Reversim Summit 2014
Concurrency and Multithreading Demistified - Reversim Summit 2014Haim Yadid
 
Solid modeling
Solid modelingSolid modeling
Solid modelingKRvEsL
 
Charles nutter star techconf 2011 - jvm languages
Charles nutter   star techconf 2011 - jvm languagesCharles nutter   star techconf 2011 - jvm languages
Charles nutter star techconf 2011 - jvm languagesStarTech Conference
 
Melbourne, Australia Global Day of Code Retreat 2018 gdcr18 - Event Slides
Melbourne, Australia Global Day of Code Retreat 2018 gdcr18 - Event SlidesMelbourne, Australia Global Day of Code Retreat 2018 gdcr18 - Event Slides
Melbourne, Australia Global Day of Code Retreat 2018 gdcr18 - Event SlidesVictoria Schiffer
 

Similar to Why clojure (20)

"Testing of Helm Charts or There and Back Again", Yura Rochniak
"Testing of Helm Charts or There and Back Again", Yura Rochniak"Testing of Helm Charts or There and Back Again", Yura Rochniak
"Testing of Helm Charts or There and Back Again", Yura Rochniak
 
Object Oriented Programming_combined.ppt.pdf
Object Oriented Programming_combined.ppt.pdfObject Oriented Programming_combined.ppt.pdf
Object Oriented Programming_combined.ppt.pdf
 
Children of Ruby
Children of RubyChildren of Ruby
Children of Ruby
 
The power of datomic
The power of datomicThe power of datomic
The power of datomic
 
Yes scala can!
Yes scala can!Yes scala can!
Yes scala can!
 
Scala at HUJI PL Seminar 2008
Scala at HUJI PL Seminar 2008Scala at HUJI PL Seminar 2008
Scala at HUJI PL Seminar 2008
 
Go_ Get iT! .pdf
Go_ Get iT! .pdfGo_ Get iT! .pdf
Go_ Get iT! .pdf
 
Ooad Uml
Ooad UmlOoad Uml
Ooad Uml
 
The Bleeding Edge
The Bleeding EdgeThe Bleeding Edge
The Bleeding Edge
 
The Bleeding Edge
The Bleeding EdgeThe Bleeding Edge
The Bleeding Edge
 
Java Building Blocks
Java Building BlocksJava Building Blocks
Java Building Blocks
 
Introduction to Clojure - EDGE Lviv
Introduction to Clojure - EDGE LvivIntroduction to Clojure - EDGE Lviv
Introduction to Clojure - EDGE Lviv
 
Fields in Java and Kotlin and what to expect.pptx
Fields in Java and Kotlin and what to expect.pptxFields in Java and Kotlin and what to expect.pptx
Fields in Java and Kotlin and what to expect.pptx
 
JavaScript Data Types
JavaScript Data TypesJavaScript Data Types
JavaScript Data Types
 
Reactive Software Systems
Reactive Software SystemsReactive Software Systems
Reactive Software Systems
 
Design Patterns Illustrated
Design Patterns IllustratedDesign Patterns Illustrated
Design Patterns Illustrated
 
Concurrency and Multithreading Demistified - Reversim Summit 2014
Concurrency and Multithreading Demistified - Reversim Summit 2014Concurrency and Multithreading Demistified - Reversim Summit 2014
Concurrency and Multithreading Demistified - Reversim Summit 2014
 
Solid modeling
Solid modelingSolid modeling
Solid modeling
 
Charles nutter star techconf 2011 - jvm languages
Charles nutter   star techconf 2011 - jvm languagesCharles nutter   star techconf 2011 - jvm languages
Charles nutter star techconf 2011 - jvm languages
 
Melbourne, Australia Global Day of Code Retreat 2018 gdcr18 - Event Slides
Melbourne, Australia Global Day of Code Retreat 2018 gdcr18 - Event SlidesMelbourne, Australia Global Day of Code Retreat 2018 gdcr18 - Event Slides
Melbourne, Australia Global Day of Code Retreat 2018 gdcr18 - Event Slides
 

Recently uploaded

ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 

Recently uploaded (20)

ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 

Why clojure

  • 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
  • 6. Functional Programming ● Provides a way out of the multi-core conundrum ● Makes programs simpler by decomplecting them.
  • 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
  • 15. Complexity Complex Hard Simple Easy
  • 16. Complexity Objective Subjective Complex Hard "Elegance and familiarity are orthogonal." — Rich Hickey Simple Easy
  • 17. Types of Complexity ● Essential Complexity ● Accidental 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
  • 24. Thinking with data ● data is simple ● Clojure map
  • 25. Thinking with data ; Get the first name (get-in person [:name :first-name]) ; Get all birth dates from a list of persons. (map :birthdate people)
  • 26. Identity/state/value model ● Object Oriented Approach Memory SpaceShip ship1 - name -x -y - velocity
  • 27. Identity/state/value model ● Object Oriented Approach ● Problems ○ Stable value ○ history (snapshot) ○ Concurrent modification
  • 28. Stable value ● Spaceship ○ position ■ x,y ■ Position object ○ velocity ■ MovementState
  • 29. Stable value ● Spaceship ○ position ■ x,y ■ Position object ○ velocity ■ MovementState ○ ... ○ Consistent and stable object!
  • 30. Stable value ● Spaceship ○ position ■ x,y ■ Position object ○ velocity ■ MovementState ○ ... ○ Consistent and stable object! NO!
  • 31. Stable value ● Creating the object ● Not consistent
  • 32. Identity/state/value model ● Object Oriented Approach ● Problems ○ Stable value ○ history (snapshot) ○ Concurrent modification
  • 33. Snapshot & history ● Take a picture ● Look later at it again.
  • 34. Identity/state/value model ● Object Oriented Approach ● Problems ○ Stable value ○ history (snapshot) ○ Concurrent modification
  • 35. Concurrent modification ● Guarantee consistency? ● Stop the world!
  • 36. Clojure approach ● Remove ambiguity of definitions ○ value ○ state ○ identity
  • 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
  • 42. Clojure reference model ● Perception without stopping the world ● Atomic updates ○ Transactions
  • 43. Why Clojure? Simplicity Expressiveness Concurrency
  • 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