SlideShare uma empresa Scribd logo
1 de 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

Mais conteúdo relacionado

Semelhante a 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
 

Semelhante a 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...
 

Último

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Último (20)

Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
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...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
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
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
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
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
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
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 

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