Functional Programming in an
Imperative World!
Michael Newton @mavnn
Character illustrations: Storn Cook, Creative Commons: Attribution-NonCommercial-ShareAlike 2.5 see http://www.enworld.org/forum/showthread.php?161795-Storn-s-art-for-swipin-!/page3&p=2874435&viewfull=1#post2874435
Down in the trenches, the Agents of C# and their VB.net support bots have managed to keep out the dreaded Dr. Bankrupt so far.
But the Market never sleeps, and the challenges are growing. Some of the newer agents speak of super heroes that can be summoned to aid the cause - the Fearsome F#, Erlang the Messenger... if only the sacrifice is made of keeping the code pure.
The Story so far...
Eyjafjallajökull
Setting the Scene
Fear is the Mind Killer
• Change is hard - and risky
• Need to convince:
• Management
• Your peers
Don't confuse me with facts!
[Dan Liu'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.
The point is that while these papers shows almost no effect in either direction, they are often used to “Justify your view” in one direction or the other.
(https://medium.com/@jlouis666/proglang-design-with-evidence-1444213f3902#.ujwfbigvo)
Dilute the Risk
• Fix the badly broken
<TargetFrameworkProfile></TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
Fake 'n' Shake
Dilute the Risk
• Fix the badly broken
• Pick an interoperable language
Together... They Fight Crime!
C#F#
VB.net
F#
Scala Java
Clojure
Java
Elm
(Your Server)
Do the Impossible!
• What's so risky... it's never been done?
• Can a functional language help?
Do the Impossible!
Type Providers
Pattern Matching
Concurrency
Currying
Metaprogramming
Steal from the Best
• If you can't go to the functional language...
• ...bring the functional concepts to yours
• And then tell people where they came from!
Actors
Property Based Testing
RX Redux
Lambdas
itertools
LINQ
And finally... teach!
Questions??
@mavnn ltd
http://mavnn.co.uk
http://blog.mavnn.co.uk