SlideShare uma empresa Scribd logo
1 de 30
Baixar para ler offline
FF TO FP
   Starring

       SCALA
AKKA 2
PLAY! FRAMEWORK 2
FP USING SCALA
   What is FP?
   Scala =?= FP
   In action...
WHAT IS FP?
FUNCTION == FIRST CLASS CITIZEN
WHAT IS A FUNCTION?
                      x                         eix + e-ix
        div(x, y) =                cos(x) =
                      y                 2
     Takes same Inputs. Produces same Outputs.
    No State change (Immutability). No Exceptions
Define behavior not tasks! Enables true composability.
    No Side-Effects == Referential Transparency
WHAT IS A FIRST CLASS CITIZEN?
A function is a tool like a structure or a primitive might
                             be.
  They encourage reuse and sharing. Thanks to their
                      composability.
 The simplest composition being the classical f o g     .
      But there are plenty of others... of course.
SCALA =?= FP
   Yes but mmmh...
> OO kept!
> Best of both worlds
> Imperative permitted
IMMUTABILITY
cs casUe(
 ae ls sr
  frtaeSrn,
  isNm:tig
  lsNm:tig
  ataeSrn,
  aeIt
  g:n
)

vlnota =Ue(ad" "erla,3)
 a oosb  sr"ny, ptel" 1

nota.isNm ="oh / BN !
 oosbfrtae na" / AG

vlna =nota.oyfrtae="oh,ae=2
 a oh  oosbcp(isNm  Na" g  )
NO EXCEPTIONS: OPTION
tatUi {
 ri tl
  dfpren(:tig:It
  e asItsSrn) n
}

vliIt=Ui.asIt"" / Wa d yuepc?
 a :n tlpren(a) / ht o o xet

tatUi {
 ri tl
  dfpren(:tig:Oto[n]
  e asItsSrn) pinIt
}

vliOto[n]=Ui.asIt"" / = Nn =>BtWY
 a :pinIt   tlpren(a) / = oe = u H?
vloe
 a n      =Ui.asIt"" / = Sm() ..Hywe
            tlpren(1) / = oe1  . e h
r' tetp?
 es h ye
EXCEPTIONS. BUT...
tatUi {
 ri tl
  dfpren(:tig:Ete[xeto,It
  e asItsSrn) ihrEcpin n]
}

vli
 a   =Ui.asIt"" /Lf(ubromtxeto(..)
       tlpren(a) /etNmeFraEcpin"."
)
vloe =Ui.asIt"" /Rgh1
 a n   tlpren(1) /it()
USE THE VALUES: MAPPER
vlaep:pinIt =Ui.asItrqetgt"g")
 a gOtOto[n]  tlpren(eus.e(ae)
vlueOt=aep.a((g:n)= Ue(sm" "n" ae )
 a srp  gOtmp aeIt > sr"oe, Oe, g)

/mpueteebdvle. ltssewt Ls
 /a s h me au.. e' e ih it
vlnosa =Ue(ad" "erla,3)
 a ootb   sr"ny, ptel" 1
vlna
 a oh   =Ue(na" "erla,2
          sr"oh, ptel" )

vluesLs[sr =Ls(ootb na)
 a sr:itUe]  itnosa, oh

vlae:itIt
 a gsLs[n]   =uesmp (:sr = uae)
               sr.a( uUe) > .g
vlaeSmlr
 a gsipe     =uesmp u= uae)
               sr.a(  > .g
vlaeEeSml
 a gsvnipe   =uesmp_ae
               sr.a(.g)
COMPOSABILITY: FLATMAPPER
tatRqet{
 ri eus
  dfgtkySrn)Oto[tig
  e e(e:tig:pinSrn]
}
vlaeau:pinSrn]
 a gVleOto[tig    =rqetgt"g"
                    eus.e(ae)
vlaep:pinIt
 a gOtOto[n]      =Ui.asItaeau)
                    tlpren(gVle
/ BN !
 / AG

vlaepOtOto[pinIt]=aeau.a(tlpren()
 a gOtp:pinOto[n]  gVlempUi.asIt_
)
/ BN !!
 / AG !

vlaeOto[n]
 a g:pinIt       =aeau.lta(tlpren
                   gVlefaMpUi.asI
t_)
 ()
/Go,ddû
 /od ij
ADD CONTROL: FILTER
vlaeau:pinSrn] =rqetgt"g"
 a gVleOto[tig  eus.e(ae)
vlaep:pinIt
 a gOtOto[n]   =aeau.lta(tlpren()
                gVlefaMpUi.asIt_)

vlalwd =aep.itr_> 1)
 a loe   gOtfle( = 8

vlna
 a oh   =alwdmpUe(na" "erla,_)/Nn
          loe.a(sr"oh, ptel" ) /oe
vlnota =alwdmpUe(ad" "erla,_)/Sm
 a oosb   loe.a(sr"ny, ptel" ) /oe
PUTTING THE PIECES TOGETHER
dfgtloeUe(eus:eus)Oto[sr ={
 e eAlwdsrrqetRqet:pinUe]
  vlfrtaep:pinSrn]=rqetgt"isNm"
  a isNmOtOto[tig   eus.e(frtae)
  vllsNmOtOto[tig =rqetgt"atae)
  a ataep:pinSrn]   eus.e(lsNm"
  vlaep:pinIt
  a gOtOto[n]     =rqetgt"g".lta(t
                    eus.e(ae)faMpU
i.asIt_)
 lpren()
  vlalwdgOtOto[n] =aep.itr_> 1)
  a loeAep:pinIt    gOtfle( = 8

    frtaep.lta {frtae=
     isNmOtfaMp     isNm >
      lsNmOtfaMp{lsNm =
       ataep.lta    atae >
        alwdgOtmp{alwdg =
         loeAep.a   loeAe >
          Ue(isNm,lsNm,alwdg)
           srfrtae atae loeAe
        }
      }
    }
}
FOR COMPREHENSION
dfgtsrcekg:n=Boen(eus:eus)=
 e eUe(hcAeIt>ola)rqetRqet
  fr{
  o
   frtae< rqetgt"isNm"
    isNm - eus.e(frtae)
   lsNm < rqetgt"atae)
    atae - eus.e(lsNm"
   aetig< rqetgt"g"
    gSrn - eus.e(ae)
   ae
    g    < Ui.asItaetig i cekg(g)
          - tlpren(gSrn) f hcAeae
  }yedUe(isNm,lsNm,ae
    il srfrtae atae g)

tp Rqet=MpSrn,Srn]
 ye eus  a[tig tig

vlalwdoDr :It= Boen
 a loeFroa n > ola           =(:n)> 2
                               _It =
vlgtloeUe :Rqet= Oto[sr
 a eAlwdsr eus > pinUe]      =gtsralwd
                               eUe(loeF
oDr)_
 roa

vlna
 a oh   =gtloeUe(
          eAlwdsr
            Mp
             a(
              "isNm">na"
               frtae-"oh,
              "atae-"erla,
               lsNm">ptel"
              "g">2
               ae-""
            )
          )
GET REAL?
Alt+Tab and code!
DISTRIBUTED ET AL. W/ AKKA
          Messages
           Actors
           Mailbox
        Fault-Tolerant
MESSAGES
         Sharing resource
             Synchronous
Message Passing Style to the rescue
Don't call, but send asynchronously
              Immutable
ACTORS
         Worker/Sender
React to message, Create message
           Hold a state
            Mutable
MAILBOX
                Queue of messages
Invoke dedicated actor when computing unit available
FAULT TOLERANT
             Actors hidden by reference
            Actors created hierarchically
Onion layers of supervision => restart, stop, bubble, ...
CODE IN PEACE
Back to the wild
PLAY! WITH THE WEB
Reactive and non-blocking
Asynchronous with no pain
       Scala & Java
  End-to-end integration
REACTIVE AND NON-BLOCKING
       Using JBoss Netty
React to content using Iteratees
ASYNCHRONOUS WITH NO PAIN
 Using Promise and Future...
 ... easily using Continuation
SCALA & JAVA
Scala for the core and API
    Java API available
END-TO-END INTEGRATION
From the database to the web client
 Reduce runtime time exceptions...
  ... Increase compile time errors
>> PLAY NEW
THANKS!
    (FOR NOT LEAVING)
chipchip: @noootsab
G+: andy.petrella
social coding: github / andypetrella
FB: RIP
Blog (TBC): http://ska-la.blogspot.be
Company: NextLab

      Come Back! @WAJUG
Ff to-fp

Mais conteúdo relacionado

Mais procurados

The State of PHPUnit
The State of PHPUnitThe State of PHPUnit
The State of PHPUnitEdorian
 
CyberLink LabelPrint 2.5 Exploitation Process
CyberLink LabelPrint 2.5 Exploitation ProcessCyberLink LabelPrint 2.5 Exploitation Process
CyberLink LabelPrint 2.5 Exploitation ProcessThomas Gregory
 
The State of PHPUnit
The State of PHPUnitThe State of PHPUnit
The State of PHPUnitEdorian
 
How to create a 3.2 billion dollar business in 20 minutes: combining AngularJ...
How to create a 3.2 billion dollar business in 20 minutes: combining AngularJ...How to create a 3.2 billion dollar business in 20 minutes: combining AngularJ...
How to create a 3.2 billion dollar business in 20 minutes: combining AngularJ...Ari Lerner
 
What's New in PHP 5.5
What's New in PHP 5.5What's New in PHP 5.5
What's New in PHP 5.5Corey Ballou
 
Build a custom (micro)framework with ZF2 Components (as building blocks)
Build a custom (micro)framework with ZF2 Components (as building blocks)Build a custom (micro)framework with ZF2 Components (as building blocks)
Build a custom (micro)framework with ZF2 Components (as building blocks)Corley S.r.l.
 
Creating windows store java script apps
Creating windows store java script appsCreating windows store java script apps
Creating windows store java script appsEugene Zharkov
 
Go for the paranoid network programmer, 3rd edition
Go for the paranoid network programmer, 3rd editionGo for the paranoid network programmer, 3rd edition
Go for the paranoid network programmer, 3rd editionEleanor McHugh
 
Event Stream Processing with Multiple Threads
Event Stream Processing with Multiple ThreadsEvent Stream Processing with Multiple Threads
Event Stream Processing with Multiple ThreadsSylvain Hallé
 
Exploit Development: EzServer Buffer Overflow oleh Tom Gregory
Exploit Development: EzServer Buffer Overflow oleh Tom GregoryExploit Development: EzServer Buffer Overflow oleh Tom Gregory
Exploit Development: EzServer Buffer Overflow oleh Tom Gregoryzakiakhmad
 
[EN] Ada Lovelace Day 2014 - Tampon run
[EN] Ada Lovelace Day 2014  - Tampon run[EN] Ada Lovelace Day 2014  - Tampon run
[EN] Ada Lovelace Day 2014 - Tampon runMaja Kraljič
 
Remote Notifications
Remote NotificationsRemote Notifications
Remote NotificationsJosef Cacek
 
The Ring programming language version 1.5.3 book - Part 46 of 184
The Ring programming language version 1.5.3 book - Part 46 of 184The Ring programming language version 1.5.3 book - Part 46 of 184
The Ring programming language version 1.5.3 book - Part 46 of 184Mahmoud Samir Fayed
 
20191116 custom operators in swift
20191116 custom operators in swift20191116 custom operators in swift
20191116 custom operators in swiftChiwon Song
 
API Development and Scala @ SoundCloud
API Development and Scala @ SoundCloudAPI Development and Scala @ SoundCloud
API Development and Scala @ SoundCloudBora Tunca
 
Functional pe(a)rls: Huey's zipper
Functional pe(a)rls: Huey's zipperFunctional pe(a)rls: Huey's zipper
Functional pe(a)rls: Huey's zipperosfameron
 

Mais procurados (19)

The State of PHPUnit
The State of PHPUnitThe State of PHPUnit
The State of PHPUnit
 
CyberLink LabelPrint 2.5 Exploitation Process
CyberLink LabelPrint 2.5 Exploitation ProcessCyberLink LabelPrint 2.5 Exploitation Process
CyberLink LabelPrint 2.5 Exploitation Process
 
The State of PHPUnit
The State of PHPUnitThe State of PHPUnit
The State of PHPUnit
 
How to create a 3.2 billion dollar business in 20 minutes: combining AngularJ...
How to create a 3.2 billion dollar business in 20 minutes: combining AngularJ...How to create a 3.2 billion dollar business in 20 minutes: combining AngularJ...
How to create a 3.2 billion dollar business in 20 minutes: combining AngularJ...
 
What's New in PHP 5.5
What's New in PHP 5.5What's New in PHP 5.5
What's New in PHP 5.5
 
Build a custom (micro)framework with ZF2 Components (as building blocks)
Build a custom (micro)framework with ZF2 Components (as building blocks)Build a custom (micro)framework with ZF2 Components (as building blocks)
Build a custom (micro)framework with ZF2 Components (as building blocks)
 
Creating windows store java script apps
Creating windows store java script appsCreating windows store java script apps
Creating windows store java script apps
 
Go for the paranoid network programmer, 3rd edition
Go for the paranoid network programmer, 3rd editionGo for the paranoid network programmer, 3rd edition
Go for the paranoid network programmer, 3rd edition
 
Event Stream Processing with Multiple Threads
Event Stream Processing with Multiple ThreadsEvent Stream Processing with Multiple Threads
Event Stream Processing with Multiple Threads
 
Exploit Development: EzServer Buffer Overflow oleh Tom Gregory
Exploit Development: EzServer Buffer Overflow oleh Tom GregoryExploit Development: EzServer Buffer Overflow oleh Tom Gregory
Exploit Development: EzServer Buffer Overflow oleh Tom Gregory
 
[EN] Ada Lovelace Day 2014 - Tampon run
[EN] Ada Lovelace Day 2014  - Tampon run[EN] Ada Lovelace Day 2014  - Tampon run
[EN] Ada Lovelace Day 2014 - Tampon run
 
Remote Notifications
Remote NotificationsRemote Notifications
Remote Notifications
 
Diving deep into twig
Diving deep into twigDiving deep into twig
Diving deep into twig
 
Scala, just a better java?
Scala, just a better java?Scala, just a better java?
Scala, just a better java?
 
The Ring programming language version 1.5.3 book - Part 46 of 184
The Ring programming language version 1.5.3 book - Part 46 of 184The Ring programming language version 1.5.3 book - Part 46 of 184
The Ring programming language version 1.5.3 book - Part 46 of 184
 
20191116 custom operators in swift
20191116 custom operators in swift20191116 custom operators in swift
20191116 custom operators in swift
 
Javascript: The Important Bits
Javascript: The Important BitsJavascript: The Important Bits
Javascript: The Important Bits
 
API Development and Scala @ SoundCloud
API Development and Scala @ SoundCloudAPI Development and Scala @ SoundCloud
API Development and Scala @ SoundCloud
 
Functional pe(a)rls: Huey's zipper
Functional pe(a)rls: Huey's zipperFunctional pe(a)rls: Huey's zipper
Functional pe(a)rls: Huey's zipper
 

Semelhante a Ff to-fp

Java 8 - project lambda
Java 8 - project lambdaJava 8 - project lambda
Java 8 - project lambdaIvar Østhus
 
A Backbone.js Tutorial for the Impatient - Part 1
A Backbone.js Tutorial for the Impatient - Part 1A Backbone.js Tutorial for the Impatient - Part 1
A Backbone.js Tutorial for the Impatient - Part 1jsalonen Salonen
 
2013-02-21 - .NET UG Rhein-Neckar: JavaScript Best Practices
2013-02-21 - .NET UG Rhein-Neckar: JavaScript Best Practices2013-02-21 - .NET UG Rhein-Neckar: JavaScript Best Practices
2013-02-21 - .NET UG Rhein-Neckar: JavaScript Best PracticesJohannes Hoppe
 
Scala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar ProkopecScala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar ProkopecLoïc Descotte
 
Nginx Scripting - Extending Nginx Functionalities with Lua
Nginx Scripting - Extending Nginx Functionalities with LuaNginx Scripting - Extending Nginx Functionalities with Lua
Nginx Scripting - Extending Nginx Functionalities with LuaTony Fabeen
 
Devinsampa nginx-scripting
Devinsampa nginx-scriptingDevinsampa nginx-scripting
Devinsampa nginx-scriptingTony Fabeen
 
Learn Frontend Testing
Learn Frontend TestingLearn Frontend Testing
Learn Frontend TestingRyan Roemer
 
Presenting Seq for Node.js
Presenting Seq for Node.jsPresenting Seq for Node.js
Presenting Seq for Node.jsDouglas Muth
 
Beginner workshop to angularjs presentation at Google
Beginner workshop to angularjs presentation at GoogleBeginner workshop to angularjs presentation at Google
Beginner workshop to angularjs presentation at GoogleAri Lerner
 
Introduction To Lisp
Introduction To LispIntroduction To Lisp
Introduction To Lispkyleburton
 
Operation Flow @ ChicagoRoboto
Operation Flow @ ChicagoRobotoOperation Flow @ ChicagoRoboto
Operation Flow @ ChicagoRobotoSeyed Jafari
 
From Javascript To Haskell
From Javascript To HaskellFrom Javascript To Haskell
From Javascript To Haskellujihisa
 
Making the most of 2.2
Making the most of 2.2Making the most of 2.2
Making the most of 2.2markstory
 
Load-time Hacking using LD_PRELOAD
Load-time Hacking using LD_PRELOADLoad-time Hacking using LD_PRELOAD
Load-time Hacking using LD_PRELOADDharmalingam Ganesan
 
nescala 2013
nescala 2013nescala 2013
nescala 2013Hung Lin
 
Python quickstart for programmers: Python Kung Fu
Python quickstart for programmers: Python Kung FuPython quickstart for programmers: Python Kung Fu
Python quickstart for programmers: Python Kung Fuclimatewarrior
 

Semelhante a Ff to-fp (20)

Java 8 - project lambda
Java 8 - project lambdaJava 8 - project lambda
Java 8 - project lambda
 
A Backbone.js Tutorial for the Impatient - Part 1
A Backbone.js Tutorial for the Impatient - Part 1A Backbone.js Tutorial for the Impatient - Part 1
A Backbone.js Tutorial for the Impatient - Part 1
 
2013-02-21 - .NET UG Rhein-Neckar: JavaScript Best Practices
2013-02-21 - .NET UG Rhein-Neckar: JavaScript Best Practices2013-02-21 - .NET UG Rhein-Neckar: JavaScript Best Practices
2013-02-21 - .NET UG Rhein-Neckar: JavaScript Best Practices
 
Hazelcast - In-Memory DataGrid
Hazelcast - In-Memory DataGridHazelcast - In-Memory DataGrid
Hazelcast - In-Memory DataGrid
 
Scala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar ProkopecScala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar Prokopec
 
Nginx Scripting - Extending Nginx Functionalities with Lua
Nginx Scripting - Extending Nginx Functionalities with LuaNginx Scripting - Extending Nginx Functionalities with Lua
Nginx Scripting - Extending Nginx Functionalities with Lua
 
Devinsampa nginx-scripting
Devinsampa nginx-scriptingDevinsampa nginx-scripting
Devinsampa nginx-scripting
 
Learn Frontend Testing
Learn Frontend TestingLearn Frontend Testing
Learn Frontend Testing
 
Presenting Seq for Node.js
Presenting Seq for Node.jsPresenting Seq for Node.js
Presenting Seq for Node.js
 
Music as data
Music as dataMusic as data
Music as data
 
Beginner workshop to angularjs presentation at Google
Beginner workshop to angularjs presentation at GoogleBeginner workshop to angularjs presentation at Google
Beginner workshop to angularjs presentation at Google
 
Introduction To Lisp
Introduction To LispIntroduction To Lisp
Introduction To Lisp
 
Operation Flow @ ChicagoRoboto
Operation Flow @ ChicagoRobotoOperation Flow @ ChicagoRoboto
Operation Flow @ ChicagoRoboto
 
From Javascript To Haskell
From Javascript To HaskellFrom Javascript To Haskell
From Javascript To Haskell
 
Making the most of 2.2
Making the most of 2.2Making the most of 2.2
Making the most of 2.2
 
Load-time Hacking using LD_PRELOAD
Load-time Hacking using LD_PRELOADLoad-time Hacking using LD_PRELOAD
Load-time Hacking using LD_PRELOAD
 
nescala 2013
nescala 2013nescala 2013
nescala 2013
 
XS Fun
XS FunXS Fun
XS Fun
 
Python quickstart for programmers: Python Kung Fu
Python quickstart for programmers: Python Kung FuPython quickstart for programmers: Python Kung Fu
Python quickstart for programmers: Python Kung Fu
 
FP Using ES6+ (Cheat Sheet)
FP Using ES6+ (Cheat Sheet)FP Using ES6+ (Cheat Sheet)
FP Using ES6+ (Cheat Sheet)
 

Mais de Andy Petrella

Data Observability Best Pracices
Data Observability Best PracicesData Observability Best Pracices
Data Observability Best PracicesAndy Petrella
 
How to Build a Global Data Mapping
How to Build a Global Data MappingHow to Build a Global Data Mapping
How to Build a Global Data MappingAndy Petrella
 
Interactive notebooks
Interactive notebooksInteractive notebooks
Interactive notebooksAndy Petrella
 
Governance compliance
Governance   complianceGovernance   compliance
Governance complianceAndy Petrella
 
Data science governance and GDPR
Data science governance and GDPRData science governance and GDPR
Data science governance and GDPRAndy Petrella
 
Data science governance : what and how
Data science governance : what and howData science governance : what and how
Data science governance : what and howAndy Petrella
 
Scala: the unpredicted lingua franca for data science
Scala: the unpredicted lingua franca  for data scienceScala: the unpredicted lingua franca  for data science
Scala: the unpredicted lingua franca for data scienceAndy Petrella
 
Agile data science with scala
Agile data science with scalaAgile data science with scala
Agile data science with scalaAndy Petrella
 
Agile data science: Distributed, Interactive, Integrated, Semantic, Micro Ser...
Agile data science: Distributed, Interactive, Integrated, Semantic, Micro Ser...Agile data science: Distributed, Interactive, Integrated, Semantic, Micro Ser...
Agile data science: Distributed, Interactive, Integrated, Semantic, Micro Ser...Andy Petrella
 
What is a distributed data science pipeline. how with apache spark and friends.
What is a distributed data science pipeline. how with apache spark and friends.What is a distributed data science pipeline. how with apache spark and friends.
What is a distributed data science pipeline. how with apache spark and friends.Andy Petrella
 
Towards a rebirth of data science (by Data Fellas)
Towards a rebirth of data science (by Data Fellas)Towards a rebirth of data science (by Data Fellas)
Towards a rebirth of data science (by Data Fellas)Andy Petrella
 
Distributed machine learning 101 using apache spark from a browser devoxx.b...
Distributed machine learning 101 using apache spark from a browser   devoxx.b...Distributed machine learning 101 using apache spark from a browser   devoxx.b...
Distributed machine learning 101 using apache spark from a browser devoxx.b...Andy Petrella
 
Spark Summit Europe: Share and analyse genomic data at scale
Spark Summit Europe: Share and analyse genomic data at scaleSpark Summit Europe: Share and analyse genomic data at scale
Spark Summit Europe: Share and analyse genomic data at scaleAndy Petrella
 
Leveraging mesos as the ultimate distributed data science platform
Leveraging mesos as the ultimate distributed data science platformLeveraging mesos as the ultimate distributed data science platform
Leveraging mesos as the ultimate distributed data science platformAndy Petrella
 
Data Enthusiasts London: Scalable and Interoperable data services. Applied to...
Data Enthusiasts London: Scalable and Interoperable data services. Applied to...Data Enthusiasts London: Scalable and Interoperable data services. Applied to...
Data Enthusiasts London: Scalable and Interoperable data services. Applied to...Andy Petrella
 
Spark meetup london share and analyse genomic data at scale with spark, adam...
Spark meetup london  share and analyse genomic data at scale with spark, adam...Spark meetup london  share and analyse genomic data at scale with spark, adam...
Spark meetup london share and analyse genomic data at scale with spark, adam...Andy Petrella
 
Distributed machine learning 101 using apache spark from the browser
Distributed machine learning 101 using apache spark from the browserDistributed machine learning 101 using apache spark from the browser
Distributed machine learning 101 using apache spark from the browserAndy Petrella
 
Liège créative: Open Science
Liège créative: Open ScienceLiège créative: Open Science
Liège créative: Open ScienceAndy Petrella
 
BioBankCloud: Machine Learning on Genomics + GA4GH @ Med at Scale
BioBankCloud: Machine Learning on Genomics + GA4GH  @ Med at ScaleBioBankCloud: Machine Learning on Genomics + GA4GH  @ Med at Scale
BioBankCloud: Machine Learning on Genomics + GA4GH @ Med at ScaleAndy Petrella
 
What is Distributed Computing, Why we use Apache Spark
What is Distributed Computing, Why we use Apache SparkWhat is Distributed Computing, Why we use Apache Spark
What is Distributed Computing, Why we use Apache SparkAndy Petrella
 

Mais de Andy Petrella (20)

Data Observability Best Pracices
Data Observability Best PracicesData Observability Best Pracices
Data Observability Best Pracices
 
How to Build a Global Data Mapping
How to Build a Global Data MappingHow to Build a Global Data Mapping
How to Build a Global Data Mapping
 
Interactive notebooks
Interactive notebooksInteractive notebooks
Interactive notebooks
 
Governance compliance
Governance   complianceGovernance   compliance
Governance compliance
 
Data science governance and GDPR
Data science governance and GDPRData science governance and GDPR
Data science governance and GDPR
 
Data science governance : what and how
Data science governance : what and howData science governance : what and how
Data science governance : what and how
 
Scala: the unpredicted lingua franca for data science
Scala: the unpredicted lingua franca  for data scienceScala: the unpredicted lingua franca  for data science
Scala: the unpredicted lingua franca for data science
 
Agile data science with scala
Agile data science with scalaAgile data science with scala
Agile data science with scala
 
Agile data science: Distributed, Interactive, Integrated, Semantic, Micro Ser...
Agile data science: Distributed, Interactive, Integrated, Semantic, Micro Ser...Agile data science: Distributed, Interactive, Integrated, Semantic, Micro Ser...
Agile data science: Distributed, Interactive, Integrated, Semantic, Micro Ser...
 
What is a distributed data science pipeline. how with apache spark and friends.
What is a distributed data science pipeline. how with apache spark and friends.What is a distributed data science pipeline. how with apache spark and friends.
What is a distributed data science pipeline. how with apache spark and friends.
 
Towards a rebirth of data science (by Data Fellas)
Towards a rebirth of data science (by Data Fellas)Towards a rebirth of data science (by Data Fellas)
Towards a rebirth of data science (by Data Fellas)
 
Distributed machine learning 101 using apache spark from a browser devoxx.b...
Distributed machine learning 101 using apache spark from a browser   devoxx.b...Distributed machine learning 101 using apache spark from a browser   devoxx.b...
Distributed machine learning 101 using apache spark from a browser devoxx.b...
 
Spark Summit Europe: Share and analyse genomic data at scale
Spark Summit Europe: Share and analyse genomic data at scaleSpark Summit Europe: Share and analyse genomic data at scale
Spark Summit Europe: Share and analyse genomic data at scale
 
Leveraging mesos as the ultimate distributed data science platform
Leveraging mesos as the ultimate distributed data science platformLeveraging mesos as the ultimate distributed data science platform
Leveraging mesos as the ultimate distributed data science platform
 
Data Enthusiasts London: Scalable and Interoperable data services. Applied to...
Data Enthusiasts London: Scalable and Interoperable data services. Applied to...Data Enthusiasts London: Scalable and Interoperable data services. Applied to...
Data Enthusiasts London: Scalable and Interoperable data services. Applied to...
 
Spark meetup london share and analyse genomic data at scale with spark, adam...
Spark meetup london  share and analyse genomic data at scale with spark, adam...Spark meetup london  share and analyse genomic data at scale with spark, adam...
Spark meetup london share and analyse genomic data at scale with spark, adam...
 
Distributed machine learning 101 using apache spark from the browser
Distributed machine learning 101 using apache spark from the browserDistributed machine learning 101 using apache spark from the browser
Distributed machine learning 101 using apache spark from the browser
 
Liège créative: Open Science
Liège créative: Open ScienceLiège créative: Open Science
Liège créative: Open Science
 
BioBankCloud: Machine Learning on Genomics + GA4GH @ Med at Scale
BioBankCloud: Machine Learning on Genomics + GA4GH  @ Med at ScaleBioBankCloud: Machine Learning on Genomics + GA4GH  @ Med at Scale
BioBankCloud: Machine Learning on Genomics + GA4GH @ Med at Scale
 
What is Distributed Computing, Why we use Apache Spark
What is Distributed Computing, Why we use Apache SparkWhat is Distributed Computing, Why we use Apache Spark
What is Distributed Computing, Why we use Apache Spark
 

Último

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 2024The Digital Insurer
 
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 slidevu2urc
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
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 RobisonAnna Loughnan Colquhoun
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
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 2024The Digital Insurer
 
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 productivityPrincipled Technologies
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
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 2024The Digital Insurer
 
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...Martijn de Jong
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 

Último (20)

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
 
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
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
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
 
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
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
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
 
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...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 

Ff to-fp

  • 1. FF TO FP Starring SCALA AKKA 2 PLAY! FRAMEWORK 2
  • 2. FP USING SCALA What is FP? Scala =?= FP In action...
  • 3. WHAT IS FP? FUNCTION == FIRST CLASS CITIZEN
  • 4. WHAT IS A FUNCTION? x eix + e-ix div(x, y) = cos(x) = y 2 Takes same Inputs. Produces same Outputs. No State change (Immutability). No Exceptions Define behavior not tasks! Enables true composability. No Side-Effects == Referential Transparency
  • 5. WHAT IS A FIRST CLASS CITIZEN? A function is a tool like a structure or a primitive might be. They encourage reuse and sharing. Thanks to their composability. The simplest composition being the classical f o g . But there are plenty of others... of course.
  • 6. SCALA =?= FP Yes but mmmh... > OO kept! > Best of both worlds > Imperative permitted
  • 7. IMMUTABILITY cs casUe( ae ls sr frtaeSrn, isNm:tig lsNm:tig ataeSrn, aeIt g:n ) vlnota =Ue(ad" "erla,3) a oosb sr"ny, ptel" 1 nota.isNm ="oh / BN ! oosbfrtae na" / AG vlna =nota.oyfrtae="oh,ae=2 a oh oosbcp(isNm Na" g )
  • 8. NO EXCEPTIONS: OPTION tatUi { ri tl dfpren(:tig:It e asItsSrn) n } vliIt=Ui.asIt"" / Wa d yuepc? a :n tlpren(a) / ht o o xet tatUi { ri tl dfpren(:tig:Oto[n] e asItsSrn) pinIt } vliOto[n]=Ui.asIt"" / = Nn =>BtWY a :pinIt tlpren(a) / = oe = u H? vloe a n =Ui.asIt"" / = Sm() ..Hywe tlpren(1) / = oe1 . e h r' tetp? es h ye
  • 9. EXCEPTIONS. BUT... tatUi { ri tl dfpren(:tig:Ete[xeto,It e asItsSrn) ihrEcpin n] } vli a =Ui.asIt"" /Lf(ubromtxeto(..) tlpren(a) /etNmeFraEcpin"." ) vloe =Ui.asIt"" /Rgh1 a n tlpren(1) /it()
  • 10. USE THE VALUES: MAPPER vlaep:pinIt =Ui.asItrqetgt"g") a gOtOto[n] tlpren(eus.e(ae) vlueOt=aep.a((g:n)= Ue(sm" "n" ae ) a srp gOtmp aeIt > sr"oe, Oe, g) /mpueteebdvle. ltssewt Ls /a s h me au.. e' e ih it vlnosa =Ue(ad" "erla,3) a ootb sr"ny, ptel" 1 vlna a oh =Ue(na" "erla,2 sr"oh, ptel" ) vluesLs[sr =Ls(ootb na) a sr:itUe] itnosa, oh vlae:itIt a gsLs[n] =uesmp (:sr = uae) sr.a( uUe) > .g vlaeSmlr a gsipe =uesmp u= uae) sr.a( > .g vlaeEeSml a gsvnipe =uesmp_ae sr.a(.g)
  • 11. COMPOSABILITY: FLATMAPPER tatRqet{ ri eus dfgtkySrn)Oto[tig e e(e:tig:pinSrn] } vlaeau:pinSrn] a gVleOto[tig =rqetgt"g" eus.e(ae) vlaep:pinIt a gOtOto[n] =Ui.asItaeau) tlpren(gVle / BN ! / AG vlaepOtOto[pinIt]=aeau.a(tlpren() a gOtp:pinOto[n] gVlempUi.asIt_ ) / BN !! / AG ! vlaeOto[n] a g:pinIt =aeau.lta(tlpren gVlefaMpUi.asI t_) () /Go,ddû /od ij
  • 12. ADD CONTROL: FILTER vlaeau:pinSrn] =rqetgt"g" a gVleOto[tig eus.e(ae) vlaep:pinIt a gOtOto[n] =aeau.lta(tlpren() gVlefaMpUi.asIt_) vlalwd =aep.itr_> 1) a loe gOtfle( = 8 vlna a oh =alwdmpUe(na" "erla,_)/Nn loe.a(sr"oh, ptel" ) /oe vlnota =alwdmpUe(ad" "erla,_)/Sm a oosb loe.a(sr"ny, ptel" ) /oe
  • 13. PUTTING THE PIECES TOGETHER dfgtloeUe(eus:eus)Oto[sr ={ e eAlwdsrrqetRqet:pinUe] vlfrtaep:pinSrn]=rqetgt"isNm" a isNmOtOto[tig eus.e(frtae) vllsNmOtOto[tig =rqetgt"atae) a ataep:pinSrn] eus.e(lsNm" vlaep:pinIt a gOtOto[n] =rqetgt"g".lta(t eus.e(ae)faMpU i.asIt_) lpren() vlalwdgOtOto[n] =aep.itr_> 1) a loeAep:pinIt gOtfle( = 8 frtaep.lta {frtae= isNmOtfaMp isNm > lsNmOtfaMp{lsNm = ataep.lta atae > alwdgOtmp{alwdg = loeAep.a loeAe > Ue(isNm,lsNm,alwdg) srfrtae atae loeAe } } } }
  • 14. FOR COMPREHENSION dfgtsrcekg:n=Boen(eus:eus)= e eUe(hcAeIt>ola)rqetRqet fr{ o frtae< rqetgt"isNm" isNm - eus.e(frtae) lsNm < rqetgt"atae) atae - eus.e(lsNm" aetig< rqetgt"g" gSrn - eus.e(ae) ae g < Ui.asItaetig i cekg(g) - tlpren(gSrn) f hcAeae }yedUe(isNm,lsNm,ae il srfrtae atae g) tp Rqet=MpSrn,Srn] ye eus a[tig tig vlalwdoDr :It= Boen a loeFroa n > ola =(:n)> 2 _It = vlgtloeUe :Rqet= Oto[sr a eAlwdsr eus > pinUe] =gtsralwd eUe(loeF oDr)_ roa vlna a oh =gtloeUe( eAlwdsr Mp a( "isNm">na" frtae-"oh, "atae-"erla, lsNm">ptel" "g">2 ae-"" ) )
  • 15.
  • 17. DISTRIBUTED ET AL. W/ AKKA Messages Actors Mailbox Fault-Tolerant
  • 18. MESSAGES Sharing resource Synchronous Message Passing Style to the rescue Don't call, but send asynchronously Immutable
  • 19. ACTORS Worker/Sender React to message, Create message Hold a state Mutable
  • 20. MAILBOX Queue of messages Invoke dedicated actor when computing unit available
  • 21. FAULT TOLERANT Actors hidden by reference Actors created hierarchically Onion layers of supervision => restart, stop, bubble, ...
  • 22. CODE IN PEACE Back to the wild
  • 23. PLAY! WITH THE WEB Reactive and non-blocking Asynchronous with no pain Scala & Java End-to-end integration
  • 24. REACTIVE AND NON-BLOCKING Using JBoss Netty React to content using Iteratees
  • 25. ASYNCHRONOUS WITH NO PAIN Using Promise and Future... ... easily using Continuation
  • 26. SCALA & JAVA Scala for the core and API Java API available
  • 27. END-TO-END INTEGRATION From the database to the web client Reduce runtime time exceptions... ... Increase compile time errors
  • 29. THANKS! (FOR NOT LEAVING) chipchip: @noootsab G+: andy.petrella social coding: github / andypetrella FB: RIP Blog (TBC): http://ska-la.blogspot.be Company: NextLab Come Back! @WAJUG