Post on 17-Dec-2014
description
Continuation, MessagePassing & NoSQL
The Greater Helsinki Area F# User Group
http://www.meetup.com/FSharpHelsinki/
© Tuomas Hietanen, 2012
Forecast…
The number of different data producers increases
The number of processors and communication increases
We don’t know the runtime environment…
(Could be e.g. cloud; Azure)
Turing, state machines and objects
Nouns vs. verbs• Who is the owner of the activity?• Object versus event
The problems of state machine:• Complexity: What’s going on?• Who caused the present state? How to reproduce?• Asynchrony-problems, locks
Encapsulation of the state: Type vs Class vs Monad
Type
• No state
Class
• State may be directly exposed
• The state is also revealed through the methods
Monad
• Like no state• The state is
revealed when leaving out
Ease up programming in “a particular context”
The role of a Domain Model
Intended for developers• The computer itself doesn’t get any benefits
Attemps to model the playfield• Advantages vs. disadvantages?
Roles• Active / anemice• Can the model evolve?
Set-operations
x x x
x x y x x
y y yx = y
x = okFilter:
Projection:(“mapping”)
Set-operations
x x x
x x y x x
y y yx = y
x = okFilter:
Projection:(“mapping”)
SQL: Select … where
C#: LINQ
Other languages: Map, Filter
Cloud: MapReduce
Reactive programming
Observe the surrounding environment
Set-operations to environment events
Event sourcing (CQRS)
Event history
Aggregate the Domain Model
Notice the similarity to reactive programming
Message passing
Transport messages (Message may also be an event.)
Set-operations to messages
Actors
Don’t reveal their state
Uses message passing• May call others• …or itself
Agents
Don’t reveal their state• Handles requests
Uses message passing• May call others• …or itself
Continuation
Reify: How long to dream, and when to execute?
Possible actions: continue, complete or exception
Church vs. Call-with-current-continuation (call/cc)
NoSQL: Data without schema
Document databases• No IDs• Dualism with SQL-databases• RavenDB, MongoDB
Big Data• Log-files, GPS-data, etc• Hadoop, MapReduce