SlideShare ist ein Scribd-Unternehmen logo
1 von 45
Downloaden Sie, um offline zu lesen
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?




  ?

Weitere ähnliche Inhalte

Ähnlich wie 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
 

Ähnlich wie 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
 

Kürzlich hochgeladen

The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesManik S Magar
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 

Kürzlich hochgeladen (20)

The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 

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