SlideShare a Scribd company logo
1 of 41
One Ring to Rule Them All?




Why Programming Languages Matter
                                   1
2
Some people think, and act, like Java is the One Programming Language to Rule Them All. Is it
really? Is it possible to have everything you need in a single language?
TIOBE Programming Community Index

              1                    Java                               19.002%
              2                     C                                 15.931%
              3                    C++                                10.116%
              4               (Visual) Basic                           9.161%
              5                    PHP                                 8.882%
              6                     C#                                 5.609%
              7                   Python                               4.731%
              8                    Perl                                4.303%
              9                 JavaScript                             3.360%
             10                   Delphi                               3.303%
                                                                   January 2009
                                                                                            3
Interestingly, Ruby is #11 and is the only other language with greater than 3% reporting.
4
From a Cadbury chocolate label. Simple things, like this list of ingredients, are relatively easy to
translate. Concepts, logic and emotions are much harder.
5
Sandburg reminds us that language, like culture, is always changing. What we mean when we use a
particular word evolves and changes. Consider the word “flour”, for example. In the Middle English
of the Canterbury Tales, it means a flower. Nowadays it typically means ground wheat.
“if something can't be said, then it
               can't be thought”
                                              -- Orwell

                                                                                                6
In George Orwell’s 1984, NewSpeak was an attempt to control what people could think by
controlling what they could say. Can you think of analogies to computer programming languages
that you use?
7
These are obviously shoes. They have dierent shapes, colors, sizes and styles, yet we immediately
recognize them as shoes. Some languages insist on attaching implicit metadata about objects, such
as gender (e.g. German, Italian) or even general shape (e.g. Japanese, -mai, -hon forms as in “kutsu
ni-hon”). Consider also the dierence between material types in English (“some sand” vs. “a sand”).
8
When does an object become a shoe? Or stop being a shoe? We often pretend that our words have
hard, Boolean meanings, but they are really quite flexible. This strongly dierentiates human
languages from programming languages.
quot;The limits of my language mean the limits
        of my world.quot;
                                     -- Wittgenstein




                                                                                                 9
Ludwig Wittgenstein (1889–1951) was “an Austrian-British philosopher who worked primarily in
logic, the philosophy of mathematics, the philosophy of mind, and the philosophy of language”.
[Wikipedia]
quot;About what one can not speak, one must
remain silent.quot;
                           -- Wittgenstein




                                             10
quot;The structures of your language shape the
        way you think and perceive the world.quot;
                            - Sapir-Whorf Hypothesis




                                                                                                 11
Cognitive research has proven a link from language to perception, but it seems to be weaker in
adults. The “strength” of the Sapir-Whorf is an area of controversy [http://scienceblogs.com/
cognitivedaily/2005/05/does_our_language_aect_our_t.php]
Language is innate and universal
                                                                         - Chomsky




                                                                                                      12
Noam Chomsky (1928-) is an American linguist, philosopher, cognitive scientist, political activist,
author, and lecturer. [Wikipedia]
quot;Some people argue that language just
         changes what you attend to, but what
         you attend to changes what you encode
         and remember.quot;
                                 -- Lera Boroditsky




                                                                                                   13
Lera Boroditsky is an Assistant Professor of Psychology at Stanford University doing research in
cognitive science with a specific focus on cognitive linguistics. [Wikipedia]
14
Perhaps there is no “one ring”. Perhaps the ring is made of many possible components, or maybe
even fractal...
Chimeric Programming




                                                                                             15
Chimeric programming; like the mythical Chimera which was a beast made of parts of many animals
(related to the Hydra and Cerberus).
Chimera on a red-figure Apulian plate, ca 350-340 BCE (Musée du Louvre) -- Wikipedia
Use many languages to say the right thing at the right time.
Kinnersley’s Categories
                                                          Constraint
         Procedural
                                                          Object-Oriented
         Imperative
                                                          Concurrent
         Declarative
                                                          Fourth Generation
         Applicative
                                                          Query
         Functional
                                                          Specification
         Definitional
                                                          Assembly
         Single Assignment
                                                          Intermediate
         Dataflow
                                                          Metalanguage
         Logic


                                                                                                 16
Bill Kinnersley, husband of a University of Kansas EE prof and coder. He maintains the list of
computer languages at http://people.ku.edu/~nkinners/LangList/Extras/langlist.htm
Kinnersley’s Categories
                                                                    Java, Javascript
                                                         Object-Oriented BeanShell
         Procedural
                                                         Constraint
         Imperative
         Declarative HTML, CSS                           Concurrent
                                                         Fourth Generation
         Applicative
         Functional XSL, RelaxNG                         Query SQL
                                                         Specification
         Definitional
                                                         Assembly
         Single Assignment
         Dataflow DPML                                    Intermediate
                                                         Metalanguage XML, BNF
         Logic


                                                                                  17
Languages used for the PURL project, notionally written in Java.
Kinnersley’s Categories
                                                                             Java
                                                          Object-Oriented Javascript
         Procedural
                                                          Constraint
         Imperative
         Declarative HTML, CSS                            Concurrent
                                                          Fourth Generation
         Applicative
                      XSL, XPath                          Query SPARQL
         Functional
                       XQuery
                                                          Specification
         Definitional
                                                          Assembly
         Single Assignment
         Dataflow Drools, DPML                             Intermediate
         Logic OWL, SKOS                                  Metalanguage RDF, XML


                                                                                  18
Languages used for the ICFS project, also notionally a Java project.
19
Language features - bells and whistles you should note.
Typing

                                        Dynamic                       Static

               Strong               Ruby/Groovy                     Java/C#

                Weak               JavaScript/Perl                  C/C++

                 From Venkat Subramaniam’s “Programming Groovy”
                                                                                                 20
We used to snub our noses over dynamic languages over features like weak typing. The situation
has changed and we should acknowledge that.
Dynamic/Strong
                             Ruby
$ irb
 i = 10
= 10
 s = quot;stringquot;
= quot;stringquot;
 s + i
TypeError: can't convert Fixnum into String
 from (irb):3:in `+'
 from (irb):3
 from :0


From Nate Schutta’s “JavaScript : The Good, The Bad and the Ugly”

                                                                    21
Dynamic/Weak
                          JavaScript


var i = 12;
var j = quot;helloquot;;
out(i + j)


Yields:
“12 hello”




From Nate Schutta’s “JavaScript : The Good, The Bad and the Ugly”

                                                                    22
Closures

      • Functions that are evaluated in an environment
      containing one or more bound variables.

      • Associated with functional languages.
      • Some OO languages now exposing closures for
      use by programmers - they appear as closed
      anonymous functions.



                                                                                                 23
Closures may be used to implement OO (because state can be hidden and variables maintain state
across calls).
Example later.
Metaprogramming

       • Code that writes code at runtime to perform
       operations traditionally performed at compile time.

       • Typically via dynamic execution of string
       expressions that contain programming commands.




                                                             24
Example later.
Expando Metaclass
       Dynamically add
         • methods
         • constructors
         • properties
         • static methods
       to classes using closures.




                                     25
Example later.
26
The language market is crowded; roughly 2,000 programming languages created in the last four
decades (some 13 of which have “stuck”). Here are some you should know.
Lisp (is back!)
                                        Functional


    • Conditionals                                 • Program as expression
    • Functions as data                            • Symbol type
    • Recursion                                    • Code as tree of symbols
    • Dynamic typing                               • Read/Run/Compile
    • Garbage collection


                         http://www.paulgraham.com/icad.html

                                                                                  27
Also, LISP-variant Clojure for concurrent programming. Clojure runs on the JVM.
Scala
                     OO/Functional



• Pattern matching
• Comprehensions
• Currying
• Mixins



                                     28
Haskell
                    Functional


• Pattern matching
• Currying
• List comprehensions
• Lazy evaluations
• Monads
• Type classes



                                 29
Erlang
                   Functional



• High-performance concurrency
• Fault-tolerant
• Hot-swappable




                                 30
Ericsson AXD 301
                                  HA ATM Switch
                               1,000,000 Erlang LOC

                              Used                Not Used
                    Message-passing              Inheritance
                           Isolation                  Methods
                       Concurrency                    Classes
         Higher-Order Programming                      UML


                                                                31
Written in Erlang, now FLOSS.
No traditionally OO structures used!
JavaScript
                                     Dynamic OO



    • Prototype Inheritance
    • Closures
    • Function as a data type




                                                                                           32
Web 2.0 engine - dynamic language of choice in the Web browser, also on a JVM via Rhino.
Ruby
                             Dynamic OO/Functional



     • Metaprogramming
     • Rails engine!
     • Mixins




                                                                                                   33
Runs on JVM
“Metaprogramming is the writing of computer programs that write or manipulate other programs
(or themselves) as their data, or that do part of the work at runtime that would otherwise be done at
compile time.” [Wikipedia]
Groovy
              Dynamic OO - The next Java syntax?


    • Closures
    • Metaprogramming
    • Grails engine!
    • Builder Syntax (XML, Swing, Data)
    • Access to legacy Java code



                                                   34
Runs on JVM
// By Scott Davis, Brian Sletten
    class FoafPerson {
       Map facts = [:]

    Object invokeMethod(String predicate, Object value) {
        if(facts.containsKey(predicate)) {
            value.each{ obj -
               facts.get(predicate).add(obj)
            }
        } else {
            facts.put(predicate, value as List)
        }
      }
    }
                                                            35
Invoking the method that wasn’t there.
brian = new FoafPerson()
    brian.'foaf:name' 'Brian Sletten'
    brian.'foaf:knows' quot;Ericquot;, quot;Davidquot;,quot;Uchequot;
    brian.'foaf:dateOfBirth' '1972-05-26'
    brian.'foaf:interest' quot;http://www.w3.org/RDF/quot;, quot;http://
    www.w3.org/2000/01/sw/quot;




                                                               36
Using the method that wasn’t there.
String.metaClass.get = { context -
     def req = context.createSubRequest(quot;active:httpGetquot;)
     req.addArgument(quot;urlquot;, delegate)
     req.setAspectClass(IAspectString.class)
     def resp = context.issueSubRequestForAspect(req)
     return resp.getString()
   }
  .
  .
  .
  def foaf =
    “http://zepheira.com/team/brian/brian.rdf”.get(context)


                                                            37
Expando metaclass
38
Don’t be an angry monkey (in the learned behavior study sense) - question group think inherent in
language choice.
Photos
Title Ring    http://www.flickr.com/photos/mk1971/1348204498/

One Ring     http://www.flickr.com/photos/generalnoir/391009102/

Language     http://www.flickr.com/photos/margolove/1526032187/

Cadbury        http://www.flickr.com/photos/nofrills/10895361/

 Fractal      http://www.flickr.com/photos/swaymedia/84294191/

Monkey         http://www.flickr.com/photos/oskarn/122047239/

 1984         http://www.newspeakdictionary.com/go-movie.html
                 http://www.flickr.com/photos/visualgrammar/
 Shoes                           114831391/
             http://www.flickr.com/photos/undercover_surrealist/
Bottles                         2405406526/
                                                                  39
Photos
 Crowd        http://www.flickr.com/photos/vividbreeze/480057824/


  Bells    http://www.flickr.com/photos/hirsuteursus/637705224/


                  Quotes
  Orwell                              1984

On Language                 Collected by Brian Sletten


              Others as noted inline
                                                                   40
Questions?




             41

More Related Content

Similar to Why Languages Matter 20090123

A survey paper of virtual friend
A survey paper of virtual friendA survey paper of virtual friend
A survey paper of virtual friend
Siddiq Abu Bakkar
 
The Four Principles Of Object Oriented Programming
The Four Principles Of Object Oriented ProgrammingThe Four Principles Of Object Oriented Programming
The Four Principles Of Object Oriented Programming
Diane Allen
 
Pal gov.tutorial4.session12 1.lexicalsemanitcs
Pal gov.tutorial4.session12 1.lexicalsemanitcsPal gov.tutorial4.session12 1.lexicalsemanitcs
Pal gov.tutorial4.session12 1.lexicalsemanitcs
Mustafa Jarrar
 
A Strong Object Recognition Using Lbp, Ltp And Rlbp
A Strong Object Recognition Using Lbp, Ltp And RlbpA Strong Object Recognition Using Lbp, Ltp And Rlbp
A Strong Object Recognition Using Lbp, Ltp And Rlbp
Rikki Wright
 

Similar to Why Languages Matter 20090123 (20)

intro.ppt
intro.pptintro.ppt
intro.ppt
 
A survey paper of virtual friend
A survey paper of virtual friendA survey paper of virtual friend
A survey paper of virtual friend
 
Natural Language Processing with Python
Natural Language Processing with PythonNatural Language Processing with Python
Natural Language Processing with Python
 
Inheritance Versus Roles - The In-Depth Version
Inheritance Versus Roles - The In-Depth VersionInheritance Versus Roles - The In-Depth Version
Inheritance Versus Roles - The In-Depth Version
 
The Four Principles Of Object Oriented Programming
The Four Principles Of Object Oriented ProgrammingThe Four Principles Of Object Oriented Programming
The Four Principles Of Object Oriented Programming
 
Bird05 nltk-intro
Bird05 nltk-introBird05 nltk-intro
Bird05 nltk-intro
 
Jarrar: Introduction to Natural Language Processing
Jarrar: Introduction to Natural Language ProcessingJarrar: Introduction to Natural Language Processing
Jarrar: Introduction to Natural Language Processing
 
Mind Your Language
Mind Your LanguageMind Your Language
Mind Your Language
 
Big Data and Natural Language Processing
Big Data and Natural Language ProcessingBig Data and Natural Language Processing
Big Data and Natural Language Processing
 
Pal gov.tutorial4.session12 1.lexicalsemanitcs
Pal gov.tutorial4.session12 1.lexicalsemanitcsPal gov.tutorial4.session12 1.lexicalsemanitcs
Pal gov.tutorial4.session12 1.lexicalsemanitcs
 
Treebank annotation
Treebank annotationTreebank annotation
Treebank annotation
 
FinalReport
FinalReportFinalReport
FinalReport
 
Java As A Programming Language
Java As A Programming LanguageJava As A Programming Language
Java As A Programming Language
 
Representing Translations on the Semantic Web
Representing Translations on the Semantic WebRepresenting Translations on the Semantic Web
Representing Translations on the Semantic Web
 
December06Bulletin
December06BulletinDecember06Bulletin
December06Bulletin
 
December06Bulletin
December06BulletinDecember06Bulletin
December06Bulletin
 
Oral IV Returns!
Oral IV Returns!Oral IV Returns!
Oral IV Returns!
 
A Strong Object Recognition Using Lbp, Ltp And Rlbp
A Strong Object Recognition Using Lbp, Ltp And RlbpA Strong Object Recognition Using Lbp, Ltp And Rlbp
A Strong Object Recognition Using Lbp, Ltp And Rlbp
 
AI Lesson 41
AI Lesson 41AI Lesson 41
AI Lesson 41
 
Lesson 41
Lesson 41Lesson 41
Lesson 41
 

More from David Wood

Meditations on Writing in Paradoxes, Oxymorons, and Pleonasms
Meditations on Writing in Paradoxes, Oxymorons, and PleonasmsMeditations on Writing in Paradoxes, Oxymorons, and Pleonasms
Meditations on Writing in Paradoxes, Oxymorons, and Pleonasms
David Wood
 
Lod Then, Now and Next 20110926
Lod Then, Now and Next 20110926Lod Then, Now and Next 20110926
Lod Then, Now and Next 20110926
David Wood
 
Introduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF VocabulariesIntroduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF Vocabularies
David Wood
 

More from David Wood (20)

Internet of Things (IoT) two-factor authentication using blockchain
Internet of Things (IoT) two-factor authentication using blockchainInternet of Things (IoT) two-factor authentication using blockchain
Internet of Things (IoT) two-factor authentication using blockchain
 
Returning to Online Privacy?
Returning to Online Privacy?Returning to Online Privacy?
Returning to Online Privacy?
 
Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...
Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...
Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...
 
BlockSW 2019 Keynote
BlockSW 2019 KeynoteBlockSW 2019 Keynote
BlockSW 2019 Keynote
 
Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221
Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221
Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221
 
Privacy in the Smart City
Privacy in the Smart CityPrivacy in the Smart City
Privacy in the Smart City
 
Controlling Complexities in Software Development
Controlling Complexities in Software DevelopmentControlling Complexities in Software Development
Controlling Complexities in Software Development
 
Privacy Concerns related to Verifiable Claims
Privacy Concerns related to Verifiable ClaimsPrivacy Concerns related to Verifiable Claims
Privacy Concerns related to Verifiable Claims
 
Implementing the Verifiable Claims data model
Implementing the Verifiable Claims data modelImplementing the Verifiable Claims data model
Implementing the Verifiable Claims data model
 
So You Wanna be a Startup CTO 20170301
So You Wanna be a Startup CTO 20170301So You Wanna be a Startup CTO 20170301
So You Wanna be a Startup CTO 20170301
 
Functional manipulations of large data graphs 20160601
Functional manipulations of large data graphs 20160601Functional manipulations of large data graphs 20160601
Functional manipulations of large data graphs 20160601
 
When Metaphors Kill
When Metaphors KillWhen Metaphors Kill
When Metaphors Kill
 
Secularism in Australia
Secularism in AustraliaSecularism in Australia
Secularism in Australia
 
Meditations on Writing in Paradoxes, Oxymorons, and Pleonasms
Meditations on Writing in Paradoxes, Oxymorons, and PleonasmsMeditations on Writing in Paradoxes, Oxymorons, and Pleonasms
Meditations on Writing in Paradoxes, Oxymorons, and Pleonasms
 
Building a writer's platform with social media
Building a writer's platform with social mediaBuilding a writer's platform with social media
Building a writer's platform with social media
 
Summary of the Hero's Journey
Summary of the Hero's JourneySummary of the Hero's Journey
Summary of the Hero's Journey
 
Open by Default
Open by DefaultOpen by Default
Open by Default
 
Lod Then, Now and Next 20110926
Lod Then, Now and Next 20110926Lod Then, Now and Next 20110926
Lod Then, Now and Next 20110926
 
Linked Data ROI 20110426
Linked Data ROI 20110426Linked Data ROI 20110426
Linked Data ROI 20110426
 
Introduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF VocabulariesIntroduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF Vocabularies
 

Recently uploaded

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Recently uploaded (20)

This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 

Why Languages Matter 20090123

  • 1. One Ring to Rule Them All? Why Programming Languages Matter 1
  • 2. 2 Some people think, and act, like Java is the One Programming Language to Rule Them All. Is it really? Is it possible to have everything you need in a single language?
  • 3. TIOBE Programming Community Index 1 Java 19.002% 2 C 15.931% 3 C++ 10.116% 4 (Visual) Basic 9.161% 5 PHP 8.882% 6 C# 5.609% 7 Python 4.731% 8 Perl 4.303% 9 JavaScript 3.360% 10 Delphi 3.303% January 2009 3 Interestingly, Ruby is #11 and is the only other language with greater than 3% reporting.
  • 4. 4 From a Cadbury chocolate label. Simple things, like this list of ingredients, are relatively easy to translate. Concepts, logic and emotions are much harder.
  • 5. 5 Sandburg reminds us that language, like culture, is always changing. What we mean when we use a particular word evolves and changes. Consider the word “flour”, for example. In the Middle English of the Canterbury Tales, it means a flower. Nowadays it typically means ground wheat.
  • 6. “if something can't be said, then it can't be thought” -- Orwell 6 In George Orwell’s 1984, NewSpeak was an attempt to control what people could think by controlling what they could say. Can you think of analogies to computer programming languages that you use?
  • 7. 7 These are obviously shoes. They have dierent shapes, colors, sizes and styles, yet we immediately recognize them as shoes. Some languages insist on attaching implicit metadata about objects, such as gender (e.g. German, Italian) or even general shape (e.g. Japanese, -mai, -hon forms as in “kutsu ni-hon”). Consider also the dierence between material types in English (“some sand” vs. “a sand”).
  • 8. 8 When does an object become a shoe? Or stop being a shoe? We often pretend that our words have hard, Boolean meanings, but they are really quite flexible. This strongly dierentiates human languages from programming languages.
  • 9. quot;The limits of my language mean the limits of my world.quot; -- Wittgenstein 9 Ludwig Wittgenstein (1889–1951) was “an Austrian-British philosopher who worked primarily in logic, the philosophy of mathematics, the philosophy of mind, and the philosophy of language”. [Wikipedia]
  • 10. quot;About what one can not speak, one must remain silent.quot; -- Wittgenstein 10
  • 11. quot;The structures of your language shape the way you think and perceive the world.quot; - Sapir-Whorf Hypothesis 11 Cognitive research has proven a link from language to perception, but it seems to be weaker in adults. The “strength” of the Sapir-Whorf is an area of controversy [http://scienceblogs.com/ cognitivedaily/2005/05/does_our_language_aect_our_t.php]
  • 12. Language is innate and universal - Chomsky 12 Noam Chomsky (1928-) is an American linguist, philosopher, cognitive scientist, political activist, author, and lecturer. [Wikipedia]
  • 13. quot;Some people argue that language just changes what you attend to, but what you attend to changes what you encode and remember.quot; -- Lera Boroditsky 13 Lera Boroditsky is an Assistant Professor of Psychology at Stanford University doing research in cognitive science with a specific focus on cognitive linguistics. [Wikipedia]
  • 14. 14 Perhaps there is no “one ring”. Perhaps the ring is made of many possible components, or maybe even fractal...
  • 15. Chimeric Programming 15 Chimeric programming; like the mythical Chimera which was a beast made of parts of many animals (related to the Hydra and Cerberus). Chimera on a red-figure Apulian plate, ca 350-340 BCE (Musée du Louvre) -- Wikipedia Use many languages to say the right thing at the right time.
  • 16. Kinnersley’s Categories Constraint Procedural Object-Oriented Imperative Concurrent Declarative Fourth Generation Applicative Query Functional Specification Definitional Assembly Single Assignment Intermediate Dataflow Metalanguage Logic 16 Bill Kinnersley, husband of a University of Kansas EE prof and coder. He maintains the list of computer languages at http://people.ku.edu/~nkinners/LangList/Extras/langlist.htm
  • 17. Kinnersley’s Categories Java, Javascript Object-Oriented BeanShell Procedural Constraint Imperative Declarative HTML, CSS Concurrent Fourth Generation Applicative Functional XSL, RelaxNG Query SQL Specification Definitional Assembly Single Assignment Dataflow DPML Intermediate Metalanguage XML, BNF Logic 17 Languages used for the PURL project, notionally written in Java.
  • 18. Kinnersley’s Categories Java Object-Oriented Javascript Procedural Constraint Imperative Declarative HTML, CSS Concurrent Fourth Generation Applicative XSL, XPath Query SPARQL Functional XQuery Specification Definitional Assembly Single Assignment Dataflow Drools, DPML Intermediate Logic OWL, SKOS Metalanguage RDF, XML 18 Languages used for the ICFS project, also notionally a Java project.
  • 19. 19 Language features - bells and whistles you should note.
  • 20. Typing Dynamic Static Strong Ruby/Groovy Java/C# Weak JavaScript/Perl C/C++ From Venkat Subramaniam’s “Programming Groovy” 20 We used to snub our noses over dynamic languages over features like weak typing. The situation has changed and we should acknowledge that.
  • 21. Dynamic/Strong Ruby $ irb i = 10 = 10 s = quot;stringquot; = quot;stringquot; s + i TypeError: can't convert Fixnum into String from (irb):3:in `+' from (irb):3 from :0 From Nate Schutta’s “JavaScript : The Good, The Bad and the Ugly” 21
  • 22. Dynamic/Weak JavaScript var i = 12; var j = quot;helloquot;; out(i + j) Yields: “12 hello” From Nate Schutta’s “JavaScript : The Good, The Bad and the Ugly” 22
  • 23. Closures • Functions that are evaluated in an environment containing one or more bound variables. • Associated with functional languages. • Some OO languages now exposing closures for use by programmers - they appear as closed anonymous functions. 23 Closures may be used to implement OO (because state can be hidden and variables maintain state across calls). Example later.
  • 24. Metaprogramming • Code that writes code at runtime to perform operations traditionally performed at compile time. • Typically via dynamic execution of string expressions that contain programming commands. 24 Example later.
  • 25. Expando Metaclass Dynamically add • methods • constructors • properties • static methods to classes using closures. 25 Example later.
  • 26. 26 The language market is crowded; roughly 2,000 programming languages created in the last four decades (some 13 of which have “stuck”). Here are some you should know.
  • 27. Lisp (is back!) Functional • Conditionals • Program as expression • Functions as data • Symbol type • Recursion • Code as tree of symbols • Dynamic typing • Read/Run/Compile • Garbage collection http://www.paulgraham.com/icad.html 27 Also, LISP-variant Clojure for concurrent programming. Clojure runs on the JVM.
  • 28. Scala OO/Functional • Pattern matching • Comprehensions • Currying • Mixins 28
  • 29. Haskell Functional • Pattern matching • Currying • List comprehensions • Lazy evaluations • Monads • Type classes 29
  • 30. Erlang Functional • High-performance concurrency • Fault-tolerant • Hot-swappable 30
  • 31. Ericsson AXD 301 HA ATM Switch 1,000,000 Erlang LOC Used Not Used Message-passing Inheritance Isolation Methods Concurrency Classes Higher-Order Programming UML 31 Written in Erlang, now FLOSS. No traditionally OO structures used!
  • 32. JavaScript Dynamic OO • Prototype Inheritance • Closures • Function as a data type 32 Web 2.0 engine - dynamic language of choice in the Web browser, also on a JVM via Rhino.
  • 33. Ruby Dynamic OO/Functional • Metaprogramming • Rails engine! • Mixins 33 Runs on JVM “Metaprogramming is the writing of computer programs that write or manipulate other programs (or themselves) as their data, or that do part of the work at runtime that would otherwise be done at compile time.” [Wikipedia]
  • 34. Groovy Dynamic OO - The next Java syntax? • Closures • Metaprogramming • Grails engine! • Builder Syntax (XML, Swing, Data) • Access to legacy Java code 34 Runs on JVM
  • 35. // By Scott Davis, Brian Sletten class FoafPerson { Map facts = [:] Object invokeMethod(String predicate, Object value) { if(facts.containsKey(predicate)) { value.each{ obj - facts.get(predicate).add(obj) } } else { facts.put(predicate, value as List) } } } 35 Invoking the method that wasn’t there.
  • 36. brian = new FoafPerson() brian.'foaf:name' 'Brian Sletten' brian.'foaf:knows' quot;Ericquot;, quot;Davidquot;,quot;Uchequot; brian.'foaf:dateOfBirth' '1972-05-26' brian.'foaf:interest' quot;http://www.w3.org/RDF/quot;, quot;http:// www.w3.org/2000/01/sw/quot; 36 Using the method that wasn’t there.
  • 37. String.metaClass.get = { context - def req = context.createSubRequest(quot;active:httpGetquot;) req.addArgument(quot;urlquot;, delegate) req.setAspectClass(IAspectString.class) def resp = context.issueSubRequestForAspect(req) return resp.getString() } . . . def foaf = “http://zepheira.com/team/brian/brian.rdf”.get(context) 37 Expando metaclass
  • 38. 38 Don’t be an angry monkey (in the learned behavior study sense) - question group think inherent in language choice.
  • 39. Photos Title Ring http://www.flickr.com/photos/mk1971/1348204498/ One Ring http://www.flickr.com/photos/generalnoir/391009102/ Language http://www.flickr.com/photos/margolove/1526032187/ Cadbury http://www.flickr.com/photos/nofrills/10895361/ Fractal http://www.flickr.com/photos/swaymedia/84294191/ Monkey http://www.flickr.com/photos/oskarn/122047239/ 1984 http://www.newspeakdictionary.com/go-movie.html http://www.flickr.com/photos/visualgrammar/ Shoes 114831391/ http://www.flickr.com/photos/undercover_surrealist/ Bottles 2405406526/ 39
  • 40. Photos Crowd http://www.flickr.com/photos/vividbreeze/480057824/ Bells http://www.flickr.com/photos/hirsuteursus/637705224/ Quotes Orwell 1984 On Language Collected by Brian Sletten Others as noted inline 40