.NET Day 19 - Go Pro on .NET with F# by Isaac Abraham

.NET Day 19 - Go Pro on .NET with F# by Isaac Abraham

F# has been a part of .NET since the early days of the Framework, yet it still is relatively unknown for a large majority of the .NET developer community. But why is this? With the rise of .NET Core, and with C# going through a large transition at the moment with features such as tuples, pattern matching and non-nullability all influenced from F#, it's never been easier to start using F# today. This talk will cover the discuss the fundamentals of functional programming, cover the basic value proposition of F#, illustrate the philosophy and key language features behind the language, with examples comparing equivalent solutions in C# and F#, as well as looking at the typical life cycle for F# developers. We'll finish up with some demos that show use cases of F# and how, when using a language that has functional programming at its heart, you can "level up" and achieve large boosts in both productivity and developer satisfaction.

E6cffbf3b7a5fbfee4707033ef1636f5?s=128

dotnetday

May 28, 2019
Tweet

Transcript

  1. 1.
  2. 2.
  3. 3.
  4. 5.
  5. 6.
  6. 8.
  7. 9.

    Type Providers Exhaustive Pattern Matching Active Patterns Proper Type Inference

    Quotations Records Sum Types Immutability Lightweight syntax Computation Expressions Curried Functions Pipelines Object Initializers Scripting Modules Tail Recursion
  8. 10.
  9. 12.
  10. 13.
  11. 14.
  12. 15.

    • Inheritance • Nulls • Method overloading Run away •

    Mutable data • Events • Enums • Casting • Statements Use with care • Stateless objects • Interfaces • Dot notation • Index notation • Instance members These are good
  13. 17.
  14. 18.
  15. 20.
  16. 21.
  17. 22.
  18. 24.

    C# is good enough for me 49% F# is too

    complicated 10% It's not an appropriate fit 9% My company don't allow it 32%
  19. 26.
  20. 27.
  21. 28.

    A B C D E F G H I J

    • • • • • •
  22. 29.
  23. 30.
  24. 31.
  25. 32.
  26. 33.
  27. 34.
  28. 35.
  29. 36.
  30. 37.
  31. 38.
  32. 39.
  33. 40.
  34. 42.
  35. 43.
  36. 44.
  37. 45.
  38. 46.
  39. 47.
  40. 49.
  41. 50.
  42. 51.

    Designer- first File -> New Project Code generation Closed source

    Code-first CLI tooling Useful APIs Open source
  43. 53.

    C#2 • Anonymous Functions • Iterators C#3 • Lambda Expressions

    • Type Inference • Extension Methods C#7 • Tuples • Pattern Matching • Local Functions C#8 • Pattern Matching v2 • Switch Expressions • Nullable reference types
  44. 54.
  45. 55.
  46. 58.

    C# • Implicit Conversions • Mutability • Overloading • Cyclical

    References F# • Curried Functions • Pipelines • Type Inference • Lightweight Syntax
  47. 59.

    Implicit conversions Protected access modifier Easy nulls and “part- initialised”

    objects Mutation Cyclical references Implicit expressions Function overloading Open type hierarchies void Early return
  48. 61.
  49. 62.

    Lets you reason about code more easily Lets the compiler

    reason about code more easily Reduce the chance of bugs Results in more succinct code
  50. 63.
  51. 64.
  52. 65.
  53. 66.
  54. 67.
  55. 68.
  56. 69.
  57. 70.
  58. 71.
  59. 72.
  60. 73.
  61. 74.
  62. 75.
  63. 76.
  64. 77.
  65. 78.
  66. 79.
  67. 80.
  68. 81.
  69. 82.
  70. 83.
  71. 84.
  72. 85.
  73. 87.
  74. 88.
  75. 89.
  76. 90.
  77. 91.
  78. 92.
  79. 93.
  80. 94.
  81. 95.
  82. 96.
  83. 97.

    Developer Happiness Trust the platform • Backed by MS •

    Cross Platform • Huge ecosystem Feel supported • Community-led • Open Source • Commercial Feel productive • REPL • Type Inference • Lightweight Syntax Trust the code • Expressions • Immutability • Sum Types
  84. 101.
  85. 102.
  86. 104.

    Spend 30 minutes reading up on F# Get a book,

    make a plan Try hello world Try a simple application Port an application or module that you know Start using F# in your organisation!
  87. 105.
  88. 106.