SlideShare a Scribd company logo
1 of 41
Are Modern Programming
Languages Easier to
Learn?
Ray Toal, Loyola Marymount University
@rtoal
What will this talk be about?
● "Anyone Can Program"
(really?)
● What does it mean to learn
or understand
programming?
● How are modern
languages helping (or not)?
I was asked to first talk about myself
… and about LMU CS
But enough about me
Really, Michael?
A noble gesture to garner the NYC tech
community vote, for sure, but if the mayor
of New York City actually needs to sling
JavaScript code to do his job, something
is deeply, horribly, terribly wrong with
politics in the state of New York. --- Jeff
Atwood
Who's going to teach everyone?
At least it is not as hard as this
Because of this visionary
"But Grace,
then anyone
will be able to
write
programs!"
But alas, not everyone can
All images from theDailyWTF.com
Seriously, it can't be this hard?
And it's just not about "mistakes"
What is WRONG
with you people?
We need to ask
How do we get people
to understand
programming?
This guy knows
He wrote a really great essay
With this answer
"We change programming.
We turn it into something
that's understandable by
people."
Why did he write this essay?
In Inventing on Principle (2011), Bret Victor
demonstrated a remarkable live coding
environment.
Inspired, Khan Academy
implemented it in their
programming section.
But KA missed the point: he
was talking about creating,
not learning.
What does he say?
A system should
● support and encourage powerful ways of
thinking
● allow people to see and understand the
execution of their code.
What's wrong with KA's approach?
"A live-coding Processing environment addresses
neither of these goals. JavaScript and Processing are
poorly-designed languages that support weak ways of
thinking, and ignore decades of learning about
learning. And live coding, as a standalone feature, is
worthless."
Bret Victor's Nine Principles:
The learner should be able to...
E1. See labeled code (not consult manuals)
E2. Follow the flow
E3. See the state
E4. Start somewhere, then sculpt
E5. Start somewhere, then generalize
L1. Work with sensible metaphors
L2. Decompose thoughts
L3. Glue thoughts together
L4. Know what the code means just by reading
Languages and Learning
What can the language do for
the learner?
It's been done right before!
What did they do right?
● Concepts are directly related to the
programmer's world (metaphor)
● Elements decompose into things people
can think about independently
● Program elements can be composed from
other programs and molded to new uses
● State is minimized, or at least explicit
● Syntax (It matters!)
● Names (they matter!)
Metaphor
GOOD
● Turtle
● Objects and messages
● Stack of cards
● Movable players
POOR
● Shuffling bits
● Memory cell
LACK OF
● rect(0,0,10,10)
Decomposition
NICE THINGS
modules
objects
functions
BARRIERS
Top level event
handlers
Without objects how
do you make
animations, multiple
copies, vary
behavior?
Recomposition
BAD STUFF:
● mutable state
● invisible state
● global variables
● lack of encapsulation
● "leakiness"
Syntax
draw_circle(center=(2,5), radius=10)
drawCircleCenteredAt: (2,5) withRadius: 10
[3, 5, 9]
{name: "Rex", breed: "G-SHEP", age: 5}
drawCircle(2,5,10)
… however you make arrays in C or Java
… however you make maps in C or Java
Names
vectorFromStartAndEndPoint(start, end)
// you can tell this is constructing and returning
// a new vector
vectorFrom:To:
fill(...) // to set a fill color
// why not at least set_fill_color?
rectangle(....) // should be draw_rectangle
concat(a, b) // ambiguous if b is an array, no?
So, the BIG things to look for are
Primary metaphors
Identifiable objects
Independent modules
Streamlined syntax (no clutter)
No ambiguity (almost)
Language support for modelessness
Parts of speech used properly in keywords and
libraries
Parameter names in calls
Nice environments (IDEs, Playgrounds)
How about some new languages?
They're all adopting nice features
● Loop through structures without "for i"
● "for k,v in map" and other destructurings
● Ways to avoid loops (higher order functions)
● String interpolation
● Multiline strings
● x,y = y,x
● a[3..5]
● Patterns
● Optional or inferential typing, for the
statically typed languages
Explain some of those, please
for dog in kennel:
dog.bark()
sum(n*n for n in numbers if n % 2 == 0)
sum(map(square, filter(odd, numbers)))
numbers | filter odd | map square | sum
CoffeeScript
number = -42 if opposite
square = (x) -> x * x
list = [1, 2, 3, 4, 5]
math =
root: Math.sqrt
square: square
cube: (x) -> x * square x
race = (winner, runners...) ->
print winner, runners
alert "I knew it!" if elvis?
cubes = (math.cube num for num in list)
These examples
are from
coffeescript.org
Clojure
"A general-purpose language, combining the
approachability and interactive development of a scripting
language with an efficient and robust infrastructure for
multithreaded programming."
Lots of statelessness, powerful combining forms
(defn scramble [s]
(if (empty? s) "" (-> s seq shuffle join)))
See Rich Hickey's Simple Made Easy
Go
"Did the C++ committee really believe that was
wrong with C++ was that it didn't have
enough features? Surely … it would be a
greater achievement to simplify the language
rather than to add to it." -- Rob Pike
In one of his talks, Pike identifies 35
"significant simplifications in Go over C
and C++".
Rust
Rust is a systems programming language that runs blazingly fast,
prevents almost all crashes*, and eliminates data races.
So…. what are the chances it is easy to learn?
"Rust's pointers are one of its more unique and compelling features.
Pointers are also one of the more confusing topics for newcomers to
Rust. They can also be confusing for people coming from other
languages that support pointers"
But it's pretty clean, with
 pattern matching
 closures
 type inference
Julia
The Julia programming language fills this
role: it is a flexible dynamic language,
appropriate for scientific and numerical
computing, with performance comparable
to traditional statically-typed languages.
x = [1,2,3]
y = [1 2 3]
A = [1 2 3 4; 5 6 7 8; 9 10 11 12]
A[2,1] = 0
u, v = (15.03, 1.2e-27)
f(x) = 3x
x -> 3x
x[2:12]
x[2:end]
A[5,1:3]
A[5,:]
for animal in ["dog", "cat", "mouse"]
println("$animal is a mammal")
end
map(x -> x^2 + 2x - 1, [1,3,-1])
[add_10(i) for i in [1, 2, 3]]
... and keyword args too
Swift
I think Apple did a good job here:
● Named Parameters
o counter.incrementBy(5, numberOfTimes: 3)
● Closures
● Tuples and multiple return values
● Fast and concise iteration over a range or collection
● map and filter
● Eliminates much unsafe code: Variables are always
initialized before use, arrays and integers are checked
for overflow, and memory is managed automatically.
● Option chaining! (e.g., p.car?.color)
● Great interactive playground (within XCode)
● Uses the readable Cocoa API
So…?
● All have REPLs or Playgrounds and great
online examples.
● All adopt nice features to make programming
a little more pleasant
● But all are industrial strength - do we expect
the learner to quickly master all 7 types of
Rust pointers?
● And none really have the turtle metaphor!
Takeaways
● We have decades of research on teaching
and learning that is often ignored
● Learning and understanding programming
requires more than just live coding
● Language should expose metaphor, allow
decomposition and recomposition, and make
meaning transparent
● We saw some modern languages and saw
they did a few things right
Okay that's it
Questions?
Discussion.
Thanks!

More Related Content

Similar to Learning and Modern Programming Languages

Basics of Programming - A Review Guide
Basics of Programming - A Review GuideBasics of Programming - A Review Guide
Basics of Programming - A Review Guide
Benjamin Kissinger
 
Using binary classifiers
Using binary classifiersUsing binary classifiers
Using binary classifiers
butest
 
Prolog (present)
Prolog (present) Prolog (present)
Prolog (present)
Melody Joey
 

Similar to Learning and Modern Programming Languages (20)

Антон Кириллов, ZeptoLab
Антон Кириллов, ZeptoLabАнтон Кириллов, ZeptoLab
Антон Кириллов, ZeptoLab
 
Basics of Programming - A Review Guide
Basics of Programming - A Review GuideBasics of Programming - A Review Guide
Basics of Programming - A Review Guide
 
Presentation1
Presentation1Presentation1
Presentation1
 
LISP: How I Learned To Stop Worrying And Love Parantheses
LISP: How I Learned To Stop Worrying And Love ParanthesesLISP: How I Learned To Stop Worrying And Love Parantheses
LISP: How I Learned To Stop Worrying And Love Parantheses
 
Using binary classifiers
Using binary classifiersUsing binary classifiers
Using binary classifiers
 
IN4308 1
IN4308 1IN4308 1
IN4308 1
 
Clojure
ClojureClojure
Clojure
 
Clojure Small Intro
Clojure Small IntroClojure Small Intro
Clojure Small Intro
 
Prolog & lisp
Prolog & lispProlog & lisp
Prolog & lisp
 
Machine Learning Workshop, TSEC 2020
Machine Learning Workshop, TSEC 2020Machine Learning Workshop, TSEC 2020
Machine Learning Workshop, TSEC 2020
 
Prolog (present)
Prolog (present) Prolog (present)
Prolog (present)
 
CPPDS Slide.pdf
CPPDS Slide.pdfCPPDS Slide.pdf
CPPDS Slide.pdf
 
Mastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loopsMastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loops
 
Erlang, an overview
Erlang, an overviewErlang, an overview
Erlang, an overview
 
DataWeave 2.0 Language Fundamentals
DataWeave 2.0 Language FundamentalsDataWeave 2.0 Language Fundamentals
DataWeave 2.0 Language Fundamentals
 
JS Fest 2018. Douglas Crockford. The Better Parts
JS Fest 2018. Douglas Crockford. The Better PartsJS Fest 2018. Douglas Crockford. The Better Parts
JS Fest 2018. Douglas Crockford. The Better Parts
 
HUDF5199 Columbia Class
HUDF5199 Columbia ClassHUDF5199 Columbia Class
HUDF5199 Columbia Class
 
Coding Unplugged_Focus on problem solvin
Coding Unplugged_Focus on problem solvinCoding Unplugged_Focus on problem solvin
Coding Unplugged_Focus on problem solvin
 
Language translation with Deep Learning (RNN) with TensorFlow
Language translation with Deep Learning (RNN) with TensorFlowLanguage translation with Deep Learning (RNN) with TensorFlow
Language translation with Deep Learning (RNN) with TensorFlow
 
Domain specific languages and Scala
Domain specific languages and ScalaDomain specific languages and Scala
Domain specific languages and Scala
 

Recently uploaded

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
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
Earley Information Science
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Recently uploaded (20)

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
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
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
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
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
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
 
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
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
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 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
 

Learning and Modern Programming Languages

  • 1. Are Modern Programming Languages Easier to Learn? Ray Toal, Loyola Marymount University @rtoal
  • 2. What will this talk be about? ● "Anyone Can Program" (really?) ● What does it mean to learn or understand programming? ● How are modern languages helping (or not)?
  • 3. I was asked to first talk about myself
  • 4. … and about LMU CS
  • 6. Really, Michael? A noble gesture to garner the NYC tech community vote, for sure, but if the mayor of New York City actually needs to sling JavaScript code to do his job, something is deeply, horribly, terribly wrong with politics in the state of New York. --- Jeff Atwood
  • 7. Who's going to teach everyone?
  • 8. At least it is not as hard as this
  • 9. Because of this visionary "But Grace, then anyone will be able to write programs!"
  • 10. But alas, not everyone can All images from theDailyWTF.com
  • 11. Seriously, it can't be this hard?
  • 12. And it's just not about "mistakes" What is WRONG with you people?
  • 13. We need to ask How do we get people to understand programming?
  • 15. He wrote a really great essay
  • 16. With this answer "We change programming. We turn it into something that's understandable by people."
  • 17. Why did he write this essay? In Inventing on Principle (2011), Bret Victor demonstrated a remarkable live coding environment. Inspired, Khan Academy implemented it in their programming section. But KA missed the point: he was talking about creating, not learning.
  • 18. What does he say? A system should ● support and encourage powerful ways of thinking ● allow people to see and understand the execution of their code.
  • 19. What's wrong with KA's approach? "A live-coding Processing environment addresses neither of these goals. JavaScript and Processing are poorly-designed languages that support weak ways of thinking, and ignore decades of learning about learning. And live coding, as a standalone feature, is worthless."
  • 20. Bret Victor's Nine Principles: The learner should be able to... E1. See labeled code (not consult manuals) E2. Follow the flow E3. See the state E4. Start somewhere, then sculpt E5. Start somewhere, then generalize L1. Work with sensible metaphors L2. Decompose thoughts L3. Glue thoughts together L4. Know what the code means just by reading
  • 21. Languages and Learning What can the language do for the learner?
  • 22. It's been done right before!
  • 23. What did they do right? ● Concepts are directly related to the programmer's world (metaphor) ● Elements decompose into things people can think about independently ● Program elements can be composed from other programs and molded to new uses ● State is minimized, or at least explicit ● Syntax (It matters!) ● Names (they matter!)
  • 24. Metaphor GOOD ● Turtle ● Objects and messages ● Stack of cards ● Movable players POOR ● Shuffling bits ● Memory cell LACK OF ● rect(0,0,10,10)
  • 25. Decomposition NICE THINGS modules objects functions BARRIERS Top level event handlers Without objects how do you make animations, multiple copies, vary behavior?
  • 26. Recomposition BAD STUFF: ● mutable state ● invisible state ● global variables ● lack of encapsulation ● "leakiness"
  • 27. Syntax draw_circle(center=(2,5), radius=10) drawCircleCenteredAt: (2,5) withRadius: 10 [3, 5, 9] {name: "Rex", breed: "G-SHEP", age: 5} drawCircle(2,5,10) … however you make arrays in C or Java … however you make maps in C or Java
  • 28. Names vectorFromStartAndEndPoint(start, end) // you can tell this is constructing and returning // a new vector vectorFrom:To: fill(...) // to set a fill color // why not at least set_fill_color? rectangle(....) // should be draw_rectangle concat(a, b) // ambiguous if b is an array, no?
  • 29. So, the BIG things to look for are Primary metaphors Identifiable objects Independent modules Streamlined syntax (no clutter) No ambiguity (almost) Language support for modelessness Parts of speech used properly in keywords and libraries Parameter names in calls Nice environments (IDEs, Playgrounds)
  • 30. How about some new languages?
  • 31. They're all adopting nice features ● Loop through structures without "for i" ● "for k,v in map" and other destructurings ● Ways to avoid loops (higher order functions) ● String interpolation ● Multiline strings ● x,y = y,x ● a[3..5] ● Patterns ● Optional or inferential typing, for the statically typed languages
  • 32. Explain some of those, please for dog in kennel: dog.bark() sum(n*n for n in numbers if n % 2 == 0) sum(map(square, filter(odd, numbers))) numbers | filter odd | map square | sum
  • 33. CoffeeScript number = -42 if opposite square = (x) -> x * x list = [1, 2, 3, 4, 5] math = root: Math.sqrt square: square cube: (x) -> x * square x race = (winner, runners...) -> print winner, runners alert "I knew it!" if elvis? cubes = (math.cube num for num in list) These examples are from coffeescript.org
  • 34. Clojure "A general-purpose language, combining the approachability and interactive development of a scripting language with an efficient and robust infrastructure for multithreaded programming." Lots of statelessness, powerful combining forms (defn scramble [s] (if (empty? s) "" (-> s seq shuffle join))) See Rich Hickey's Simple Made Easy
  • 35. Go "Did the C++ committee really believe that was wrong with C++ was that it didn't have enough features? Surely … it would be a greater achievement to simplify the language rather than to add to it." -- Rob Pike In one of his talks, Pike identifies 35 "significant simplifications in Go over C and C++".
  • 36. Rust Rust is a systems programming language that runs blazingly fast, prevents almost all crashes*, and eliminates data races. So…. what are the chances it is easy to learn? "Rust's pointers are one of its more unique and compelling features. Pointers are also one of the more confusing topics for newcomers to Rust. They can also be confusing for people coming from other languages that support pointers" But it's pretty clean, with  pattern matching  closures  type inference
  • 37. Julia The Julia programming language fills this role: it is a flexible dynamic language, appropriate for scientific and numerical computing, with performance comparable to traditional statically-typed languages. x = [1,2,3] y = [1 2 3] A = [1 2 3 4; 5 6 7 8; 9 10 11 12] A[2,1] = 0 u, v = (15.03, 1.2e-27) f(x) = 3x x -> 3x x[2:12] x[2:end] A[5,1:3] A[5,:] for animal in ["dog", "cat", "mouse"] println("$animal is a mammal") end map(x -> x^2 + 2x - 1, [1,3,-1]) [add_10(i) for i in [1, 2, 3]] ... and keyword args too
  • 38. Swift I think Apple did a good job here: ● Named Parameters o counter.incrementBy(5, numberOfTimes: 3) ● Closures ● Tuples and multiple return values ● Fast and concise iteration over a range or collection ● map and filter ● Eliminates much unsafe code: Variables are always initialized before use, arrays and integers are checked for overflow, and memory is managed automatically. ● Option chaining! (e.g., p.car?.color) ● Great interactive playground (within XCode) ● Uses the readable Cocoa API
  • 39. So…? ● All have REPLs or Playgrounds and great online examples. ● All adopt nice features to make programming a little more pleasant ● But all are industrial strength - do we expect the learner to quickly master all 7 types of Rust pointers? ● And none really have the turtle metaphor!
  • 40. Takeaways ● We have decades of research on teaching and learning that is often ignored ● Learning and understanding programming requires more than just live coding ● Language should expose metaphor, allow decomposition and recomposition, and make meaning transparent ● We saw some modern languages and saw they did a few things right

Editor's Notes

  1. Learner needs to know what each line of code is doing addObject vs push addObjectsFromArray vs splice arrayByAddingObject vs concat