SlideShare una empresa de Scribd logo
1 de 32
Turning to the Functional side(Using C# and F#) Phil Trelford http://trelford.com/blog@ptrelford Tomas Petricek http://tomasp.net/blog@tomaspetricek
About Us Tomas  Author of F# book for C# programmers Worked with the F# team at Microsoft First blogged about F# in May 2006 Phil  Software Developer and Architect Worked on first F# applications at Microsoft Co-organizer of London F# User Group
Tutorial Goals Introduce Functional Concepts with F# and C# Non-goals Provide in-depth understanding Mass conversion to functional programming cult Sell books
Jargon Buster OO = Object Orientated FP = Functional Programming Lambda = Anonymous Function DSL = Domain Specific Language
Thoughtworks Technology Radar 2011
Languages circa 2010
Languages go multi-paradigm
F# is a mix of
What is F#? F# is multi-paradigm language, that is: Functional Declarative Object Orientated Imperative .Net language with VS integration
Running F# Visual Studio 2010 Visual Studio Shell + F#  MonoDevelop on Linux and Mac F# Compiler + Emacs etc. In your browser
FP hits mainstream Visual Studio gets F# C# gets LINQ, lambdas, etc C++ gets lambdas JVM gets Clojure & Scala
Writing queries with LINQ Query syntax supported in C# 3.0 Functional programming concepts Declaratively describes “what” not “how” Written as single expression varq= frompindb.Products wherep.UnitPrice>75.0M selectString.Format("{0} - ${1}",  p.ProductName, p.UnitPrice);
Graphical User Interface Frameworks XUL (Mozilla), Glade (Gtk), XAML (.NET) Functional programming concepts Compose button with ellipse inside Specify behavior declaratively <Buttonx:Name="greenBtn" Background="Black">   <EllipseWidth="75"Height="75" Fill="LightGreen" /> </Button> <DoubleAnimationStoryboard.TargetName="greenBtn" Storyboard.TargetProperty="(Canvas.Left)"     From="0.0"To="100.0"Duration="0:0:5" />
Specifying financial contracts in F# Functional programming concepts Declaratively describes “what” not “how” Written as single expression Composed from small number of primitives letmarch day = DateTime(2011, 3, day) letitTrades =   (sell (tradeAt(march15) "GOOG"500)) $   (between (march10) (march19) (trade"MSFT"1000)) lettradeAtdatewhatamount = between datedate (trade whatamount)
Code Samples 1: // Declare a local value (inferred type is string) 2: letworld="world" 3:  4: // Using '%s' format specifier to include string parameter 5: printfn"Hello %s!"world  
Functional data structures A way of thinking about problems Model data using composition of primitives Tuple    Combine two values of different types Discriminated Union    Represents one of several options List    Zero or more values of the same type
Tuples: Containers for a few different things
Discriminated Unions: Exclusive alternatives
Representing event schedule Object-oriented way Easy to add new cases Hard to add new functions Functional way Easy to add new functions Hard to add new cases Good thing about F# and Scala– you can use both!
List: Heads and Tails
Map Reduce MapReduce is a patented software framework introduced by Google to support distributed computing on large data sets on clusters of computers. Functional design scales extremely well!
Domain Modelling Retail Domain -> Testing
Checkout application workflow Think of a simple while loop Implement… Mutable field to keep the state and event handlers? Asynchronous while loop in F#
Asynchronous and concurrent programming Asynchronous GUI in Checkout example Single-threaded thanks to Async.StartImmediate Easy way to encode control flow Parallel programming Workflows are non-blocking computations Run workflows in parallel with Async.Parallel Concurrent programming Compose application from (thousands of) agents Agents communicate using messages
Wild Card Filler Silverlight mini-samples
Summary FP is already in the mainstream FP languages are ready Start small, go big Language Orientated Programming Exploratory and Scripting Asynchronous & Concurrency Technical Computing Testing
Summary Don’t underestimate  the power of the  functional side
Meet the F#ers
F# Books
On the horizon Next Meet: In the brain of  Rob Pickering on March 16th
Q & A http://Fsharp.net http://fssnip.net http://tomasp.net/blog http://trelford.com/blog

Más contenido relacionado

La actualidad más candente

Effective Data Analysis with Deedle
Effective Data Analysis with DeedleEffective Data Analysis with Deedle
Effective Data Analysis with DeedleHoward Mansell
 
Dmitry mozorov on code quotations code as-data for f#
Dmitry mozorov on code quotations code as-data for f#Dmitry mozorov on code quotations code as-data for f#
Dmitry mozorov on code quotations code as-data for f#Skills Matter
 
F# for functional enthusiasts
F# for functional enthusiastsF# for functional enthusiasts
F# for functional enthusiastsJack Fox
 
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 ...
Progressive f# tutorials nyc dmitry mozorov & jack pappas on code quotations ...Skills Matter
 
Data analysis with R and Julia
Data analysis with R and JuliaData analysis with R and Julia
Data analysis with R and JuliaMark Tabladillo
 
F# Type Providers in Depth
F# Type Providers in DepthF# Type Providers in Depth
F# Type Providers in DepthTomas Petricek
 
Introduction to Rstudio
Introduction to RstudioIntroduction to Rstudio
Introduction to RstudioOlga Scrivner
 
C & C++ Training in Ambala ! BATRA COMPUTER CENTRE
C & C++ Training in Ambala ! BATRA COMPUTER CENTREC & C++ Training in Ambala ! BATRA COMPUTER CENTRE
C & C++ Training in Ambala ! BATRA COMPUTER CENTREjatin batra
 
C++ questions and answers
C++ questions and answersC++ questions and answers
C++ questions and answersDeepak Singh
 

La actualidad más candente (20)

Effective Data Analysis with Deedle
Effective Data Analysis with DeedleEffective Data Analysis with Deedle
Effective Data Analysis with Deedle
 
Dmitry mozorov on code quotations code as-data for f#
Dmitry mozorov on code quotations code as-data for f#Dmitry mozorov on code quotations code as-data for f#
Dmitry mozorov on code quotations code as-data for f#
 
F# for functional enthusiasts
F# for functional enthusiastsF# for functional enthusiasts
F# for functional enthusiasts
 
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 ...
Progressive f# tutorials nyc dmitry mozorov & jack pappas on code quotations ...
 
Data analysis with R and Julia
Data analysis with R and JuliaData analysis with R and Julia
Data analysis with R and Julia
 
F# in MonoDevelop
F# in MonoDevelopF# in MonoDevelop
F# in MonoDevelop
 
C vs c++
C vs c++C vs c++
C vs c++
 
Have you met Julia?
Have you met Julia?Have you met Julia?
Have you met Julia?
 
F# Type Providers in Depth
F# Type Providers in DepthF# Type Providers in Depth
F# Type Providers in Depth
 
Lecture 2 lisp-Overview
Lecture 2 lisp-OverviewLecture 2 lisp-Overview
Lecture 2 lisp-Overview
 
basics of c++
basics of c++basics of c++
basics of c++
 
Introduction to Rstudio
Introduction to RstudioIntroduction to Rstudio
Introduction to Rstudio
 
Create Your Own Language
Create Your Own LanguageCreate Your Own Language
Create Your Own Language
 
Swift vs. Language X
Swift vs. Language XSwift vs. Language X
Swift vs. Language X
 
LIL Presentation
LIL PresentationLIL Presentation
LIL Presentation
 
C & C++ Training in Ambala ! BATRA COMPUTER CENTRE
C & C++ Training in Ambala ! BATRA COMPUTER CENTREC & C++ Training in Ambala ! BATRA COMPUTER CENTRE
C & C++ Training in Ambala ! BATRA COMPUTER CENTRE
 
R language
R languageR language
R language
 
Fun with java 8
Fun with java 8Fun with java 8
Fun with java 8
 
C++ questions and answers
C++ questions and answersC++ questions and answers
C++ questions and answers
 
R language
R languageR language
R language
 

Destacado

Presentation Earth Saver Canvas Bags
Presentation Earth Saver Canvas BagsPresentation Earth Saver Canvas Bags
Presentation Earth Saver Canvas Bagsmcoprean
 
Docase notation for Haskell
Docase notation for HaskellDocase notation for Haskell
Docase notation for HaskellTomas Petricek
 
Doing data science with F#
Doing data science with F#Doing data science with F#
Doing data science with F#Tomas Petricek
 
Queries in general purpose languages
Queries in general purpose languagesQueries in general purpose languages
Queries in general purpose languagesTomas Petricek
 
Social Media in Small Business is Anything But Small
Social Media in Small Business is Anything But SmallSocial Media in Small Business is Anything But Small
Social Media in Small Business is Anything But SmallMark Schmulen
 

Destacado (8)

Presentation Earth Saver Canvas Bags
Presentation Earth Saver Canvas BagsPresentation Earth Saver Canvas Bags
Presentation Earth Saver Canvas Bags
 
Tics
TicsTics
Tics
 
Docase notation for Haskell
Docase notation for HaskellDocase notation for Haskell
Docase notation for Haskell
 
Doing data science with F#
Doing data science with F#Doing data science with F#
Doing data science with F#
 
Queries in general purpose languages
Queries in general purpose languagesQueries in general purpose languages
Queries in general purpose languages
 
F# on the Server-Side
F# on the Server-SideF# on the Server-Side
F# on the Server-Side
 
Academia
AcademiaAcademia
Academia
 
Social Media in Small Business is Anything But Small
Social Media in Small Business is Anything But SmallSocial Media in Small Business is Anything But Small
Social Media in Small Business is Anything But Small
 

Similar a F# Tutorial @ QCon

Bay NET Aug 19 2009 presentation ppt
Bay  NET Aug 19 2009 presentation pptBay  NET Aug 19 2009 presentation ppt
Bay NET Aug 19 2009 presentation pptArt Scott
 
Progressive f# tutorials nyc don syme on keynote f# in the open source world
Progressive f# tutorials nyc don syme on keynote f# in the open source worldProgressive f# tutorials nyc don syme on keynote f# in the open source world
Progressive f# tutorials nyc don syme on keynote f# in the open source worldSkills Matter
 
Visual Studio .NET2010
Visual Studio .NET2010Visual Studio .NET2010
Visual Studio .NET2010Satish Verma
 
Exploring SharePoint with F#
Exploring SharePoint with F#Exploring SharePoint with F#
Exploring SharePoint with F#Talbott Crowell
 
Programing paradigm &amp; implementation
Programing paradigm &amp; implementationPrograming paradigm &amp; implementation
Programing paradigm &amp; implementationBilal Maqbool ツ
 
Sudipta_Mukherjee_Resume-Nov_2022.pdf
Sudipta_Mukherjee_Resume-Nov_2022.pdfSudipta_Mukherjee_Resume-Nov_2022.pdf
Sudipta_Mukherjee_Resume-Nov_2022.pdfSudipta Mukherjee
 
Algorithm and Programming
Algorithm and ProgrammingAlgorithm and Programming
Algorithm and ProgrammingNidal Abusaleh
 
Envisioning the Future of Language Workbenches
Envisioning the Future of Language WorkbenchesEnvisioning the Future of Language Workbenches
Envisioning the Future of Language WorkbenchesMarkus Voelter
 
Build your own Language - Why and How?
Build your own Language - Why and How?Build your own Language - Why and How?
Build your own Language - Why and How?Markus Voelter
 
Key Features Of The Pseudo Code
Key Features Of The Pseudo CodeKey Features Of The Pseudo Code
Key Features Of The Pseudo CodeAngilina Jones
 
Procedural Programming Of Programming Languages
Procedural Programming Of Programming LanguagesProcedural Programming Of Programming Languages
Procedural Programming Of Programming LanguagesTammy Moncrief
 
OOP Comparative Study
OOP Comparative StudyOOP Comparative Study
OOP Comparative StudyDarren Tan
 
Introduction To Computer Programming
Introduction To Computer ProgrammingIntroduction To Computer Programming
Introduction To Computer ProgrammingHussain Buksh
 
OBJECT ORIENTED PROGRAMMING.docx
OBJECT ORIENTED PROGRAMMING.docxOBJECT ORIENTED PROGRAMMING.docx
OBJECT ORIENTED PROGRAMMING.docxAleKi2
 

Similar a F# Tutorial @ QCon (20)

Bay NET Aug 19 2009 presentation ppt
Bay  NET Aug 19 2009 presentation pptBay  NET Aug 19 2009 presentation ppt
Bay NET Aug 19 2009 presentation ppt
 
Introduction to F#
Introduction to F#Introduction to F#
Introduction to F#
 
Practical F#
Practical F#Practical F#
Practical F#
 
Progressive f# tutorials nyc don syme on keynote f# in the open source world
Progressive f# tutorials nyc don syme on keynote f# in the open source worldProgressive f# tutorials nyc don syme on keynote f# in the open source world
Progressive f# tutorials nyc don syme on keynote f# in the open source world
 
Visual Studio .NET2010
Visual Studio .NET2010Visual Studio .NET2010
Visual Studio .NET2010
 
F# 101
F# 101F# 101
F# 101
 
Exploring SharePoint with F#
Exploring SharePoint with F#Exploring SharePoint with F#
Exploring SharePoint with F#
 
Programing paradigm &amp; implementation
Programing paradigm &amp; implementationPrograming paradigm &amp; implementation
Programing paradigm &amp; implementation
 
F# and the DLR
F# and the DLRF# and the DLR
F# and the DLR
 
Sudipta_Mukherjee_Resume-Nov_2022.pdf
Sudipta_Mukherjee_Resume-Nov_2022.pdfSudipta_Mukherjee_Resume-Nov_2022.pdf
Sudipta_Mukherjee_Resume-Nov_2022.pdf
 
Algorithm and Programming
Algorithm and ProgrammingAlgorithm and Programming
Algorithm and Programming
 
Envisioning the Future of Language Workbenches
Envisioning the Future of Language WorkbenchesEnvisioning the Future of Language Workbenches
Envisioning the Future of Language Workbenches
 
Build your own Language - Why and How?
Build your own Language - Why and How?Build your own Language - Why and How?
Build your own Language - Why and How?
 
Key Features Of The Pseudo Code
Key Features Of The Pseudo CodeKey Features Of The Pseudo Code
Key Features Of The Pseudo Code
 
Procedural Programming Of Programming Languages
Procedural Programming Of Programming LanguagesProcedural Programming Of Programming Languages
Procedural Programming Of Programming Languages
 
CLTL Software and Web Services
CLTL Software and Web Services CLTL Software and Web Services
CLTL Software and Web Services
 
1504.00693
1504.006931504.00693
1504.00693
 
OOP Comparative Study
OOP Comparative StudyOOP Comparative Study
OOP Comparative Study
 
Introduction To Computer Programming
Introduction To Computer ProgrammingIntroduction To Computer Programming
Introduction To Computer Programming
 
OBJECT ORIENTED PROGRAMMING.docx
OBJECT ORIENTED PROGRAMMING.docxOBJECT ORIENTED PROGRAMMING.docx
OBJECT ORIENTED PROGRAMMING.docx
 

Más de Tomas Petricek

Coeffects: A Calculus of Context-Dependent Computation
Coeffects: A Calculus of Context-Dependent ComputationCoeffects: A Calculus of Context-Dependent Computation
Coeffects: A Calculus of Context-Dependent ComputationTomas Petricek
 
Domain Specific Languages: The Functional Way
Domain Specific Languages: The Functional WayDomain Specific Languages: The Functional Way
Domain Specific Languages: The Functional WayTomas Petricek
 
F# Data: Making structured data first class citizens
F# Data: Making structured data first class citizensF# Data: Making structured data first class citizens
F# Data: Making structured data first class citizensTomas Petricek
 
Doing data science with F# (BuildStuff)
Doing data science with F# (BuildStuff)Doing data science with F# (BuildStuff)
Doing data science with F# (BuildStuff)Tomas Petricek
 
How F# Learned to Stop Worrying and Love the Data
How F# Learned to Stop Worrying and Love the DataHow F# Learned to Stop Worrying and Love the Data
How F# Learned to Stop Worrying and Love the DataTomas Petricek
 
Information-rich programming in F# (ML Workshop 2012)
Information-rich programming in F# (ML Workshop 2012)Information-rich programming in F# (ML Workshop 2012)
Information-rich programming in F# (ML Workshop 2012)Tomas Petricek
 
Asynchronous programming in F# (QCon 2012)
Asynchronous programming in F# (QCon 2012)Asynchronous programming in F# (QCon 2012)
Asynchronous programming in F# (QCon 2012)Tomas Petricek
 
Concurrent programming with Agents
Concurrent programming with AgentsConcurrent programming with Agents
Concurrent programming with AgentsTomas Petricek
 

Más de Tomas Petricek (9)

Coeffects: A Calculus of Context-Dependent Computation
Coeffects: A Calculus of Context-Dependent ComputationCoeffects: A Calculus of Context-Dependent Computation
Coeffects: A Calculus of Context-Dependent Computation
 
Domain Specific Languages: The Functional Way
Domain Specific Languages: The Functional WayDomain Specific Languages: The Functional Way
Domain Specific Languages: The Functional Way
 
F# Data: Making structured data first class citizens
F# Data: Making structured data first class citizensF# Data: Making structured data first class citizens
F# Data: Making structured data first class citizens
 
Doing data science with F# (BuildStuff)
Doing data science with F# (BuildStuff)Doing data science with F# (BuildStuff)
Doing data science with F# (BuildStuff)
 
How F# Learned to Stop Worrying and Love the Data
How F# Learned to Stop Worrying and Love the DataHow F# Learned to Stop Worrying and Love the Data
How F# Learned to Stop Worrying and Love the Data
 
Information-rich programming in F# (ML Workshop 2012)
Information-rich programming in F# (ML Workshop 2012)Information-rich programming in F# (ML Workshop 2012)
Information-rich programming in F# (ML Workshop 2012)
 
Asynchronous programming in F# (QCon 2012)
Asynchronous programming in F# (QCon 2012)Asynchronous programming in F# (QCon 2012)
Asynchronous programming in F# (QCon 2012)
 
Teaching F#
Teaching F#Teaching F#
Teaching F#
 
Concurrent programming with Agents
Concurrent programming with AgentsConcurrent programming with Agents
Concurrent programming with Agents
 

Último

"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 

Último (20)

"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 

F# Tutorial @ QCon

  • 1. Turning to the Functional side(Using C# and F#) Phil Trelford http://trelford.com/blog@ptrelford Tomas Petricek http://tomasp.net/blog@tomaspetricek
  • 2. About Us Tomas Author of F# book for C# programmers Worked with the F# team at Microsoft First blogged about F# in May 2006 Phil Software Developer and Architect Worked on first F# applications at Microsoft Co-organizer of London F# User Group
  • 3. Tutorial Goals Introduce Functional Concepts with F# and C# Non-goals Provide in-depth understanding Mass conversion to functional programming cult Sell books
  • 4. Jargon Buster OO = Object Orientated FP = Functional Programming Lambda = Anonymous Function DSL = Domain Specific Language
  • 8. F# is a mix of
  • 9. What is F#? F# is multi-paradigm language, that is: Functional Declarative Object Orientated Imperative .Net language with VS integration
  • 10. Running F# Visual Studio 2010 Visual Studio Shell + F# MonoDevelop on Linux and Mac F# Compiler + Emacs etc. In your browser
  • 11. FP hits mainstream Visual Studio gets F# C# gets LINQ, lambdas, etc C++ gets lambdas JVM gets Clojure & Scala
  • 12. Writing queries with LINQ Query syntax supported in C# 3.0 Functional programming concepts Declaratively describes “what” not “how” Written as single expression varq= frompindb.Products wherep.UnitPrice>75.0M selectString.Format("{0} - ${1}", p.ProductName, p.UnitPrice);
  • 13. Graphical User Interface Frameworks XUL (Mozilla), Glade (Gtk), XAML (.NET) Functional programming concepts Compose button with ellipse inside Specify behavior declaratively <Buttonx:Name="greenBtn" Background="Black"> <EllipseWidth="75"Height="75" Fill="LightGreen" /> </Button> <DoubleAnimationStoryboard.TargetName="greenBtn" Storyboard.TargetProperty="(Canvas.Left)" From="0.0"To="100.0"Duration="0:0:5" />
  • 14. Specifying financial contracts in F# Functional programming concepts Declaratively describes “what” not “how” Written as single expression Composed from small number of primitives letmarch day = DateTime(2011, 3, day) letitTrades = (sell (tradeAt(march15) "GOOG"500)) $ (between (march10) (march19) (trade"MSFT"1000)) lettradeAtdatewhatamount = between datedate (trade whatamount)
  • 15. Code Samples 1: // Declare a local value (inferred type is string) 2: letworld="world" 3: 4: // Using '%s' format specifier to include string parameter 5: printfn"Hello %s!"world  
  • 16.
  • 17. Functional data structures A way of thinking about problems Model data using composition of primitives Tuple Combine two values of different types Discriminated Union Represents one of several options List Zero or more values of the same type
  • 18. Tuples: Containers for a few different things
  • 20. Representing event schedule Object-oriented way Easy to add new cases Hard to add new functions Functional way Easy to add new functions Hard to add new cases Good thing about F# and Scala– you can use both!
  • 22. Map Reduce MapReduce is a patented software framework introduced by Google to support distributed computing on large data sets on clusters of computers. Functional design scales extremely well!
  • 23. Domain Modelling Retail Domain -> Testing
  • 24. Checkout application workflow Think of a simple while loop Implement… Mutable field to keep the state and event handlers? Asynchronous while loop in F#
  • 25. Asynchronous and concurrent programming Asynchronous GUI in Checkout example Single-threaded thanks to Async.StartImmediate Easy way to encode control flow Parallel programming Workflows are non-blocking computations Run workflows in parallel with Async.Parallel Concurrent programming Compose application from (thousands of) agents Agents communicate using messages
  • 26. Wild Card Filler Silverlight mini-samples
  • 27. Summary FP is already in the mainstream FP languages are ready Start small, go big Language Orientated Programming Exploratory and Scripting Asynchronous & Concurrency Technical Computing Testing
  • 28. Summary Don’t underestimate the power of the functional side
  • 31. On the horizon Next Meet: In the brain of Rob Pickering on March 16th
  • 32. Q & A http://Fsharp.net http://fssnip.net http://tomasp.net/blog http://trelford.com/blog

Notas del editor

  1. Thoughtworkstechnlogy radar: http://www.thoughtworks.com/radar/Image source: http://www.thoughtworks.com/sites/www.thoughtworks.com/files/files/tw-radar-april-2010.pdfSee also: http://qconlondon.com/london-2010/file?path=/qcon-london-2010/slides/AmandaLaucher_and_JoshGraham_TheStateOfTheArtNET12MonthsOfThingsToLearn.pdf
  2. http://en.wikipedia.org/wiki/Dynamic_programming_language
  3. http://en.wikipedia.org/wiki/Comparison_of_programming_languagesDefinitions of FP, OO and Dynamic
  4. Python = light, C# = OO, OCaml = Functional
  5. http://tryfsharporg.cloudapp.net/http://trelford.com/MissileCommand.fsx