From FPX 2015, video at: https://skillsmatter.com/skillscasts/6417-functional-programming-in-an-imperative-world#video
Once upon a time there was a small company with a large codebase. That codebase had been written in the well understood languages of "VeeBeeDotNet" and "CeeSharp". After a while, more people starting working for the small company, and while they all knew some CeeSharp and VeeBeeDotNet, some of them also spoke strange foreign languages like "Erlang" and "EffSharp". They liked these languages, and were unwilling to give up what they saw as their powerful magical properties of pureness. So they hatched a plan..
This talk is a completely anecdotal review of how a group of developers (not managers) introduced functional techniques and languages into a company with an existing imperative code base - and existing imperative coders! Learn how we convinced management it wasn't insane. How we picked low risk, high impact tasks to illustrate language advantages. And how we spread the joy to others who hadn't used functional programming languages before.
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Functional Programming in an Imperitive World
1.
2. Once upon a time there was a small company
with a large codebase. That codebase had been
written in the well understood languages of
"VeeBeeDotNet" and "CeeSharp".
After a while, more people started working for the
small company, and while they all knew some
“CeeSharp” and “VeeBeeDotNet”, some of them
also spoke strange foreign languages like "Erlang"
and "EffSharp". They liked these languages, and
were unwilling to give up what they saw as their
powerful magical properties of purity. So they
hatched a plan…
3. etting the
scene
"Alphabet-Golden-Bible-letter-S" by SVG Perhelion (Original unknown) - Own work; Shaw, Henry: “Alphabets & Numbers of the
Middle Ages” (1845) FROM THE GOLDEN BIBLE, printed at Augsburg[1]
http://www.archive.org/details/handbookofmediae00shawrich. Licensed under CC BY 3.0 via Wikimedia Commons-
http://commons.wikimedia.org/wiki/File:Alphabet-Golden-Bible-letter-S.svg#/media/File:Alphabet-Golden-Bible-letter-S.svg
6. ear is the
mind killer
"Alphabet-Golden-Bible-letter-F" by SVG Perhelion (Original unknown) - Own work; Shaw, Henry: “Alphabets & Numbers of the
Middle Ages” (1845) FROM THE GOLDEN BIBLE, Printed at Augsburg[1]
http://www.archive.org/details/handbookofmediae00shawrich. Licensed under CC BY 3.0 via Wikimedia Commons -
http://commons.wikimedia.org/wiki/File:Alphabet-Golden-Bible-letter-F.svg#/media/File:Alphabet-Golden-Bible-letter-F.svg
7. •Change is hard – and risky
•Need to convince:
•Management
•Your peers
Fear is the mind killer
8.
9. [Dan Luu’s] post “The Empirical
Evidence That Types Affect Productivity
and Correctness” summarizes a large
set of papers and goes through each
one in order to describe what it is
trying to measure and how well it does
it. In almost every paper, he has valid
critique of the experiment, methodology
and approach.
https://medium.com/@jlouis666/proglang-design-with-evidence-1444213f3902
10. ilute the
risk
"Alphabet-Golden-Bible-letter-D" by SVG Perhelion (Original unknown) - Own work; Shaw, Henry: “Alphabets & Numbers of the
Middle Ages” (1845) FROM THE GOLDEN BIBLE, Printed at Augsburg[1]
http://www.archive.org/details/handbookofmediae00shawrich. Licensed under CC BY 3.0 via Wikimedia Commons -
http://commons.wikimedia.org/wiki/File:Alphabet-Golden-Bible-letter-F.svg#/media/File:Alphabet-Golden-Bible-letter-D.svg
14. •Fix the badly broken
•Pick an interoperable language
Dilute the risk
15.
16.
17.
18.
19.
20. o the
impossible
"Alphabet-Golden-Bible-letter-D" by SVG Perhelion (Original unknown) - Own work; Shaw, Henry: “Alphabets & Numbers of the
Middle Ages” (1845) FROM THE GOLDEN BIBLE, Printed at Augsburg[1]
http://www.archive.org/details/handbookofmediae00shawrich. Licensed under CC BY 3.0 via Wikimedia Commons -
http://commons.wikimedia.org/wiki/File:Alphabet-Golden-Bible-letter-F.svg#/media/File:Alphabet-Golden-Bible-letter-D.svg
21. •What’s so risky it’s never been
done?
•Can a functional language help?
Do the impossible
22. “Ripper 5” Storn Cook, http://www.enworld.org/forum/showthread.php?161795-Storn-s-art-for-swipin-!/page12
CC licensed - http://creativecommons.org/licenses/by-nc-sa/2.5/
The Heroes
28. teal from
the best
"Alphabet-Golden-Bible-letter-S" by SVG Perhelion (Original unknown) - Own work; Shaw, Henry: “Alphabets & Numbers of the
Middle Ages” (1845) FROM THE GOLDEN BIBLE, printed at Augsburg[1]
http://www.archive.org/details/handbookofmediae00shawrich. Licensed under CC BY 3.0 via Wikimedia Commons-
http://commons.wikimedia.org/wiki/File:Alphabet-Golden-Bible-letter-S.svg#/media/File:Alphabet-Golden-Bible-letter-S.svg
29. •If you can’t go to the functional
language…
•…bring the functional concepts
to yours
•And then tell people where they
came from!
Steal from the best
33. inally
"Alphabet-Golden-Bible-letter-F" by SVG Perhelion (Original unknown) - Own work; Shaw, Henry: “Alphabets & Numbers of the
Middle Ages” (1845) FROM THE GOLDEN BIBLE, Printed at Augsburg[1]
http://www.archive.org/details/handbookofmediae00shawrich. Licensed under CC BY 3.0 via Wikimedia Commons -
http://commons.wikimedia.org/wiki/File:Alphabet-Golden-Bible-letter-F.svg#/media/File:Alphabet-Golden-Bible-letter-F.svg
35. “Old Paper” background courtesy of http://www.pieceofeight.com/
https://www.flickr.com/photos/67779350@N00/167159577/ Attribution 2.0 Generic (CC BY 2.0)
Questions?
@mavnn
http://blog.mavnn.co.uk
@15below_tech
http://www.15below.com
Notes de l'éditeur
Not finished
5-6 F#ers
Most new code still C#
Company started 2000
RyanAir
VB6 csv processing
Microsoft shop
Changing personal comms
Changing expectations
Changing code base
Buy in that change needed
But: don’t kill the golden goose
2+ million lines of code in 2012
Rapidly expanding development team
Lot’s going on:
C#, Git, TeamCity, Automated Deploys
What about functional?
15min
Need to convince up (risk averse monetarily)
Need to convince across (change aversion, new skills required)
Can’t just point at a study and came an RoI
Don’t sell FP: sell a solution to a problem
That might mean FP is a by product of your solution
Jesper L. Andersen
Need to reduce fear
How?
15-20 min
Fix the badly broken
Things that work really well together
Keep the old, use with the new
Unit tests!
Sproc.Lock, Parser code
Play framework
Not so sure Java -> Clojure?
Or ClojureScript, FunScript, PureScript, Ocamljs, ghcjs, scala.js…
25-30min
Hard to be compatible?
Can’t find anything already broken?
Look for the “impossible” that hasn’t been done yet.
Find something the current tech is bad at
Come in like a superhero
Convince management and rest of team
Compile time checks of interesting things (write your own printf)
Explore complex datasets
Looks magic! Even (especially?) to non experts
*NOT DOMAIN READABILITY!*
Massive savings of time/code in certain types of scenarios
Parsing
Rules logic
(Active patterns)
Side effect of purity
…but lots of good options in functional langs
Huge readability gain for non-coders
{} people will tell you it looks strange
But get the domain experts to read the code
(Jane Street, Simon Cousins)
Not actually related to FP
But lots of FP langs have good metaprogramming
Bring concepts from functional programming into the existing codebase
Publicise where they came from!
35min
Bring concepts from functional programming into the existing codebase
Publicise where they came from!
Message passing with the actor model
Akka(.net)
Functional? Maybe. Build awareness/acceptance
Property based testing
QuickCheck, FsCheck
Just keep on putting shapes that match in
Just write functional code!
And teach others too
40min
DevEds
A selection from the above: unit tests, build scripting, FsCheck, parsing
DevEds
(Linus Pauling)