SlideShare une entreprise Scribd logo
1  sur  14
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
Ease 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
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

Projection:
(“mapping”)


Filter:
Set-operations
      SQL: Select … where
Projection:
(“mapping”)LINQ
       C#:

Filter:
        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

Contenu connexe

Similaire à Message passing & NoSQL (in English)

Sînică Alboaie - Programming for cloud computing Flows of asynchronous messages
Sînică Alboaie - Programming for cloud computing Flows of asynchronous messagesSînică Alboaie - Programming for cloud computing Flows of asynchronous messages
Sînică Alboaie - Programming for cloud computing Flows of asynchronous messages
Codecamp Romania
 
Entity centric data_management_2013
Entity centric data_management_2013Entity centric data_management_2013
Entity centric data_management_2013
eXascale Infolab
 
Situation driven development: a methodology for the development of context-aw...
Situation driven development: a methodology for the development of context-aw...Situation driven development: a methodology for the development of context-aw...
Situation driven development: a methodology for the development of context-aw...
damarcant
 

Similaire à Message passing & NoSQL (in English) (20)

Sînică Alboaie - Programming for cloud computing Flows of asynchronous messages
Sînică Alboaie - Programming for cloud computing Flows of asynchronous messagesSînică Alboaie - Programming for cloud computing Flows of asynchronous messages
Sînică Alboaie - Programming for cloud computing Flows of asynchronous messages
 
Enterprise Software Development Patterns
Enterprise Software Development PatternsEnterprise Software Development Patterns
Enterprise Software Development Patterns
 
TU-Charts Project - First Spring
TU-Charts Project - First SpringTU-Charts Project - First Spring
TU-Charts Project - First Spring
 
MongoDB Days Silicon Valley: Winning the Dreamforce Hackathon with MongoDB
MongoDB Days Silicon Valley: Winning the Dreamforce Hackathon with MongoDBMongoDB Days Silicon Valley: Winning the Dreamforce Hackathon with MongoDB
MongoDB Days Silicon Valley: Winning the Dreamforce Hackathon with MongoDB
 
First spring
First springFirst spring
First spring
 
Entity centric data_management_2013
Entity centric data_management_2013Entity centric data_management_2013
Entity centric data_management_2013
 
Brownfield Domain Driven Design
Brownfield Domain Driven DesignBrownfield Domain Driven Design
Brownfield Domain Driven Design
 
Distributed computation
Distributed computationDistributed computation
Distributed computation
 
Situation driven development: a methodology for the development of context-aw...
Situation driven development: a methodology for the development of context-aw...Situation driven development: a methodology for the development of context-aw...
Situation driven development: a methodology for the development of context-aw...
 
PEARC17:A real-time machine learning and visualization framework for scientif...
PEARC17:A real-time machine learning and visualization framework for scientif...PEARC17:A real-time machine learning and visualization framework for scientif...
PEARC17:A real-time machine learning and visualization framework for scientif...
 
Cloud accounting software uk
Cloud accounting software ukCloud accounting software uk
Cloud accounting software uk
 
Quick dive into the big data pool without drowning - Demi Ben-Ari @ Panorays
Quick dive into the big data pool without drowning - Demi Ben-Ari @ PanoraysQuick dive into the big data pool without drowning - Demi Ben-Ari @ Panorays
Quick dive into the big data pool without drowning - Demi Ben-Ari @ Panorays
 
Kafka Streams
Kafka StreamsKafka Streams
Kafka Streams
 
AWS re:Invent 2016: Moving Mission Critical Apps from One Region to Multi-Reg...
AWS re:Invent 2016: Moving Mission Critical Apps from One Region to Multi-Reg...AWS re:Invent 2016: Moving Mission Critical Apps from One Region to Multi-Reg...
AWS re:Invent 2016: Moving Mission Critical Apps from One Region to Multi-Reg...
 
John adams talk cloudy
John adams   talk cloudyJohn adams   talk cloudy
John adams talk cloudy
 
Deconstructing Monoliths with Domain Driven Design
Deconstructing Monoliths with Domain Driven DesignDeconstructing Monoliths with Domain Driven Design
Deconstructing Monoliths with Domain Driven Design
 
MapReduce on Zero VM
MapReduce on Zero VM MapReduce on Zero VM
MapReduce on Zero VM
 
Azure and cloud design patterns
Azure and cloud design patternsAzure and cloud design patterns
Azure and cloud design patterns
 
Introduction to CQRS - command and query responsibility segregation
Introduction to CQRS - command and query responsibility segregationIntroduction to CQRS - command and query responsibility segregation
Introduction to CQRS - command and query responsibility segregation
 
OSA Con 2022 - What Data Engineering Can Learn from Frontend Engineering - Pe...
OSA Con 2022 - What Data Engineering Can Learn from Frontend Engineering - Pe...OSA Con 2022 - What Data Engineering Can Learn from Frontend Engineering - Pe...
OSA Con 2022 - What Data Engineering Can Learn from Frontend Engineering - Pe...
 

Plus de Tuomas Hietanen

Plus de Tuomas Hietanen (9)

Blockchain (using NBitcoin and FSharp)
Blockchain (using NBitcoin and FSharp)Blockchain (using NBitcoin and FSharp)
Blockchain (using NBitcoin and FSharp)
 
Machine learning (using Accord.NET and FSharp)
Machine learning (using Accord.NET and FSharp)Machine learning (using Accord.NET and FSharp)
Machine learning (using Accord.NET and FSharp)
 
Possible FSharp Refactorings could be...
Possible FSharp Refactorings could be...Possible FSharp Refactorings could be...
Possible FSharp Refactorings could be...
 
Function therory
Function theroryFunction therory
Function therory
 
The Pain Points of C#
The Pain Points of C#The Pain Points of C#
The Pain Points of C#
 
Linq in practice
Linq in practiceLinq in practice
Linq in practice
 
Using f# project from c#
Using f# project from c#Using f# project from c#
Using f# project from c#
 
Funktioteoriaa
FunktioteoriaaFunktioteoriaa
Funktioteoriaa
 
Coding with LINQ, Patterns & Practices
Coding with LINQ, Patterns & PracticesCoding with LINQ, Patterns & Practices
Coding with LINQ, Patterns & Practices
 

Dernier

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Dernier (20)

Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
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...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
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
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 

Message passing & NoSQL (in English)

  • 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 Monad Ease 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?
  • 7. Set-operations SQL: Select … where Projection: (“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. Continuation Reify: How long to dream, and when to execute? Possible actions: continue, complete or exception Church 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

Notes de l'éditeur

  1. F# User Group presentation http://www.meetup.com/FSharpHelsinki/events/64378772 v.1.0.2, EnglishThis presentation gives brief introduction to many current topics.
  2. 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
  3. 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
  4. 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.
  5. 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
  6. Basic set-operations: - Map converts items to some others - Filter removes unwanted items
  7. The basic operations are essentially the same, regardless of the technology…F# MapReduce on Azure: http://msdn.microsoft.com/en-us/magazine/gg983490.aspx
  8. 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.
  9. 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
  10. 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.)
  11. 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
  12. 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
  13. 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<T> .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
  14. 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