SlideShare uma empresa Scribd logo
1 de 19
Not Everything is an Object By @garyshort
Agenda The road to here Where we are now What OOD/P is good for What it’s not good for The solution Demo Questions.
The Road to Here http://www.flickr.com/photos/fyngyrz/
Where we are Now http://www.flickr.com/photos/gtarded/
What OOP/D is Good For http://www.flickr.com/photos/gserafini/
What is it Not Good For? http://www.flickr.com/photos/aloshbennett/
The Solution
What Does it Mean to be Functional? First order functions Function like constructs Stateless Immutable data.
Clojure A Lisp Dynamic Functional Impure “Lockless” Concurrency Macros ,[object Object]
Java Interop
Fast
Persistent collections
Easy to learn.,[object Object]
Persistent Collections Immutable Cheap to copy Examples (1 2 3) List – sequential lookup time [1 2 3] Vector – logarithmic lookup time {“key” 1, 3 7, “foo” “bar”} Hashmap – unordered, key value pairs.
Equality Vs Identity Equality Two objects are equal Two cylinders maybe equal if their volumes are equal Identity Two pointers to the same object Clojure favours equality :-O.
Clojure is Impure so has Mutability Var Mutable pointer to immutable data You can’t change the data But you can change what data the var points to But vars hold global data, function defs etc . This data won’t change So why are vars mutable? So we can patch running software. 
The Reader Other programming languages Compiler Text -> lexing and parsing -> AST Clojure The Reader Text -> lexing and parsing -> Literals (Data) As soon as it reads a complete literal it’s passed to...
The Evaluator Compile Phase Traverses the data Symbol evaluation Symbols evaluate into Vars Symbol Dog evaluates to a var in the current namespace Symbol MyPets/Dog evaluates to var in namespace MyPets List evaluation Lists evaluate into function calls (+ 1 2 3) Process macros Execute phase Effects the special forms Calls functions.
Special Forms Reserved symbol Denotes special list evaluation Not a function call – it’s “something else” Def, if, do, let, quote, var, fn, loop, recur, throw, try, ., new, set! If a list starts with any of those it’s evaluated in a special way particular to that form (if condition a b?) (if (been_drinking) (hungover) (happy)) (if (have_beers) (drink))

Mais conteúdo relacionado

Mais procurados

Static vs dynamic types
Static vs dynamic typesStatic vs dynamic types
Static vs dynamic typesTerence Parr
 
Introduction to Functional Programming and Clojure
Introduction to Functional Programming and ClojureIntroduction to Functional Programming and Clojure
Introduction to Functional Programming and ClojureSoumendra Daas
 
JavaScript Introductin to Functions
JavaScript Introductin to FunctionsJavaScript Introductin to Functions
JavaScript Introductin to FunctionsCharles Russell
 
Language portfolio
Language portfolioLanguage portfolio
Language portfolioDhaval Dalal
 
Generics of JAVA
Generics of JAVAGenerics of JAVA
Generics of JAVAJai Marathe
 
Java findamentals2
Java findamentals2Java findamentals2
Java findamentals2Todor Kolev
 
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#Dave Fancher
 
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#IndyMobileNetDev
 
JavaScript Beyond jQuery
JavaScript Beyond jQueryJavaScript Beyond jQuery
JavaScript Beyond jQueryBobby Bryant
 
Is Java seen as a pure object-oriented language or not?
Is Java seen as a pure object-oriented language or not?Is Java seen as a pure object-oriented language or not?
Is Java seen as a pure object-oriented language or not?NexSoftsys
 
How to not suck at JavaScript
How to not suck at JavaScriptHow to not suck at JavaScript
How to not suck at JavaScripttmont
 
Raspberry using Python Session 3
Raspberry using Python Session 3Raspberry using Python Session 3
Raspberry using Python Session 3Mohamed Abd Ela'al
 
Annotation based null analysis in Eclipse JDT
Annotation based null analysis in Eclipse JDTAnnotation based null analysis in Eclipse JDT
Annotation based null analysis in Eclipse JDTEclipse Day India
 
Functional programming in scala
Functional programming in scalaFunctional programming in scala
Functional programming in scalaStratio
 

Mais procurados (20)

Static vs dynamic types
Static vs dynamic typesStatic vs dynamic types
Static vs dynamic types
 
Java 8 by example!
Java 8 by example!Java 8 by example!
Java 8 by example!
 
Python if for
Python if forPython if for
Python if for
 
Introduction to Functional Programming and Clojure
Introduction to Functional Programming and ClojureIntroduction to Functional Programming and Clojure
Introduction to Functional Programming and Clojure
 
JavaScript Introductin to Functions
JavaScript Introductin to FunctionsJavaScript Introductin to Functions
JavaScript Introductin to Functions
 
Language portfolio
Language portfolioLanguage portfolio
Language portfolio
 
Python master class 2
Python master class 2Python master class 2
Python master class 2
 
Generics of JAVA
Generics of JAVAGenerics of JAVA
Generics of JAVA
 
Java findamentals2
Java findamentals2Java findamentals2
Java findamentals2
 
Python master class part 1
Python master class part 1Python master class part 1
Python master class part 1
 
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
 
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
 
JavaScript Beyond jQuery
JavaScript Beyond jQueryJavaScript Beyond jQuery
JavaScript Beyond jQuery
 
Value Objects
Value ObjectsValue Objects
Value Objects
 
Is Java seen as a pure object-oriented language or not?
Is Java seen as a pure object-oriented language or not?Is Java seen as a pure object-oriented language or not?
Is Java seen as a pure object-oriented language or not?
 
How to not suck at JavaScript
How to not suck at JavaScriptHow to not suck at JavaScript
How to not suck at JavaScript
 
C# 8 e além
C# 8 e alémC# 8 e além
C# 8 e além
 
Raspberry using Python Session 3
Raspberry using Python Session 3Raspberry using Python Session 3
Raspberry using Python Session 3
 
Annotation based null analysis in Eclipse JDT
Annotation based null analysis in Eclipse JDTAnnotation based null analysis in Eclipse JDT
Annotation based null analysis in Eclipse JDT
 
Functional programming in scala
Functional programming in scalaFunctional programming in scala
Functional programming in scala
 

Destaque

Setting up the Raspberry Pi Using BerryBoot
Setting up the Raspberry Pi Using BerryBootSetting up the Raspberry Pi Using BerryBoot
Setting up the Raspberry Pi Using BerryBootGary Short
 
Connecting to the Raspberry Pi from your Laptop
Connecting to the Raspberry Pi from your LaptopConnecting to the Raspberry Pi from your Laptop
Connecting to the Raspberry Pi from your LaptopGary Short
 
Algorithms - Rocksolid Tour 2013
Algorithms  - Rocksolid Tour 2013Algorithms  - Rocksolid Tour 2013
Algorithms - Rocksolid Tour 2013Gary Short
 
Everything you Wanted to Know About Refactoring
Everything you Wanted to Know About RefactoringEverything you Wanted to Know About Refactoring
Everything you Wanted to Know About RefactoringGary Short
 
.Net Collection Classes Deep Dive - Rocksolid Tour 2013
.Net Collection Classes Deep Dive  - Rocksolid Tour 2013.Net Collection Classes Deep Dive  - Rocksolid Tour 2013
.Net Collection Classes Deep Dive - Rocksolid Tour 2013Gary Short
 
Raspberry Pi - Rocksolid Tour 2013
Raspberry Pi  - Rocksolid Tour 2013Raspberry Pi  - Rocksolid Tour 2013
Raspberry Pi - Rocksolid Tour 2013Gary Short
 
Not Everything is an Object - Rocksolid Tour 2013
Not Everything is an Object  - Rocksolid Tour 2013Not Everything is an Object  - Rocksolid Tour 2013
Not Everything is an Object - Rocksolid Tour 2013Gary Short
 

Destaque (8)

Setting up the Raspberry Pi Using BerryBoot
Setting up the Raspberry Pi Using BerryBootSetting up the Raspberry Pi Using BerryBoot
Setting up the Raspberry Pi Using BerryBoot
 
Connecting to the Raspberry Pi from your Laptop
Connecting to the Raspberry Pi from your LaptopConnecting to the Raspberry Pi from your Laptop
Connecting to the Raspberry Pi from your Laptop
 
marketing
marketingmarketing
marketing
 
Algorithms - Rocksolid Tour 2013
Algorithms  - Rocksolid Tour 2013Algorithms  - Rocksolid Tour 2013
Algorithms - Rocksolid Tour 2013
 
Everything you Wanted to Know About Refactoring
Everything you Wanted to Know About RefactoringEverything you Wanted to Know About Refactoring
Everything you Wanted to Know About Refactoring
 
.Net Collection Classes Deep Dive - Rocksolid Tour 2013
.Net Collection Classes Deep Dive  - Rocksolid Tour 2013.Net Collection Classes Deep Dive  - Rocksolid Tour 2013
.Net Collection Classes Deep Dive - Rocksolid Tour 2013
 
Raspberry Pi - Rocksolid Tour 2013
Raspberry Pi  - Rocksolid Tour 2013Raspberry Pi  - Rocksolid Tour 2013
Raspberry Pi - Rocksolid Tour 2013
 
Not Everything is an Object - Rocksolid Tour 2013
Not Everything is an Object  - Rocksolid Tour 2013Not Everything is an Object  - Rocksolid Tour 2013
Not Everything is an Object - Rocksolid Tour 2013
 

Semelhante a Not Everything Is An Object

Lambda Expressions in Java 8
Lambda Expressions in Java 8Lambda Expressions in Java 8
Lambda Expressions in Java 8icarter09
 
Hipster Oriented Programming
Hipster Oriented ProgrammingHipster Oriented Programming
Hipster Oriented ProgrammingJens Ravens
 
BDX 2016 - Tzach zohar @ kenshoo
BDX 2016 - Tzach zohar  @ kenshooBDX 2016 - Tzach zohar  @ kenshoo
BDX 2016 - Tzach zohar @ kenshooIdo Shilon
 
Functional Programming and Big Data
Functional Programming and Big DataFunctional Programming and Big Data
Functional Programming and Big DataDataWorks Summit
 
Scala Language Intro - Inspired by the Love Game
Scala Language Intro - Inspired by the Love GameScala Language Intro - Inspired by the Love Game
Scala Language Intro - Inspired by the Love GameAntony Stubbs
 
Functional Programming In Jdk8
Functional Programming In Jdk8 Functional Programming In Jdk8
Functional Programming In Jdk8 Bansilal Haudakari
 
Functional Programming
Functional ProgrammingFunctional Programming
Functional ProgrammingRyan Riley
 
Functional programming is the most extreme programming
Functional programming is the most extreme programmingFunctional programming is the most extreme programming
Functional programming is the most extreme programmingsamthemonad
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Pythontswr
 
Scala - the good, the bad and the very ugly
Scala - the good, the bad and the very uglyScala - the good, the bad and the very ugly
Scala - the good, the bad and the very uglyBozhidar Bozhanov
 
EvoPat - Pattern-Based Evolution and Refactoring of RDF Knowledge Bases
EvoPat - Pattern-Based Evolution and Refactoring of RDF Knowledge BasesEvoPat - Pattern-Based Evolution and Refactoring of RDF Knowledge Bases
EvoPat - Pattern-Based Evolution and Refactoring of RDF Knowledge BasesSebastian Tramp
 
code4lib 2011 preconference: What's New in Solr (since 1.4.1)
code4lib 2011 preconference: What's New in Solr (since 1.4.1)code4lib 2011 preconference: What's New in Solr (since 1.4.1)
code4lib 2011 preconference: What's New in Solr (since 1.4.1)Erik Hatcher
 
Scala the-good-parts
Scala the-good-partsScala the-good-parts
Scala the-good-partsFuqiang Wang
 
Mario Fusco - Lazy Java - Codemotion Milan 2018
Mario Fusco - Lazy Java - Codemotion Milan 2018Mario Fusco - Lazy Java - Codemotion Milan 2018
Mario Fusco - Lazy Java - Codemotion Milan 2018Codemotion
 

Semelhante a Not Everything Is An Object (20)

Lambda Expressions in Java 8
Lambda Expressions in Java 8Lambda Expressions in Java 8
Lambda Expressions in Java 8
 
Hipster Oriented Programming
Hipster Oriented ProgrammingHipster Oriented Programming
Hipster Oriented Programming
 
BDX 2016 - Tzach zohar @ kenshoo
BDX 2016 - Tzach zohar  @ kenshooBDX 2016 - Tzach zohar  @ kenshoo
BDX 2016 - Tzach zohar @ kenshoo
 
F# and the DLR
F# and the DLRF# and the DLR
F# and the DLR
 
Functional Programming and Big Data
Functional Programming and Big DataFunctional Programming and Big Data
Functional Programming and Big Data
 
Scala Language Intro - Inspired by the Love Game
Scala Language Intro - Inspired by the Love GameScala Language Intro - Inspired by the Love Game
Scala Language Intro - Inspired by the Love Game
 
Functional Programming In Jdk8
Functional Programming In Jdk8 Functional Programming In Jdk8
Functional Programming In Jdk8
 
Functional Programming
Functional ProgrammingFunctional Programming
Functional Programming
 
Functional programming is the most extreme programming
Functional programming is the most extreme programmingFunctional programming is the most extreme programming
Functional programming is the most extreme programming
 
Oop is not Dead
Oop is not DeadOop is not Dead
Oop is not Dead
 
Presentation
PresentationPresentation
Presentation
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
 
Scala - the good, the bad and the very ugly
Scala - the good, the bad and the very uglyScala - the good, the bad and the very ugly
Scala - the good, the bad and the very ugly
 
EvoPat - Pattern-Based Evolution and Refactoring of RDF Knowledge Bases
EvoPat - Pattern-Based Evolution and Refactoring of RDF Knowledge BasesEvoPat - Pattern-Based Evolution and Refactoring of RDF Knowledge Bases
EvoPat - Pattern-Based Evolution and Refactoring of RDF Knowledge Bases
 
code4lib 2011 preconference: What's New in Solr (since 1.4.1)
code4lib 2011 preconference: What's New in Solr (since 1.4.1)code4lib 2011 preconference: What's New in Solr (since 1.4.1)
code4lib 2011 preconference: What's New in Solr (since 1.4.1)
 
Scala the-good-parts
Scala the-good-partsScala the-good-parts
Scala the-good-parts
 
Lazy Java
Lazy JavaLazy Java
Lazy Java
 
Mario Fusco - Lazy Java - Codemotion Milan 2018
Mario Fusco - Lazy Java - Codemotion Milan 2018Mario Fusco - Lazy Java - Codemotion Milan 2018
Mario Fusco - Lazy Java - Codemotion Milan 2018
 
Lazy java
Lazy javaLazy java
Lazy java
 
Lazy Java
Lazy JavaLazy Java
Lazy Java
 

Último

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 

Último (20)

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 

Not Everything Is An Object

  • 1. Not Everything is an Object By @garyshort
  • 2. Agenda The road to here Where we are now What OOD/P is good for What it’s not good for The solution Demo Questions.
  • 3. The Road to Here http://www.flickr.com/photos/fyngyrz/
  • 4. Where we are Now http://www.flickr.com/photos/gtarded/
  • 5. What OOP/D is Good For http://www.flickr.com/photos/gserafini/
  • 6. What is it Not Good For? http://www.flickr.com/photos/aloshbennett/
  • 8. What Does it Mean to be Functional? First order functions Function like constructs Stateless Immutable data.
  • 9.
  • 11. Fast
  • 13.
  • 14. Persistent Collections Immutable Cheap to copy Examples (1 2 3) List – sequential lookup time [1 2 3] Vector – logarithmic lookup time {“key” 1, 3 7, “foo” “bar”} Hashmap – unordered, key value pairs.
  • 15. Equality Vs Identity Equality Two objects are equal Two cylinders maybe equal if their volumes are equal Identity Two pointers to the same object Clojure favours equality :-O.
  • 16. Clojure is Impure so has Mutability Var Mutable pointer to immutable data You can’t change the data But you can change what data the var points to But vars hold global data, function defs etc . This data won’t change So why are vars mutable? So we can patch running software. 
  • 17. The Reader Other programming languages Compiler Text -> lexing and parsing -> AST Clojure The Reader Text -> lexing and parsing -> Literals (Data) As soon as it reads a complete literal it’s passed to...
  • 18. The Evaluator Compile Phase Traverses the data Symbol evaluation Symbols evaluate into Vars Symbol Dog evaluates to a var in the current namespace Symbol MyPets/Dog evaluates to var in namespace MyPets List evaluation Lists evaluate into function calls (+ 1 2 3) Process macros Execute phase Effects the special forms Calls functions.
  • 19. Special Forms Reserved symbol Denotes special list evaluation Not a function call – it’s “something else” Def, if, do, let, quote, var, fn, loop, recur, throw, try, ., new, set! If a list starts with any of those it’s evaluated in a special way particular to that form (if condition a b?) (if (been_drinking) (hungover) (happy)) (if (have_beers) (drink))
  • 21. I’m Bored... Show me the Code! http://www.flickr.com/photos/peter_hasselbom/

Notas do Editor

  1. Programming languages pre date computers themselves...Starting in 1842 and finishing in 1843 Ada Lovelace translated a memoir of an Italian mathematician on Charles Baggage’s newest proposed machine... the Analytical Engine. The article she wrote contained the entire specification of how to calculate Bernoulli numbers with the Engine. This is believed to be the first ever computer program.Then in the 1940’s along comes the first recognisable computers and we get programming languages to go with them...1943 - Plankalkül (KonradZuse) 1943 - ENIAC coding system1949 - C-10In the 1950s the first three modern programming languages whose descendants are still in widespread use today were designed:FORTRAN (1955), the "FORmulaTRANslator", invented by John Backus et al.; LISP, the "LIStProcessor", invented by John McCarthy et al.; COBOL, the COmmonBusiness Oriented Language, created by the Short Range Committee, heavily influenced by Grace Hopper. 1951 - Regional Assembly Language1952 - Autocode1954 - FORTRAN1954 - IPL (forerunner to LISP) 1955 - FLOW-MATIC (forerunner to COBOL) 1957 - COMTRAN (forerunner to COBOL) 1958 - LISP1958 - ALGOL 581959 - FACT (forerunner to COBOL) 1959 - COBOL1962 - APL1962 - Simula1964 - BASIC1964 - PL/I1970 - Pascal1970 - Forth1972 - C1972 - Smalltalk1972 - Prolog1973 - ML1975 - Scheme1978 - SQL (initially only a query language, later extended with programming constructs) 1983 - Ada1983 - C++1985 - Eiffel1986 - Erlang1987 - Perl1989 - FL (Backus) 1990 - Haskell1991 - Python1991 - Java1993 - Ruby1993 - Lua1994 - ANSI Common Lisp1995 - JavaScript1995 - PHP1997 - Rebol2000 - C#2008 - JavaFX Script
  2. Through the 1990s and up until today, OO languages are in the ascendency due to: the GUI. A GUI lends itself well to the concept of discrete objects due to: having their own knowledge and behaviour messaging each other in an event driven model. Low cost of memory
  3. Modelling object graph where objects are passing messagesModelling state changeModelling problem domains where the actors are hierarchal in natureEvent driven programming
  4. Object graphs or sub graphs mean lots of shared dataShared data bad for concurrencyRequires lockingLocking is bad because it is either coarse grained which is expensive in time or it’s fine grained which is expensive in terms of management.Locking management is hard because there is no compiler or VM support, it’s down to you to work out how to do itExample: lock objects by alphabetical orderYou have to remember to do it that wayErrors are next to impossible to test for, hard to debug
  5. Functional programming
  6. First order functions means that functions can be treated like values and can be return from and passed into other functionsFunction like constructs means that flow control constructs are more like functions in that they may return the last value etcStateless because it’s functional in the sense of a mathematical function. Values are passed in, those values are operated upon and a new value is passed out. The function does not depend on any outside state. If the function is pure it has no side effects.The advantage of this is that a pure function is simple to understand, the whole essence of the function is encapsulated within the function itself. Easy to testEasy to debugConcurrency – if there is no dependency on shared state then work can be easily parallelised.
  7. Pure functional language = no side effects allowedImpure functional language = side effects are not restrictedLockless concurrency does not mean there are no locks, just that the language manages them for you.
  8. Nil is null and is treated as false kinda sucks.Here is a value and it is trueHere is a value and it is falseNil/null should mean there is no value.
  9. Mutable collection you can modify the collection: add, remove etcImmutable collections cannot be modified but instead you get a new copy of the collection with the changes.Key idea is that copies are cheap, both in terms of time and memoryHow does this work?Copies of mutable collections take time and memory, copying 100 items needs 100+ operations but..Because data is immutable, it’s not going to change, so I don’t have to copy the data, just provide a pointer to it.If I want your data with a new member added then I get a collection which shares most of the data but has my deltas
  10. Clojure favours equality but this is not a big problem as data is immutable and so objects and object graphs have a hash, since this can’t change equality simply compares the hash values and not the data in the graphThe only exception to this is string comparisons because Clojure strings are just Java stringsNot a big problem as string comparison is efficient in JavaFirst check identityThen check lengthThen check equality
  11. Vars must be defined before first useThey must be def’d but not necessarily boundWhat is a macro?A macro is a function that modifies reader data
  12. If is a special form as code execution is conditionalIf the condition is true then a will be returnedIf the condition is false then b will be returnedThe ? Denotes that b is optionalI said before that if were function likeFirst example returns the result of hungover if true else the result of happySecond example returns the result of drink else nil
  13. Tail RecursionSpecial form of recursion whereby the last thing a function does is to call itselfFunctions need a stack frameCall a function 1,000 times recursively then you need 1,000 stackframesBut if calling the function is the last thing you are going to doThen you are not coming back to the calling functionSo there’s an optimisation where you can just overwrite the stackframe of the calling funcSo you only ever need one stack frameMost lisp dialects have this tail recursion optimisationClojure doesn’t as there is not tail recursion on the JMV