Break Free with Managed Functional Programming: An Introduction to F#

Software Developer at Achiiv Solutions, LLC
Mar. 26, 2014
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
1 of 91

More Related Content

What's hot

Introduction to c first week slidesIntroduction to c first week slides
Introduction to c first week slidesluqman bawany
Getting started with scala catsGetting started with scala cats
Getting started with scala catsKnoldus Inc.
Introduction to Python Programming Introduction to Python Programming
Introduction to Python Programming Md. Shafiuzzaman Hira
Flow control in PythonFlow control in Python
Flow control in PythonMd. Shafiuzzaman Hira
Programming in python w6Programming in python w6
Programming in python w6Priya Nayak
C Sharp Course 101.5C Sharp Course 101.5
C Sharp Course 101.5Shahed Chowdhuri

Similar to Break Free with Managed Functional Programming: An Introduction to F#

2018 12-kube con-ballerinacon2018 12-kube con-ballerinacon
2018 12-kube con-ballerinaconSanjiva Weerawarana
Progressive f# tutorials nyc dmitry mozorov & jack pappas on code quotations ...Progressive f# tutorials nyc dmitry mozorov & jack pappas on code quotations ...
Progressive f# tutorials nyc dmitry mozorov & jack pappas on code quotations ...Skills Matter
Typescript FundamentalsTypescript Fundamentals
Typescript FundamentalsSunny Sharma
A Type-level Ruby Interpreter for Testing and UnderstandingA Type-level Ruby Interpreter for Testing and Understanding
A Type-level Ruby Interpreter for Testing and Understandingmametter
Introduction to Functional ProgrammingIntroduction to Functional Programming
Introduction to Functional ProgrammingDave Fancher
Typescript pptTypescript ppt
Typescript pptakhilsreyas

Recently uploaded

Obsoleting Global Supply Chain ManagementObsoleting Global Supply Chain Management
Obsoleting Global Supply Chain ManagementConverge
alfred-product-research-proposal.pdfalfred-product-research-proposal.pdf
alfred-product-research-proposal.pdfAlfredSuratos
Cloud Study Jam ppt.pptxCloud Study Jam ppt.pptx
Cloud Study Jam ppt.pptxPoorabpatel
GDSC ZHCET Google Study Jams 23.pdfGDSC ZHCET Google Study Jams 23.pdf
GDSC ZHCET Google Study Jams 23.pdfAbhishekSingh313342
AI Prompt EngineeringAI Prompt Engineering
AI Prompt EngineeringJason J Pulikkottil
WaveTech Investor PresentationWaveTech Investor Presentation
WaveTech Investor PresentationDan Spottsville

Break Free with Managed Functional Programming: An Introduction to F#

Editor's Notes

  1. Developing software for > 10 years Mostly C#/.NET Before that, some Visual Basic, and classic ASP But most important for tonight…
  2. People often ask: Why F#? Why not Haskell, Scala, or Erlang? Question presupposes intent; I didn’t set out to learn a functional language. I outgrew C# and F# matched the way I think..
  3. Query Syntax: Syntactic sugar Compiles to method syntax Added after early adopters reported being confused Method Syntax: Matched the way I think Functional Principles: Purity Referential transparency Higher-order functions
  4. If you’re treating JS as an OO language, you’re doing it wrong JS objects are glorified dictionaries (hashes)
  5. Verbose Generic delegates are verbose & hard to read Repetition: How many times does the compiler need to be told what type something is? Fragile: Reference types can change at any time Side-effects are common Ceremony: Curly braces Parenthesis Explicit returns (training wheels)
  6. Mowing the lawn Hanselminutes #311 Philip Trelford & Richard Minerich F#, a functional language for the CLR
  7. Statement doesn’t tell the whole story
  8. CLR Language: First-class citizen of VS since 2010 Compiles to CIL Strongly-typed Offers cross-language compatibility Realizing the early promise of .NET Often used in mixed language solutions Don Syme – helped develop .NET generics
  9. The live demos are Windows-centric but you can use other platforms Apache 2.0 F# Software Foundation Every major platform
  10. Climbed 25 spots since May 2013
  11. Fizzled out around June 2012 then began its ascent in March 2013
  12. Often lead to better code Often results in less code Generally easier to reason about code Let you stay focused on the problem Enforces many Clean Code guidelines Evolution of SOLID (ref: Mark Seeman’s blog @ ploeh.dk)
  13. Like CShell More interactive than LINQPad
  14. Note: No NuGet Support Example: let add x y = x + y add 5 10;;
  15. Terse Syntax Top-down Constructs Expression-based
  16. Namespaces Same as other languages Logical grouping of code to avoid naming conflicts Modules Static classes Contain only values or functions Let-bound functions cannot be overloaded Can be opened (imported) like namespaces AutoOpenAttribute makes module members visible by opening the module with the namespace is opened
  17. Don’t work with closures C#’s variables work only through compiler magic
  18. Alternative to mutable let bindings Concrete type wraps a mutable value Necessary for mutating within closures (C# does some compiler tricks to hide this) Also allow passing values by reference
  19. Using function returns a value!
  20. Reduces complexity since there’s only one type of function rather than 9 generic overloads of Func and Action
  21. Same underlying types as in C# Tuple<‘T>, and remaining incompatible overloads Easier Native syntax – if you see a comma, it’s a tuple
  22. Light-weight classes Immutable by default CLIMutable for standard .NET serialization Structural equality Visual Studio Demo
  23. Immutable dictionary Good for unchanging data No syntactic shortcuts Map module
  24. Looping while loops Simple For loops Enumerable For loops Branching if expressions if..elif expressions These are expressions if must yield unit if..elif blocks must return both the same type
  25. Overlooked: Sometimes necessary for language interop Sometimes it’s the right tool for the job Power: Can create rich models with classes, structs, and interfaces Polymorphism, inheritance, and encapsulation No concept of protected in F# code but protected members from other languages are still honored Object Expressions: Inline type definitions
  26. Ask about C# 6 features Primary constructors Auto-properties with initializers
  27. Concrete Abstract No static classes static members are allowed use modules or simulate by making members static and sealing Constructors Primary constructors simplify instantiation (C# stole it from us Additional constructors allow chaining No auto-generated default constructor Implicit field definitions Primary constructor parameters become private fields
  28. Virtual members in F# more closely represent how they’re implemented in the CLR. Abstract defines the slot in the virtual method lookup table and default provides the implementation.
  29. Think of as lambda expressions for types Inline implementations of interfaces or base classes Useful as fake objects in unit testing or other places where formal types are overkill
  30. Purity: F# is impure Mutability is allowed Functions can have side-effects Care should be taken to isolate side-effects
  31. Enabled by currying Applying the first n arguments results in a new function Used frequently in pipelined operations
  32. Lets data flow through operations Reverses the argument and function Single-use
  33. Like pipelining but creates a new function Reusable
  34. Each of these are the basis for bindings; bindings use these
  35. Discuss function syntax
  36. Query Expressions LINQ for F# Nullable operators Type Providers Built-in Providers SQL Server Entity Framework OData WSDL Some Third Party Providers App Settings Excel File System Regex XAML