Upgrade to Pro — share decks privately, control downloads, hide ads and more …

FP and entrepreneurship

FP and entrepreneurship

Given by Xavier Tordoir and my self for the students of University of Liège.
This slide is a poor export of this one: http://slides.com/xa_ndy/fp-and-entrepreneurship

Andy Petrella

May 08, 2014
Tweet

More Decks by Andy Petrella

Other Decks in Technology

Transcript

  1. Find your ways Pick some and dig Mémoire: polishing phase

    STUDYING =:= FUTURE[OPTION[JOB]] Grab the basis
  2. 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
  3. 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
  4. 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
  5. MORE AND MORE DATA Why do we collect data? We

    always miss some at some point something of value is encoded collaborative consiousness
  6. MOBILE? REALLY? Providing content = aggregate distributed sources BUT in

    small quantity (network is the bottleneck) Yes data is available from anywhere
  7. 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...
  8. 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
  9. 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
  10. FP IN THE INDUSTRY? Examples of popular languages with OO

    and FP javascript ruby Java 8 scala
  11. 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) { // ... }
  12. 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"))) } }
  13. 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) }
  14. 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()