Slide 1

Slide 1 text

SEVEN LANGUAGES IN SEVEN WEEKS Renan Ranelli

Slide 2

Slide 2 text

Renan Ranelli (Milhouse)

Slide 3

Slide 3 text

Software Engineer @ Renan Ranelli (Milhouse)

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

AGENDA • Why should I care about learning new languages? • A little bit about the languages in the book and how they compare with Ruby • What I learned during the last few years

Slide 7

Slide 7 text

WHO IS THIS TALK FOR • You, who is an Object oriented programmer and has heard about functional programming • You, who have no clear understanding on why learning many languages will help you be better at your language of choice

Slide 8

Slide 8 text

1 - WHY SHOULD I CARE?

Slide 9

Slide 9 text

WHY SHOULD I CARE ? • First of all... • I Think you should learn programming languages • But my opinion probably will not matter to you. So, listen to these guys:

Slide 10

Slide 10 text

http://blog.golang.org/concurrency-is-not-parallelism

Slide 11

Slide 11 text

http://blog.golang.org/concurrency-is-not-parallelism

Slide 12

Slide 12 text

http://blog.golang.org/concurrency-is-not-parallelism

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

DISCLAIMER: ALL THE LANGUAGES HERE ARE TURING COMPLETE

Slide 15

Slide 15 text

WE WILL A LITTLE ABOUT • Ruby • Io • Prolog • Scala • Erlang • Clojure • Haskell

Slide 16

Slide 16 text

WHAT I AIM TO ACHIEVE • I will try to explain what is important when learning a new programming language • I expect to show you that characterizations such as “it is a functional language” or “it is object oriented” is insufficient and most of the times innapropriate • I *Do Not* intend to teach you any of the languages

Slide 17

Slide 17 text

WE WILL A LITTLE ABOUT • Ruby • Io • Scala • Erlang • Clojure • Haskell Support for OOP Support for FP

Slide 18

Slide 18 text

2 – SELECTED POINTS ABOUT EACH LANGUAGE

Slide 19

Slide 19 text

RUBY • Object oriented, class based, dynamic and strongly typed • *Extremely* meta-programmable • OPEN CLASSES !!!!!! • Complex syntax, complex evaluation rules • Reads like a novel • We all know and love it

Slide 20

Slide 20 text

IO • Object oriented, prototype based, strongly typed • Extremely simple and consistent syntax • Heavy emphasis on message passing, not method call. (method is a message that returns an object that can receive the message call) • Easy to create DSLs • Excellent concurrency primitives (futures, corroutines, actors) • CRAZY amount of reflective power

Slide 21

Slide 21 text

IO

Slide 22

Slide 22 text

IO Message

Slide 23

Slide 23 text

IO Message

Slide 24

Slide 24 text

IO Message

Slide 25

Slide 25 text

IO Message

Slide 26

Slide 26 text

IO

Slide 27

Slide 27 text

IO

Slide 28

Slide 28 text

SCALA • OOP, FP, statically typed, strongly typed • Has a powerful type system (not as much as Haskell's) • Offers advanced FP concepts such as monads and type classes • Easy(-ish) to create DSLs • You can emulate non-strict evaluation with “call by name” vs “call by value” parameter passing strategies • Suffers from the Java legacy to a certain extent (nulls)

Slide 29

Slide 29 text

SCALA

Slide 30

Slide 30 text

SCALA

Slide 31

Slide 31 text

SCALA

Slide 32

Slide 32 text

SCALA

Slide 33

Slide 33 text

SCALA

Slide 34

Slide 34 text

ERLANG • Designed by Ericsson to build telecom software • Alien syntax, derived from Prolog • Functional, enforces extreme isolation of processes. Truly share-nothing. • Amazing support for faul-tolerant, near-real-time distributed application development • Quite opinionated .. • ALIEN SYNTAX

Slide 35

Slide 35 text

CLOJURE • Is a LISP (!!1!!11) • FP, supports OOP, strongly typed and dynamically • Strong focus on good concurrency primitives and immutable & persistent data structures • Being a LISP, has macros • Being a LISP, code is data and data is code • Not so Lispy. No custom reader macros and no automatic tail call optimizations (schemers be mad)

Slide 36

Slide 36 text

CLOJURE • Although Clojure is a strict language, you can simulate non-strictness using macros • Its possible to define the language on-the-fly, i.e., the language is internally reprogramable (heavy influce in both Ruby and Smalltalk) • Offers the CLOS-like long forgotten multiple-dispatch !

Slide 37

Slide 37 text

HASKELL • Non-strict (lazy) pure functional language • No exceptions and no mutable state (!) • Unparalleled type system (at least in production-ready languages) with parametric types, type classes, algebraic data types and type inference • Offers the full pack of FP crazyness: Monads, Monoids, Functors, applicatives, Foldables and Semigroups are common ground among Haskell programmers • Much more close to Math, simplyfing the way we represent abstract, symbolic and self-recursive constructs

Slide 38

Slide 38 text

HASKELL • Makes it impossible to mutate state • But allow you to simulate its effects with Monads

Slide 39

Slide 39 text

HASKELL

Slide 40

Slide 40 text

HASKELL

Slide 41

Slide 41 text

HASKELL

Slide 42

Slide 42 text

3 – WHAT I LEARNED AFTER READING THIS BOOK

Slide 43

Slide 43 text

WHAT DOES IT TAKE TO LEARN A NEW LANGUAGE ? • Syntax • The programming languages primitives • The type system (strong or weak? Static or dynamic?) • Evaluation rules (precedence, strictness, etc) • Idioms • Libraries • Tools, IDEs, yadda yadda

Slide 44

Slide 44 text

WHAT DOES IT TAKE TO USE A LANGUAGE IN PRODUCTION • Meta-programming and extensibility models • Concurrency model • Library distribution • Debugging, IDEs, Tools, Refactoring tools ... • *Community* • Concurrency model (again!)

Slide 45

Slide 45 text

YOU CAN'T SEPARATE THE LANGUAGE AND ITS ECOSYSTEM

Slide 46

Slide 46 text

IS IT THAT RUBY IS PRODUCTIVE IN ITSELF, OR ARE RUBY LIBRARIES, LIKE RAILS, PRODUCTIVE??

Slide 47

Slide 47 text

LEARN FROM OTHERS

Slide 48

Slide 48 text

UNDERSTAND HOW THEY SOLVE PROBLEMS YOU HAVE, OR PROBLEMS YOU DON'T EVEN KNOW YOU HAVE

Slide 49

Slide 49 text

GET TO KNOW WHAT YOU CAN IMITATE ! SEE CONCURRENT-RUBY AND CELLULOID !

Slide 50

Slide 50 text

THERE IS *A LOT* OF COOL STUFF OUT THERE. LOOK OUTSIDE YOUR COMMUNITY

Slide 51

Slide 51 text

HAVE FUN

Slide 52

Slide 52 text

HAVE FUN

Slide 53

Slide 53 text

OBRIGADO !

Slide 54

Slide 54 text

@renanranelli /rranelli Renan Ranelli (Milhouse) milhouseonsofware.com