5 Best practices for F# Development
DANielmohlSommet Groupdmohl@yahoo.comwww.twitter.com/dmohlblog.danielmohl.com
HOW THIs will work1.   Define the Best Practice2.   Explain Why It’s Good3.   Provide Concrete Examples
PROGRAMMING IN THE SMALLPrefer small functions with only  one primary responsibility.
Why is it good?1.  Helps enable function composition2.  Follows the Single Responsibility Principle (SRP)
Examples1.   FSharpCouch2.   IoC Container
Function compositionPrefer function composition over argument passing.
Why is it good?1.   Allows for function chaining2.   Makes the code terse yet readable
Examples1.   Asynchronous Workflows2.   WebSharper 2010
Tail Recursive functionsMake sure your recursive functions are tail recursive.
Why is it good?1.  Without it, there’s a risk for a stack overflow2.  Tail Call Optimization (TCO)
Examples1.  Tail Recursive vs. Non-Tail Recursive2.  Polyphony (Join the Node Cluster)
Verifying tail recursionNot tail recursive
Verifying tail recursiontail recursive
Active patternsPrefer active patterns over multiple ‘when guards’ during pattern matching.
Why is it good?1.  Makes code more readable2.  Supports Don’t Repeat Yourself (DRY)
Type of active patternsSingle-CaseExample: let (|UpperCase|) (x:string) =…Multi-CaseExample: let (|Odd|Even|) x =…PartialExample: let (|DivisibleByTwo|_|) input =…ParameterizedExample: let (|MultipleOf|_|) x input = …- http://blogs.msdn.com/b/chrsmith/
Examples1.  Example of Active Patterns (XML parse)2.  Node Join in Polyphony (DHT)
Pattern MatchingPrefer pattern matching to if/else syntax.
Why is it good?1.  Makes your code easier to extend2.  Helps get you out of the procedural mindset
Examples1.  MVC Template (Account Controller)
Daniel mohlSommet Groupdmohl@yahoo.comwww.twitter.com/dmohlblog.danielmohl.com

More Related Content

PDF
Domain Driven Design with the F# type System -- F#unctional Londoners 2014
PPTX
Dublin ALT.NET session Thu Oct 24 2013
PDF
Railway Oriented Programming
PPTX
What the math geeks don't want you to know about F#
PPTX
TechDaysNL 2015 - F# for C# Developers
PPTX
F# Eye 4 the C# Guy
PPTX
Real World F# - SDD 2015
PPTX
Reasonable Code With Fsharp
Domain Driven Design with the F# type System -- F#unctional Londoners 2014
Dublin ALT.NET session Thu Oct 24 2013
Railway Oriented Programming
What the math geeks don't want you to know about F#
TechDaysNL 2015 - F# for C# Developers
F# Eye 4 the C# Guy
Real World F# - SDD 2015
Reasonable Code With Fsharp

Similar to 5 Best Practices For F# Development (20)

PPTX
Domain Modeling & Full-Stack Web Development F#
PDF
Functional Programming Patterns (NDC London 2014)
PPTX
Practical F#
PPTX
How Functional Programming Made Me A Better Developer
PPTX
Introduction to F# for the C# developer
PDF
Pipeline oriented programming
PDF
F# and Reactive Programming for iOS
PPTX
F# Tutorial @ QCon
PDF
Functional Design Patterns (DevTernity 2018)
PPTX
Getting+started+with+f#+web+development
PPTX
Can F# make us better as .NET developers?
PPTX
Code quality
PPTX
Code Quality
PPTX
Functional-style control flow in F#
PPTX
Succeeding with Functional-first Programming in Enterprise
PPTX
F# for C# devs - SDD 2015
PDF
[4DEV] Bartosz Sokół - Functional developer in object oriented world - how F#...
PPTX
Sharper tools with F#
PPTX
Creating Domain Specific Languages in F#
PPTX
F# for C# devs - Copenhagen .Net 2015
Domain Modeling & Full-Stack Web Development F#
Functional Programming Patterns (NDC London 2014)
Practical F#
How Functional Programming Made Me A Better Developer
Introduction to F# for the C# developer
Pipeline oriented programming
F# and Reactive Programming for iOS
F# Tutorial @ QCon
Functional Design Patterns (DevTernity 2018)
Getting+started+with+f#+web+development
Can F# make us better as .NET developers?
Code quality
Code Quality
Functional-style control flow in F#
Succeeding with Functional-first Programming in Enterprise
F# for C# devs - SDD 2015
[4DEV] Bartosz Sokół - Functional developer in object oriented world - how F#...
Sharper tools with F#
Creating Domain Specific Languages in F#
F# for C# devs - Copenhagen .Net 2015
Ad

Recently uploaded (20)

PPT
What is a Computer? Input Devices /output devices
PDF
A contest of sentiment analysis: k-nearest neighbor versus neural network
PPTX
2018-HIPAA-Renewal-Training for executives
PPTX
Modernising the Digital Integration Hub
PDF
Zenith AI: Advanced Artificial Intelligence
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PDF
Consumable AI The What, Why & How for Small Teams.pdf
PDF
STKI Israel Market Study 2025 version august
DOCX
search engine optimization ppt fir known well about this
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PDF
Getting started with AI Agents and Multi-Agent Systems
PDF
Five Habits of High-Impact Board Members
PPTX
The various Industrial Revolutions .pptx
PDF
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
PDF
UiPath Agentic Automation session 1: RPA to Agents
PPTX
Benefits of Physical activity for teenagers.pptx
What is a Computer? Input Devices /output devices
A contest of sentiment analysis: k-nearest neighbor versus neural network
2018-HIPAA-Renewal-Training for executives
Modernising the Digital Integration Hub
Zenith AI: Advanced Artificial Intelligence
A comparative study of natural language inference in Swahili using monolingua...
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
Final SEM Unit 1 for mit wpu at pune .pptx
Consumable AI The What, Why & How for Small Teams.pdf
STKI Israel Market Study 2025 version august
search engine optimization ppt fir known well about this
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
Getting started with AI Agents and Multi-Agent Systems
Five Habits of High-Impact Board Members
The various Industrial Revolutions .pptx
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
UiPath Agentic Automation session 1: RPA to Agents
Benefits of Physical activity for teenagers.pptx
Ad

5 Best Practices For F# Development