Rubyslava 28.08.2014
-
Upload
jan-herich -
Category
Documents
-
view
613 -
download
5
description
Transcript of Rubyslava 28.08.2014
Why would someone learn Clojure ?
Jan Herich
2014-08-28 Thu
Jan Herich Why would someone learn Clojure ? 2014-08-28 Thu 1 / 14
Outline
1 Motivation to go functional
2 Doubts & Fears
3 Reaping benefits of functional approach
4 Is switch to new language really necessary ?
5 Where to start
Jan Herich Why would someone learn Clojure ? 2014-08-28 Thu 2 / 14
Motivation to go functional
Obvious reasons
You already know Ruby, Python or Java very well, but youprobably noticed that there is a lot of buzz about FP languagestodayYou are curious about any new technology on the horizonYou are perfectionist, never really satisfied, always trying to dobetter
Jan Herich Why would someone learn Clojure ? 2014-08-28 Thu 3 / 14
Motivation to go functional
Less obvious reasons
To step out of you comfort zone, to challenge yourselfThis is of course not exclusive to OOP -> FP transitionIt’s valid every time you learn something really new
The first point is more important then most people realize, asit’s sort of mental exercise which will broaden your horizons andimprove your cognitive skills
Jan Herich Why would someone learn Clojure ? 2014-08-28 Thu 4 / 14
Doubts & Fears
I will loose too much by abandoning OOP
FP seems to be approach best suited for limited class ofproblems, with serious deficiencies for general purposeprogramming
Is there some way to implement run-time polymporhism ?What about class hierarchies ?
I will have to switch contexts very oftenIs it possible to use FP for interactive UI at all ?What about performance critical parts of the code ?
Jan Herich Why would someone learn Clojure ? 2014-08-28 Thu 5 / 14
Doubts & Fears
IDE options for Clojure in suck in general
True, but it’s getting better pretty fastvery good support for Clojure in IntelliJ (as Cursive plugin)abandoned development of Counterclockwise eclipse plugin :/
But most important, there are better options then classic IDEsFantastic Emacs support, almost always up-to date with big andactive contributors comunityOnly slightly less amazing VIM support as a FirePlace plugin :)More radical and innovative approaches to developmentenvironment in the form of LightTable editor and graphicalREPLs such as Gorilla REPL
Jan Herich Why would someone learn Clojure ? 2014-08-28 Thu 6 / 14
Doubts & Fears
Is it worth investing my time ?
It’s nice to learn something new, but it takes a lot of time tofamiliarize yourself with a new programming language, especiallyif it’s an ’alien’ oneThere is nothing wrong with questioning the cost-effectivenessof such investment, especially if you don’t have much free time
Jan Herich Why would someone learn Clojure ? 2014-08-28 Thu 7 / 14
Doubts & Fears
Does anybody really use FP ?
At 28. August 2014, i opened profesia.sk and searched for’Clojure’, i got exactly zero results :)But it get’s a lot better when you consider remote working, withsites as functionaljobs.com offering Clojure/Haskell jobs withincreasing tendencyActive Clojure community worldwide (Around 300 attendees atEuroClojure 2014 in Krakow)Clojure meetup group in Vienna since April 2014 (20-30 activemembers)
Jan Herich Why would someone learn Clojure ? 2014-08-28 Thu 8 / 14
Reaping benefits of functional approach
In the beginning it won’t be easy
Learning basic FP techniques as passing functions around,composing them, building abstractions with partial functions andlearning to leverage higher-order functions can be tough, but it’svery rewarding and fun at the same timeAfter those baby steps, you will probably struggle with generallayout of an application once you start to build something bigger
Don’t panic, it’s just because the class hierarchy you are soaccustomed to is not there anymoreAs strange as it sounds, you will get used to it and after a while,you won’t miss it at all
Jan Herich Why would someone learn Clojure ? 2014-08-28 Thu 9 / 14
Reaping benefits of functional approach
But then later at some point, you will realize
One whole class of problems basically disappearsIncidental complexity resulting from no separation of identityand state goes awayThis could be reasonable source of complexity for bigger OOPprograms, even worse if you start to use multiple threads
Refactoring of functional code is much easierEven harmless local state could become a problem in that case,ever forgot to increment some counter, set some flag ?
Jan Herich Why would someone learn Clojure ? 2014-08-28 Thu 10 / 14
Is switch to new language really necessary ?
Why not only adopt ’good parts’ of FP ?
It seems to be a wise idea to adopt only ’good parts’ of FP intoyour favorite language you are already proficient withMany people already do and you will find a lot of libraries oreven core language features slowly slipping into ’mainstream’OOP languages - such as lambda expressions in Java orHamster- immutable data-structure library for Ruby
Jan Herich Why would someone learn Clojure ? 2014-08-28 Thu 11 / 14
Is switch to new language really necessary ?
Why not only adopt ’good parts’ of FP ?
Unfortunately, there are many problems with that approachFeatures are only added slowly and there is sometimes lack ofcoherence as the ’old way’ of doing things is almost alwaysretained to ensure backwards compatibilityThis is the reason why functional features/additions sometimesfeels ’bolted on’Even if we don’t mind those minor technical details, there is stillbiggger social problem - most of the community is slow toembrace those featuresIf you work with more developers, you can be sure that wheneveryou will push for those features, there will be arguing and lack ofcommon idiomatic approach
Jan Herich Why would someone learn Clojure ? 2014-08-28 Thu 12 / 14
Where to start
Resources & Tutorials
Official Clojure site: http://clojure.orgVery approachable tutorial series for beginners by DanielHigginbotham: http://www.braveclojure.com/Beginner-friendly Clojure programming workshops for women:http://www.clojurebridge.com
Jan Herich Why would someone learn Clojure ? 2014-08-28 Thu 13 / 14
Where to start
Some interesting videos about FP and Clojure
Tim Ewald - Clojure: Programming with Hand Tools:https://www.youtube.com/watch?v=ShEez0JkOFwStuart Halloway - Narcissistic Design:http://vimeo.com/77199361Rich Hickey- Clojure Concurrency:https://www.youtube.com/watch?v=dGVqrGmwOAw&index=3&list=PLZdCLR02grLrEwKaZv-5QbUzK0zGKOOcr
Jan Herich Why would someone learn Clojure ? 2014-08-28 Thu 14 / 14