SlideShare a Scribd company logo
1 of 23
Getting Started
    with F# Web
    Development

•    Daniel Mohl
•    @dmohl
•    blog.danielmohl.com
•    github.com/dmohl

1
2             June 16, 2012




 DanielMohl
  @dmohl
  blog.danielmohl.com
  github.com/dmohl


 Getting   Started with F# Web Development
3   June 16, 2012
4   June 16, 2012
5              June 16, 2012




Daniel Mohl
F# MVP and C# Insider


        danmohl@gmail.com
        www.twitter.com/dmohl
        blog.danielmohl.com
6              June 16, 2012




What Are We Doing?
 Why  F#?
 F# Primer/Review
 F#/C# ASP.NET MVC 4 Example
 ASP.NET Web API, Service Stack, Nancy,
  Frank
 Windows Azure
 WebSharper Example
7                  June 16, 2012




Why Functional? Why F#?
   Simple Code to Solve Complex Problems
       Terse Yet Readable
       Less Errors
   The Move to Multi-core (immutable by default)
   Programming in the Small (Single Responsibility
    Principle)
   Higher Level Language Provides Optimization
    Opportunities
   Code That is Correct More Often
   Features Not In Other Mainstream Languages
   Staying Ahead of the Competition
   Why Functional Programming Matters
   F# in the Enterprise
8                  June 16, 2012




Why F# for Web Dev?
   Asynchronous Workflows and Reactive
    Programming
   F#/JavaScript Commonalities
   Easier to support next generation web
    development
       HTML5 (Web Sockets, Canvas)
       Asynchronous and Reactive Programming
Web Socket Example
Canvas Example
Twitter Feed Sample (Reactive Programming)
9    June 16, 2012




F# Primer/Review

 Whitespace  Matters
 The let Keyword
 Pattern Matching
 More During the Demos
10               June 16, 2012




    Whitespace Matters
//F#                    //C#
open System             using System;
let doSomething val =
                        namespace ConsoleApplication1
    val + val
                        {
Console.WriteLine         class Program
    (doSomething 1)       {
                            static int doSomething(int val)
                            {
                                return val + val;
                            }
                            static void Main(string[] args)
                            {
                                Console.WriteLine(
                                    doSomething(1));
                            }
                          }
                        }
11               June 16, 2012




    The let Keyword
//F#                    //C#
open System             using System;
let val2 = 1
                        namespace ConsoleApplication1
let doSomething val =
                        {
    val + val2            class Program
Console.WriteLine         {
    (doSomething 1)         static int val2 = 1;
                            static int doSomething(int val)
                            {
                                return val + val2;
                            }
                            static void Main(string[] args)
                            {
                                Console.WriteLine(
                                    doSomething(1));
                            }
                          }
12                  June 16, 2012




Pattern Matching
Kind of like a switch/case statement, but so
much more!
Example 1:
let boolVal = true
match boolVal with
| true -> printf “was true”
| _ -> printf “was not true”

Example 2:
let name = "Dan", "Mohl"
match name with
| _, "Smith" -> printf "Found a Smith"
| "Don", _ -> printf "Found a Don"
| "Dan", "Mohl" -> printf "Found Dan Mohl"
| _ -> printf "Name not found"
13               June 16, 2012




A Few General Examples

 Sample   F# Script (Simple Strategy Pattern
  Example)
 Fetch Museum List (Async Example)
 Twitter Feed (Reactive Programming
  Example)
 Interactive DirectX
14              June 16, 2012




F#/C# ASP.NET MVC 4
Example
http://visualstudiogallery.msdn.microsoft.co
m/3d2bf938-fc9e-403c-90b3-8de27dc23095
15              June 16, 2012




F#/C# ASP.NET Web API
http://visualstudiogallery.msdn.microsoft.co
m/3d2bf938-fc9e-403c-90b3-8de27dc23095
16      June 16, 2012




Sidebar


          Windows 9?
17   June 16, 2012




Windows 8
18   June 16, 2012




Windows 9?
19   June 16, 2012




Other Web Frameworks
-   Service Stack

-   Nancy

-   Frank
20               June 16, 2012




F# and Azure
-   Fog - https://github.com/dmohl/Fog
21              June 16, 2012




WebSharper Example
http://visualstudiogallery.msdn.microsoft.co
m/en-us/288b94ea-0ea7-4dde-8906-
f72eb22fbe1b

Check out http://fpish.net for an example
of a live site built with WebSharper.
22                  June 16, 2012




More Information
   Books - http://msdn.microsoft.com/en-
    us/fsharp/gg262865.aspx
   F# MSDN - http://msdn.microsoft.com/en-
    us/fsharp/gg262865.aspx
   Blogs
   Twitter
   Ask – F# has the greatest community around
23             June 16, 2012




Daniel Mohl
F# MVP and C# Insider


        danmohl@gmail.com
        www.twitter.com/dmohl
        blog.danielmohl.com

More Related Content

Similar to Getting+started+with+f#+web+development

Cross-Platform Mobile Development in Visual Studio
Cross-Platform Mobile Development in Visual StudioCross-Platform Mobile Development in Visual Studio
Cross-Platform Mobile Development in Visual Studio
bryan costanich
 
Save time by applying clean code principles
Save time by applying clean code principlesSave time by applying clean code principles
Save time by applying clean code principles
Edorian
 

Similar to Getting+started+with+f#+web+development (20)

Cross-Platform Mobile Development in Visual Studio
Cross-Platform Mobile Development in Visual StudioCross-Platform Mobile Development in Visual Studio
Cross-Platform Mobile Development in Visual Studio
 
State ofappdevelopment
State ofappdevelopmentState ofappdevelopment
State ofappdevelopment
 
Intro To AOP
Intro To AOPIntro To AOP
Intro To AOP
 
.Net passé, présent et futur
.Net passé, présent et futur.Net passé, présent et futur
.Net passé, présent et futur
 
Training javascript 2012 hcmut
Training javascript 2012 hcmutTraining javascript 2012 hcmut
Training javascript 2012 hcmut
 
.NET and C# introduction
.NET and C# introduction.NET and C# introduction
.NET and C# introduction
 
Developing Android and iOS Apps With C#, .NET, Xamarin, Mono, and Windows Azure
Developing Android and iOS Apps With C#, .NET, Xamarin, Mono, and Windows AzureDeveloping Android and iOS Apps With C#, .NET, Xamarin, Mono, and Windows Azure
Developing Android and iOS Apps With C#, .NET, Xamarin, Mono, and Windows Azure
 
Building Cross-Platform Mobile Apps
Building Cross-Platform Mobile AppsBuilding Cross-Platform Mobile Apps
Building Cross-Platform Mobile Apps
 
Hacking the Codename One Source Code - Part IV - Transcript.pdf
Hacking the Codename One Source Code - Part IV - Transcript.pdfHacking the Codename One Source Code - Part IV - Transcript.pdf
Hacking the Codename One Source Code - Part IV - Transcript.pdf
 
Code Documentation. That ugly thing...
Code Documentation. That ugly thing...Code Documentation. That ugly thing...
Code Documentation. That ugly thing...
 
Introduction to Go language
Introduction to Go languageIntroduction to Go language
Introduction to Go language
 
JS Class 2016
JS Class 2016JS Class 2016
JS Class 2016
 
JS class slides (2016)
JS class slides (2016)JS class slides (2016)
JS class slides (2016)
 
Why kotlininandroid
Why kotlininandroidWhy kotlininandroid
Why kotlininandroid
 
C# 6
C# 6C# 6
C# 6
 
Universal app techniques on how to share files
Universal app techniques on how to share filesUniversal app techniques on how to share files
Universal app techniques on how to share files
 
(1) c sharp introduction_basics_dot_net
(1) c sharp introduction_basics_dot_net(1) c sharp introduction_basics_dot_net
(1) c sharp introduction_basics_dot_net
 
Android Dev Study Jam.pptx
Android Dev Study Jam.pptxAndroid Dev Study Jam.pptx
Android Dev Study Jam.pptx
 
Save time by applying clean code principles
Save time by applying clean code principlesSave time by applying clean code principles
Save time by applying clean code principles
 
JMP205 - Integration of IBM Lotus Notes and Lotus Domino with Microsoft Offic...
JMP205 - Integration of IBM Lotus Notes and Lotus Domino with Microsoft Offic...JMP205 - Integration of IBM Lotus Notes and Lotus Domino with Microsoft Offic...
JMP205 - Integration of IBM Lotus Notes and Lotus Domino with Microsoft Offic...
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data PlatformLess Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
 
Choreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringChoreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software Engineering
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Navigating Identity and Access Management in the Modern Enterprise
Navigating Identity and Access Management in the Modern EnterpriseNavigating Identity and Access Management in the Modern Enterprise
Navigating Identity and Access Management in the Modern Enterprise
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 

Getting+started+with+f#+web+development

  • 1. Getting Started with F# Web Development • Daniel Mohl • @dmohl • blog.danielmohl.com • github.com/dmohl 1
  • 2. 2 June 16, 2012  DanielMohl  @dmohl  blog.danielmohl.com  github.com/dmohl  Getting Started with F# Web Development
  • 3. 3 June 16, 2012
  • 4. 4 June 16, 2012
  • 5. 5 June 16, 2012 Daniel Mohl F# MVP and C# Insider danmohl@gmail.com www.twitter.com/dmohl blog.danielmohl.com
  • 6. 6 June 16, 2012 What Are We Doing?  Why F#?  F# Primer/Review  F#/C# ASP.NET MVC 4 Example  ASP.NET Web API, Service Stack, Nancy, Frank  Windows Azure  WebSharper Example
  • 7. 7 June 16, 2012 Why Functional? Why F#?  Simple Code to Solve Complex Problems  Terse Yet Readable  Less Errors  The Move to Multi-core (immutable by default)  Programming in the Small (Single Responsibility Principle)  Higher Level Language Provides Optimization Opportunities  Code That is Correct More Often  Features Not In Other Mainstream Languages  Staying Ahead of the Competition  Why Functional Programming Matters  F# in the Enterprise
  • 8. 8 June 16, 2012 Why F# for Web Dev?  Asynchronous Workflows and Reactive Programming  F#/JavaScript Commonalities  Easier to support next generation web development  HTML5 (Web Sockets, Canvas)  Asynchronous and Reactive Programming Web Socket Example Canvas Example Twitter Feed Sample (Reactive Programming)
  • 9. 9 June 16, 2012 F# Primer/Review  Whitespace Matters  The let Keyword  Pattern Matching  More During the Demos
  • 10. 10 June 16, 2012 Whitespace Matters //F# //C# open System using System; let doSomething val = namespace ConsoleApplication1 val + val { Console.WriteLine class Program (doSomething 1) { static int doSomething(int val) { return val + val; } static void Main(string[] args) { Console.WriteLine( doSomething(1)); } } }
  • 11. 11 June 16, 2012 The let Keyword //F# //C# open System using System; let val2 = 1 namespace ConsoleApplication1 let doSomething val = { val + val2 class Program Console.WriteLine { (doSomething 1) static int val2 = 1; static int doSomething(int val) { return val + val2; } static void Main(string[] args) { Console.WriteLine( doSomething(1)); } }
  • 12. 12 June 16, 2012 Pattern Matching Kind of like a switch/case statement, but so much more! Example 1: let boolVal = true match boolVal with | true -> printf “was true” | _ -> printf “was not true” Example 2: let name = "Dan", "Mohl" match name with | _, "Smith" -> printf "Found a Smith" | "Don", _ -> printf "Found a Don" | "Dan", "Mohl" -> printf "Found Dan Mohl" | _ -> printf "Name not found"
  • 13. 13 June 16, 2012 A Few General Examples  Sample F# Script (Simple Strategy Pattern Example)  Fetch Museum List (Async Example)  Twitter Feed (Reactive Programming Example)  Interactive DirectX
  • 14. 14 June 16, 2012 F#/C# ASP.NET MVC 4 Example http://visualstudiogallery.msdn.microsoft.co m/3d2bf938-fc9e-403c-90b3-8de27dc23095
  • 15. 15 June 16, 2012 F#/C# ASP.NET Web API http://visualstudiogallery.msdn.microsoft.co m/3d2bf938-fc9e-403c-90b3-8de27dc23095
  • 16. 16 June 16, 2012 Sidebar Windows 9?
  • 17. 17 June 16, 2012 Windows 8
  • 18. 18 June 16, 2012 Windows 9?
  • 19. 19 June 16, 2012 Other Web Frameworks - Service Stack - Nancy - Frank
  • 20. 20 June 16, 2012 F# and Azure - Fog - https://github.com/dmohl/Fog
  • 21. 21 June 16, 2012 WebSharper Example http://visualstudiogallery.msdn.microsoft.co m/en-us/288b94ea-0ea7-4dde-8906- f72eb22fbe1b Check out http://fpish.net for an example of a live site built with WebSharper.
  • 22. 22 June 16, 2012 More Information  Books - http://msdn.microsoft.com/en- us/fsharp/gg262865.aspx  F# MSDN - http://msdn.microsoft.com/en- us/fsharp/gg262865.aspx  Blogs  Twitter  Ask – F# has the greatest community around
  • 23. 23 June 16, 2012 Daniel Mohl F# MVP and C# Insider danmohl@gmail.com www.twitter.com/dmohl blog.danielmohl.com