Go/Ruby/Java
What’s next?
Hernán A. Wilkinson
@hernanwilkinson – www.10pines.com
agile software development & services
How do we analyze and compare a
Programming Language?
Accidents and Essence of … - Plato
Accident and Essence of Software - No Silver Bullet
Software
Set of instructions
Set of instructions?
Computable Model of a Problem Domain
Good Software = Good Model
Good Model – Three Axes
● Functional
● Declarative
● Implementative
Good Model – Three Axes
● Functional
● Declarative
● Implementative
Model
Newton - Einstein
How do we represent Feb/2018? (a month of year)
How do we represent Feb/2018? (a month of year)
(Java 1.8)
How do we represent Feb/2018? (a month of year)
(Smalltalk)
How do we represent Feb/2018? (a month of year)
Ruby - Go - Java pre 1.8
?
How do we represent Feb/2018? (a month of year)
Ruby - Go - Java pre 1.8
Problems…
● Lack of representation
● Reinvent the “flat tire” (Alan Kay)
● Ad-hoc solutions
● Communication errors
● …
● What about immutability?
* Immutability  Setters?  Encapsulation
* Heraclitus vs. Parmenides / Java vs. Haskell
What about the other way around?
Should we be able to represent Feb 31st, 2018?
Can we represent Feb 31st, 2018? - Java pre 1.8
03/03/2018 !!!
Can we represent Feb 31st, 2018? - Go
03/03/2018 !!!
Can we represent Feb 31st, 2018? - Java 1.8
Exception!
Can we represent Feb 31st, 2018? - Smalltalk
Exception!
(A point based model of the Gregorian Calendar – H. Wilkinson et al)
Problems…
● Invalid objects/data
● Unexpected behavior
● Hidden errors
● Difficult to find errors
● …
● Think about having only valid objects all the time… how would that change
the way you think about the program?
What about this?
Account
...
Problems…
● Complexity... with all the problems it generates
What about this?
1
1 $
1 gallon
1 BTC
What does 1 represent?
null
Var. not initialized?
Customer does not have
address?
Phone has not be entered?
What does “null” represent?
Problems…
● Loss of information
● Implementation errors
● …
● Is it possible not to have “null” in a programming language?
(Pony Lang)
● At least it is possible to avoid it … easier with full closures
● Design Tip: Do not use null/nil
Conclusion
What does it have to do with
Programming Languages?
Programming ¿Language?
Purpose of Language:
To provide a framework for communication.
(Design Principles Behind Smalltalk - Dan Ingalls)
“The design of a language for using computers must deal with internal models,
external media, and the interaction between these in both the human and the
computer”
(Design Principles Behind Smalltalk - Dan Ingalls)
Natural Language
● Spoken
● Gestural
● Multiple channels at the same time
● Bi-directional (immediate feedback)
● Meta-Circular (defined by itself)
● Contextual
● Ambiguous
● Written
● No gestures
● One channel of communication
● Almost no one with immediate
feedback
● Most of them are not meta-circular
(but Lisp, Smalltalk, Self)
● Formal
Programming Language
Peter Naur: Programming Languages, Natural Languages and
Mathematics: https://dl.acm.org/citation.cfm?id=361229
How does a Language affects “our
thinking”?
Aymara
Past (nayra) and Future (qhipa)
(https://www.theguardian.com/science/2005/feb/24/4)
How does a “Programming Language”
affects “our thinking”?
What is the problem?
Repeated Code!
Code != Text
Code != Text
Repeated Code = Repeated patterns of
collaboration
What does it mean to have
“repeated code”?
Repeated Code Means
● Lack of abstraction
● In OO terms: Lack of an Object
How do we remove it?
Removing Repeated Code
1. Contextual-Move repeated code to some “place”
2. Parameterize what changes (including types)
3. NAME IT!  The most important step
4. Use it :-)
Contextual-Move
What changes?
How do we parameterize it?
Polymorphism
How do we parameterize it?
Generics
How do we parameterize it?
Lambda/Closure/Full Closure/Anonymous Func.
Name it!! – The most important step
Let’s do some reflexion
● Why do Java pre 1.8, C/C++ programmers
do not see the “repeated code”?
● What about Go programmers?
● What will happen with new programmers
whose first language will be Go?
Go
hmm…
Therefore...
● We end up having run-time errors, the same as Dynamic Languages!
● What about Generics?
● From the Type System pov, if we do not want repeated code:
○ Dynamic Languages or…
○ Static Typed Languages with Generics
● Else
○ Deal with it!
What is the problem?
and now? What is the problem?
Repeated Code!
better, but...
Repeated Code!
Cool! No repeated code!
No way to forget to handle the error!
Much Nicer! – No doubt about it!
But… I don’t want to panic! I want to
stop execution and return the error!
Will stop execution?
Full Closure to the rescue!!
What will be printed?
Ruby
15
10
Only if we could do this...
What are Exceptions?
Exceptions
● Abstraction that removes “repeated code” from the “error code technique”
● Easy to implement with full closures
● A Fully Object-Oriented Exception Handling System (Christophe Dony)
● Implementing Exceptions with Ruby:
https://www.youtube.com/playlist?list=PLMkq_h36PcLAE5CPRGG5xd62KVJABPQdd
Exceptions - Problems
● Misused
● More classes than necessary → Complexity
● Checked exceptions → NOOOO!
● Incorrectly handled
So… How do we analyze and compare a
Programming Language?
Accidents - Essence
Accidents
● Speed
● Space
● Scalability
● Tools?
● Environment? (git, cloud, etc)
● Deployment?
● Communication (immediate
feedback/etc)
● Change
● Modeling (Representation of ideas)
● Simplicity (or Complexity?)
● Augmentation (meta-circularity)
Essence
Accidents
Go Ruby Java
Speed Very Good Regular Very Good
Memory Very Good Good Good
Scalability Very Good Regular Very Good
Tools Regular Good Very Good
Environment Good Good Good
Deployment Very Good Good Good
Essence
Go Ruby Java
Communication Bad Very Good Good
Change Regular Very Good Good
Modeling Regular Very Good Good
Complexity Regular Good Bad
Augmentation Bad Very Good Bad
Where do we go from here?
What’s next?
Normal Science vs. Paradigm Shift
Normal Science vs. Paradigm Shift
● Ruby, Normal Science or Paradigm Shift?
● Java, Normal Science or Paradigm Shift?
● Go, Normal Science or Paradigm Shift?
● Rust, Normal Science or Paradigm Shift?
● Better type systems, more performance, better IDEs, etc., Normal Science or
Paradigm Shift?
Paradigm Shift
Paradigm Shift
● Stop using the computer as “type writer”
● New ways of communication - Today kids do not type, they “touch”
● Easier and better feedback - A la Smalltalk but better
● Better Modeling – More ”people oriented” than “machine oriented”
● …
LET’S TOAST FOR LANGUAGES WERE THE LIMIT IS OUR
IMAGINATION AND NOT THE PROGRAMING LANGUAGE
Thanks!
Hernán A. Wilkinson
@hernanwilkinson – www.10pines.com
agile software development & services

Go/Ruby/Java: What's next?