+ All Categories
Home > Documents > Asynchronous programming on the server and the client in...

Asynchronous programming on the server and the client in...

Date post: 03-Jun-2020
Category:
Upload: others
View: 13 times
Download: 0 times
Share this document with a friend
18
Asynchronous programming on the server and the client in F# Tomas Petricek @tomaspetricek
Transcript
Page 1: Asynchronous programming on the server and the client in F#gotocon.com/dl/...AsynchronousProgrammingOnTheServerAndTheClientInF.pdf · Async on the Server Reactive model is important

Asynchronous programming on the server and the client in F#

Tomas Petricek @tomaspetricek

Page 2: Asynchronous programming on the server and the client in F#gotocon.com/dl/...AsynchronousProgrammingOnTheServerAndTheClientInF.pdf · Async on the Server Reactive model is important
Page 3: Asynchronous programming on the server and the client in F#gotocon.com/dl/...AsynchronousProgrammingOnTheServerAndTheClientInF.pdf · Async on the Server Reactive model is important

In Visual Studio since 2010

Page 4: Asynchronous programming on the server and the client in F#gotocon.com/dl/...AsynchronousProgrammingOnTheServerAndTheClientInF.pdf · Async on the Server Reactive model is important

Asynchronous programming

On the server side On the client side

Page 5: Asynchronous programming on the server and the client in F#gotocon.com/dl/...AsynchronousProgrammingOnTheServerAndTheClientInF.pdf · Async on the Server Reactive model is important

Demo: Social drawing app

Server Agents Browser Client

Page 6: Asynchronous programming on the server and the client in F#gotocon.com/dl/...AsynchronousProgrammingOnTheServerAndTheClientInF.pdf · Async on the Server Reactive model is important

Async on the Server

Reactive programming without the inversion of control

Page 7: Asynchronous programming on the server and the client in F#gotocon.com/dl/...AsynchronousProgrammingOnTheServerAndTheClientInF.pdf · Async on the Server Reactive model is important

Async on the Server

Reactive model is important

Node.js and C# 5.0

F# asynchronous workflows

Keep standard programming model

Standard exception handling and loops

Sequential and parallel composition

Page 8: Asynchronous programming on the server and the client in F#gotocon.com/dl/...AsynchronousProgrammingOnTheServerAndTheClientInF.pdf · Async on the Server Reactive model is important

Agents and message-passing

Protected * ( Behaviour + State )

Page 9: Asynchronous programming on the server and the client in F#gotocon.com/dl/...AsynchronousProgrammingOnTheServerAndTheClientInF.pdf · Async on the Server Reactive model is important

F# and the Browser

F# and Silverlight

Both compiler and libraries

Interactive Try F#

F# and JavaScript

Translating since 2006!

Open-source Pit, commercial WebSharper

Page 10: Asynchronous programming on the server and the client in F#gotocon.com/dl/...AsynchronousProgrammingOnTheServerAndTheClientInF.pdf · Async on the Server Reactive model is important

Have fun!

http://tomasp.net/sd

Page 11: Asynchronous programming on the server and the client in F#gotocon.com/dl/...AsynchronousProgrammingOnTheServerAndTheClientInF.pdf · Async on the Server Reactive model is important

Event handling in F#

Data flow using combinators and control flow using async

Page 12: Asynchronous programming on the server and the client in F#gotocon.com/dl/...AsynchronousProgrammingOnTheServerAndTheClientInF.pdf · Async on the Server Reactive model is important

Asynchronous GUI

User interactions = State machines

Page 13: Asynchronous programming on the server and the client in F#gotocon.com/dl/...AsynchronousProgrammingOnTheServerAndTheClientInF.pdf · Async on the Server Reactive model is important

Asynchronous GUI

Updating rectangles Drawing rectangles

waiting

after 500ms

waiting

drawing

down up

Page 14: Asynchronous programming on the server and the client in F#gotocon.com/dl/...AsynchronousProgrammingOnTheServerAndTheClientInF.pdf · Async on the Server Reactive model is important

Asynchronous GUI

Updating rectangles Drawing rectangles

waiting

after 500ms

waiting

drawing

down up

move

Page 15: Asynchronous programming on the server and the client in F#gotocon.com/dl/...AsynchronousProgrammingOnTheServerAndTheClientInF.pdf · Async on the Server Reactive model is important

What else is there?

F# Interactive in your web browser www.tryfsharp.org

Type providers in F# 3.0

Integrating data in the language

Bridges an important mismatch

Data and services use REST, XML, …

Languages use types and objects

Page 16: Asynchronous programming on the server and the client in F#gotocon.com/dl/...AsynchronousProgrammingOnTheServerAndTheClientInF.pdf · Async on the Server Reactive model is important

Type providers

Page 17: Asynchronous programming on the server and the client in F#gotocon.com/dl/...AsynchronousProgrammingOnTheServerAndTheClientInF.pdf · Async on the Server Reactive model is important

Where to learn more?

Functional and F# trainings

http://functional-programming.net

In London and New York

Functional Programming eXchange

http://skillsmatter.com

Next Friday (March 16th)

Page 18: Asynchronous programming on the server and the client in F#gotocon.com/dl/...AsynchronousProgrammingOnTheServerAndTheClientInF.pdf · Async on the Server Reactive model is important

Summary

Asynchronous programming

Writing non-blocking code

Without the inversion of control

Application areas

Server-side – reactive request processing

Client-side – encoding state machines


Recommended