Message passing & NoSQL (in English)
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Message passing & NoSQL (in English)

on

  • 802 views

F# User Group presentation ...

F# User Group presentation
Many current topics briefly.
More descriptions in the notes-tab.


Same presentation in Finnish:
http://www.slideshare.net/thorium/message-passing-nosql

Statistics

Views

Total Views
802
Views on SlideShare
797
Embed Views
5

Actions

Likes
0
Downloads
0
Comments
0

5 Embeds 5

https://twimg0-a.akamaihd.net 1
https://si0.twimg.com 1
http://www.linkedin.com 1
https://www.linkedin.com 1
https://twitter.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

CC Attribution-NoDerivs LicenseCC Attribution-NoDerivs License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • F# User Group presentation http://www.meetup.com/FSharpHelsinki/events/64378772 v.1.0.2, EnglishThis presentation gives brief introduction to many current topics.
  • The cloud is hype, but it is a bit related to reality also… The number of information sources is growing The number of processors is growing The diversity of communication partners is growingMaybe the theoretical model separates from the physical architecture: E.g. Windows Azure tries to hide the physical architecture. The runtime environment may be unknown.F# has Azure support out-of-the-box.More information: http://archive.msdn.microsoft.com/fsharpazure
  • Object-oriented programming is often done on nouns, not verbs.This is strange because:Functionality is what a customer wants… VerbsThe order of parameters is weird: Object itself is usually the main parameter. The return type is usually defined first and then the rest of the parameters (which should not even exist) after the method.Turing has long been right, but is he still?There is challenges in the future: While the number of processors grows, the current state management of programs cannot continue
  • Type: Used for program correctness checksClass: Exposes state through the methods and functionalityMonad: Normal imperative like programming and ignoring the stateMonad and class are subsets of type.Brian Beckman: Don't fear the Monad: http://channel9.msdn.com/Shows/Going+Deep/Brian-Beckman-Dont-fear-the-MonadsMonad context examples: nullable, list, async, cloud, …F#, Cloud computing as a monad: http://www.m-brace.netF# Computation expressions, aka. monads:”Interface”: http://msdn.microsoft.com/en-us/library/dd233182.aspxImplementation: http://blogs.msdn.com/b/dsyme/archive/2007/09/22/some-details-on-f-computation-expressions-aka-monadic-or-workflow-syntax.aspxMonad is constructed with the Builder type. Inside a monad { … } the programming is as usual. In C#, LINQ has to be used inside a monad.Dynamic typing has it advantages, and it is good in small non-maintainable things.
  • The Domain Model directs the thinking to certain tracks (in good and in bad).What would be a bad Domain Model?- The one, where the functionality is in the wrong objects.Can the Domain Model change, by itself, when the time goes by?Do the developers get a clear picture of a changing model?Role: Where is the validation and business logic? What is the boundaries of the context? Will it model the whole context or only the core problem area?Real-time Domain Model with F#: http://www.simontylercousins.net/journal/2012/5/6/nooo-nosql-real-time-domain-model.html
  • Basic set-operations: - Map converts items to some others - Filter removes unwanted items
  • The basic operations are essentially the same, regardless of the technology…F# MapReduce on Azure: http://msdn.microsoft.com/en-us/magazine/gg983490.aspx
  • Reactive programming is based on thinking events as infinite lazy lists.It converts asynchronous programming to normal set-operation-programming.Makes it much easier when there is a lot of async events: No locks, no state, no class-variable-checks-to-eventhandlersF# has direct support, but with Microsoft Reactive Extensions will gain you more power.Reactive extensions, theory is based on continuation: http://channel9.msdn.com/Shows/Going+Deep/Expert-to-Expert-Brian-Beckman-and-Erik-Meijer-Inside-the-NET-Reactive-Framework-RxReactive extensions in practice: http://channel9.msdn.com/Blogs/codefest/DC2010T0100-Keynote-Rx-curing-your-asynchronous-programming-bluesReactive extensions observable as F# monad: https://gist.github.com/165605/ee7329952053d06d013d91059f33fe0f2ef0630fSubject is a class, which contains both, observer and observable.ReplaySubject is a class, which plays all the events (including the past) to a new subscriber.
  • CQRS & Event Sourcing -model: Separate the read- and write-operations. - Read operations are easy queries to the ”cache” (=e.g. NoSQL-database).- Write operations are written to the event history (event storage), which is the primary data store- Then asynchronically the history is being transformed (aggregated) to the domain model and the business logic is being run. The results are stored to the read cache.Event storage (“Event Loop”) provides a free “audit-trail” functionality and some additional benefits.The functionality is actually the same as Reactive Extensions ReplaySubject, while the point of view is a bit different.CQRS, Event-Sourcing on F#: https://github.com/Thorium/SimpleCQRS-Fsharp
  • Message passing is one option implement asynchrony without explicit locking.A message can be passed (asynchronously) to the passer itself. Thus, recursion is easily accessible and also e.g. event history.(Recursion doesn’t have to be visible to outside.)
  • The Actor model is a theory that treats "Actors" as the universal primitives of concurrent digital computation. Actor may: Process information Store data Communicate with other actorsActor encapsulate its state.The Actor model: http://channel9.msdn.com/Shows/Going+Deep/Hewitt-Meijer-and-Szyperski-The-Actor-Model-everything-you-wanted-to-know-but-were-afraid-to-ask
  • F#MailboxProcessor class uses agents model.No explicit locks, synchronization is done by queue…A kind of list-in-its-own-background-thread.Good performance: Asynchronous operations respond immediately. Operations requiring synchronization are still useful with millions of items (with standard laptop, if enough memory).Simple example of what message-passing real-time-domain-model could be: http://www.fssnip.net/bP
  • For example LINQ-methods take functions as input parameters, which they execute in a certain point.Such point, from operation to another, “Continuation”, is a bit like a functional GOTO.It is an essential part of function composition.Reify (/Reification)means the call to execute an expression tree. (For example: C# side-effect IEnumerable .ToList())The standard C-programming language semicolon “;” can be thought as continuation-monad; it has three possible alternatives what can happen: To continue to the next (and pass the whole world as its parameter). To complete: to end the execution, as return-statement. Raise an exception.There are many kind of continuations: Church-style (e.g. Haskell), based on partial application, and that the last parameter is left out before execution. Call-with-current-continuation “call/cc” (e.g. Scheme), based on transferring the next execution as last parameter.Additional information: http://stackoverflow.com/a/10325698/17791
  • If data schema is available, F# 3.0 Type-Providers are a great option.Always the schema is not available: Schema creation, and converting the data to it, may be a daunting task.Even there is no ID-based relation tables, the reference mechanism is duality with SQL-databases: they can do the same things.http://queue.acm.org/detail.cfm?id=1961297MapReduce is actually the same set-operations as usual, only this time used to control the distributed environment.Raven DB: http://skillsmatter.com/podcast/design-architecture/building-software-ayendes-wayNoSQLRavenDB on F#: http://ravendb.net/docs/client-api/fsharpHadoop on Windows Azure: http://channel9.msdn.com/Events/windowsazure/learn/Hadoop-on-Windows-AzureGeneric based Framework for .NetHadoopMapReduce Job Submission http://blogs.msdn.com/b/carlnol/archive/2012/04/29/generic-based-framework-for-net-hadoop-mapreduce-job-submission.aspxDon Syme, F# 3.0 Information Rich Programming: http://skillsmatter.com/podcast/scala/fsharp3

Message passing & NoSQL (in English) Presentation Transcript

  • 1. http://www.meetup.com/FSharpHelsinki/© Tuomas Hietanen, 2012
  • 2. 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)
  • 3. 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
  • 4. Encapsulation of the state:Type vs Class vs MonadEase up programming in “a particular context” Type Class Monad• No state • State may be • Like no state directly exposed • The state is • The state is also revealed when revealed through leaving out the methods
  • 5. 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?
  • 6. Set-operationsProjection:(“mapping”)Filter:
  • 7. Set-operations SQL: Select … whereProjection:(“mapping”)LINQ C#:Filter: Other languages: Map, Filter Cloud: MapReduce
  • 8. Reactive programming Observe the surrounding environment Set-operations to environment events
  • 9. Event sourcing (CQRS) Event history Aggregate the Domain Model Notice the similarity to reactive programming
  • 10. Message passing Transport messages (Message may also be an event.) Set-operations to messages
  • 11. Actors Don’t reveal their state Uses message passing • May call others • …or itself
  • 12. Agents Don’t reveal their state • Handles requests Uses message passing • May call others • …or itself
  • 13. ContinuationReify: How long to dream, and when to execute?Possible actions: continue, complete or exceptionChurch vs. Call-with-current-continuation (call/cc)
  • 14. NoSQL: Data without schema Document databases • No IDs • Dualism with SQL-databases • RavenDB, MongoDB Big Data • Log-files, GPS-data, etc • Hadoop, MapReduce