Slide 1

Slide 1 text

THE IMPROBABLE STORY OF: FP AND ENTREPRENEURSHIP

Slide 2

Slide 2 text

WHO ARE WE?

Slide 3

Slide 3 text

XAVIER TORDOIR

Slide 4

Slide 4 text

ANDY PETRELLA

Slide 5

Slide 5 text

Find your ways Pick some and dig Mémoire: polishing phase STUDYING =:= FUTURE[OPTION[JOB]] Grab the basis

Slide 6

Slide 6 text

JOB =:= (WORK => OPTION[EXPERIENCE]) => OPTION[MONEY] Working will probably raise your experience Based on this experience, you might get some money Experience might not be enough It will depend on the kind of experience

Slide 7

Slide 7 text

IT'S NOT THAT EASY Proposal: Job =:= ( (Work, Explore, Learn) => Option[ Expertize ]) => Option[(Money, () => Future[Option[Job]] )] Still some work *sight* But never stop learning, nor exploring Expertize is like experience, yet rarer Money, the unfortunate obligation Create your secret sauce, a lazy call to Job

Slide 8

Slide 8 text

WORKING IN IT Everything is distributed Clues for answers are in data Answer questions

Slide 9

Slide 9 text

MORE AND MORE DATA Industrial data energy grid production lines finance transport ...

Slide 10

Slide 10 text

MORE AND MORE DATA People data web 1.0 : few control content web 2.0 : lots of end-users manual feed web x.y : lots of captors per user

Slide 11

Slide 11 text

MORE AND MORE DATA Why do we collect data? We always miss some at some point something of value is encoded collaborative consiousness

Slide 12

Slide 12 text

MOBILE? REALLY? Providing content = aggregate distributed sources BUT in small quantity (network is the bottleneck) Yes data is available from anywhere

Slide 13

Slide 13 text

IT IS A COMMODITY ...even development Everything done is distributed Software (SaaS): user management, social login product support online billing/payment access to data sources Infrastructure (IaaS): storage, servers...

Slide 14

Slide 14 text

A TECH STARTUP Managing distributed resources is key! Gathers distributed datasources Calls distributed services collects raw data does some aggregation Must be able to scale resources and costs

Slide 15

Slide 15 text

FP? Failure management Asynchronous calls FP describe the result you want, not how you get it Threads, cores, servers, datacenters If FP gets a global adoption it will be because it solves issues related to the distributed environment. Complexity of distribution

Slide 16

Slide 16 text

FP IN THE INDUSTRY? Examples of popular languages with OO and FP javascript ruby Java 8 scala

Slide 17

Slide 17 text

AWAIT[_]

Slide 18

Slide 18 text

EVAL[EXPRESSION] SCALA val getQueryParameter[T] = (request:Request) => (name:String) => request.query.parameters.get(name).as[T] abstract class Request[T](val body:Body[T]) extends Query with Header { def parser:BodyParser[T] val content:Option[T] = parser(body) def send(to:Service) = ??? } case class HttpRequest[T]( method:Method, body:Body)(implicit parser:BodyParser[T]) extends Request(body) { // ... }

Slide 19

Slide 19 text

PLAY! FRAMEWORK 2 Async HTTP Event driven/Concurrency using Actor Non-blocking IO (reactive: Iteratee/ CPS) Stateless object Dummy extends Controller { // return async'ly the # of users w/ name start'g w/ q"char" def countAs = Action.async { request => val char = request.queryString("char") val all:Future[Seq[User]] = users.all // or WS.url Ok(all.map(_.count(_.name startsWith "a"))) } }

Slide 20

Slide 20 text

AKKA Message passing style Messages are immutable Actors are mutable (stateful) Thread safety by confinement Location transparency class UserRepo extends Actor { var users = Set.empty def receive = { case Add(user:User) => users = users + user case All => sender ! users case Get(id:String) => user = users.find(_.id == id) sender ! user } } object AkkaApp extends App { //... val repo = system.actorOf(Props[UserRepo]) // add repo ! Add(User(1L, "") //get val user = repo ? Get(1L) }

Slide 21

Slide 21 text

SPARK Tends to resolve Big Data solution flaws Provides an abstraction on distributed data Using an extended functional style (not only MR) Represents a distributed computation as a Graph In-Memory! val sc = new SparkContext(/*...*/) lines = sc.textFile("hdfs://...") errors = lines.filter(_.startsWith("ERROR")) errors.filter(_.contains("HDFS")) .map(_.split('\t')(3)) .collect()