Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind

Editor's Notes

  • #2 Intro, gaan het hebben over Scala Wellicht al eens gehoord over FP, lijkt groeiende interesse wat is imperatief? Ook wel procedureel, met state, het is wat we in Java eigenlijk doen.
  • #3 Intro, gaan het hebben over Scala Wellicht al eens gehoord over FP, lijkt groeiende interesse wat is imperatief? Ook wel procedureel, met state, het is wat we in Java eigenlijk doen.
  • #4 Intro, gaan het hebben over Scala Wellicht al eens gehoord over FP, lijkt groeiende interesse wat is imperatief? Ook wel procedureel, met state, het is wat we in Java eigenlijk doen.
  • #6 Odersky: co-designer generics, original author javac. Wellicht had hier oracle logo moeten staan :)
  • #7 *Voordelen JVM (enorm veel tijd in optimalisatie, platform agnostisch etc.), ook wat nadelen (niet echt ingericht op FP constructies). * OO, maar dan ook puur, en met extra functionaliteit * Scripting: REPL shell
  • #8 Scala redelijk uniek in samenvoegen OO+FP OCaml en F# zijn toch meer FP met een OO systeem er aan geplakt.
  • #10 Recursie niet alleen in functies, ook in data (bomen, lijsten)
  • #11 Recursie niet alleen in functies, ook in data (bomen, lijsten)
  • #12 Recursie niet alleen in functies, ook in data (bomen, lijsten)
  • #13 Recursie niet alleen in functies, ook in data (bomen, lijsten)
  • #14 Recursie niet alleen in functies, ook in data (bomen, lijsten)
  • #15 Recursie niet alleen in functies, ook in data (bomen, lijsten)
  • #16 Recursie niet alleen in functies, ook in data (bomen, lijsten)
  • #17 Recursie niet alleen in functies, ook in data (bomen, lijsten)
  • #18 Recursie niet alleen in functies, ook in data (bomen, lijsten)
  • #19 Recursie niet alleen in functies, ook in data (bomen, lijsten)
  • #20 Recursie niet alleen in functies, ook in data (bomen, lijsten)
  • #21 Nieuwe paradigma’s hebben killer-app nodig OO had GUIs, bij FP concurrency? Typesysteem: niet noodzakelijk voor FP, traditioneel wel focus
  • #22 Zonder diep in te gaan, voor we features gaan bekijken, dit is hoe Scala FP bevat.
  • #24 *default modifier is public *Type after identifier, type Unit == void *zowel Scala->Java als Java->Scala interop. Dus, elkaars classes instantieren overerven etc. *Abstract class ipv interfaces
  • #25 Extenden van Java class (extends ook voor interfaces) Type Unit -> void in Java hashCode -> hashCode() , haakjes weglaten. Soort van autoboxing, maar beter
  • #26 * + is methode naam, kan je zelf op een class implementeren * Leestekens legale identifiers in Scala * Operator notatie ook te gebruiken met ‘normale’ methode namen * In Java discussie: operator overloadig BigInts (en wat voor matrix etc.)? Scala: just do it.
  • #27 * + is methode naam, kan je zelf op een class implementeren * Leestekens legale identifiers in Scala * Operator notatie ook te gebruiken met ‘normale’ methode namen * In Java discussie: operator overloadig BigInts (en wat voor matrix etc.)? Scala: just do it.
  • #28 * + is methode naam, kan je zelf op een class implementeren * Leestekens legale identifiers in Scala * Operator notatie ook te gebruiken met ‘normale’ methode namen * In Java discussie: operator overloadig BigInts (en wat voor matrix etc.)? Scala: just do it.
  • #29 * + is methode naam, kan je zelf op een class implementeren * Leestekens legale identifiers in Scala * Operator notatie ook te gebruiken met ‘normale’ methode namen * In Java discussie: operator overloadig BigInts (en wat voor matrix etc.)? Scala: just do it.
  • #30 * + is methode naam, kan je zelf op een class implementeren * Leestekens legale identifiers in Scala * Operator notatie ook te gebruiken met ‘normale’ methode namen * In Java discussie: operator overloadig BigInts (en wat voor matrix etc.)? Scala: just do it.
  • #31 *Java statics niet echt OO. Scala: Classes->te instantieren, singleton objects->één instantie *Zelfde naam: companions -> toegang tot private members *haakjes mogen weg bij methode aanroep zonder params; puntkomma’s ook optioneel! *main methode op object Main, entrypoint applicatie
  • #32 * Vorige slide goed opgelet: geen return type!
  • #40 * Zijn natuurlijk allemaal op ISKA over closures geweest, maar toch een opfrisser * Java heeft Anon. classes -> beperkingen, verbose (interface nodig), daarom weinig gebruikt
  • #41 * Zijn natuurlijk allemaal op ISKA over closures geweest, maar toch een opfrisser * Java heeft Anon. classes -> beperkingen, verbose (interface nodig), daarom weinig gebruikt
  • #42 * Zijn natuurlijk allemaal op ISKA over closures geweest, maar toch een opfrisser * Java heeft Anon. classes -> beperkingen, verbose (interface nodig), daarom weinig gebruikt
  • #43 * Zijn natuurlijk allemaal op ISKA over closures geweest, maar toch een opfrisser * Java heeft Anon. classes -> beperkingen, verbose (interface nodig), daarom weinig gebruikt
  • #44 * Function0 tot Function22 op deze manier beschikbaar
  • #45 * Function0 tot Function22 op deze manier beschikbaar
  • #46 * Function0 tot Function22 op deze manier beschikbaar
  • #47 * Function0 tot Function22 op deze manier beschikbaar
  • #48 * Function0 tot Function22 op deze manier beschikbaar
  • #49 * Function0 tot Function22 op deze manier beschikbaar
  • #50 * Function0 tot Function22 op deze manier beschikbaar
  • #51  Scala gaat nog verder, zelf control structures maken (by-name params)
  • #52 * First trait/class with extends, then 0 or more times with * Traits can have any member: defs, abstract defs, fields traits can extend from each other
  • #53 * Traits are used in this fashion a lot for the Scala collection libs
  • #54 * abstract override: target of super not known at design-time! * calls resolve right-to-left * selftype annotation: type of this can assume type of class where trait is mixed in!
  • #55 * abstract override: target of super not known at design-time! * calls resolve right-to-left * selftype annotation: type of this can assume type of class where trait is mixed in!
  • #56 * abstract override: target of super not known at design-time! * calls resolve right-to-left * selftype annotation: type of this can assume type of class where trait is mixed in!
  • #57 * geen new keyword nodig: case class is class + companion object met apply method! * Sealed abstract class: compiler kan checken of alle cases gedekt zijn
  • #58 * geen new keyword nodig: case class is class + companion object met apply method! * Sealed abstract class: compiler kan checken of alle cases gedekt zijn
  • #59 * geen new keyword nodig: case class is class + companion object met apply method! * Sealed abstract class: compiler kan checken of alle cases gedekt zijn
  • #60 * Twee doelen: selecteren goede case, en binden van variabelen in 1 stap * Java kent heeeel beperkte pattern matching: catch-clauses * Geen NPE: helaas heeft Scala wel null, vanwege compatibility -> tradeoff * voorbeelden van option: Map.get, List.find, parseInt, etc.
  • #61 * Twee doelen: selecteren goede case, en binden van variabelen in 1 stap * Java kent heeeel beperkte pattern matching: catch-clauses * Geen NPE: helaas heeft Scala wel null, vanwege compatibility -> tradeoff * voorbeelden van option: Map.get, List.find, parseInt, etc.
  • #62 * match is an expression too
  • #66 * Of course case objects can be used to implement enums
  • #67 * Of course case objects can be used to implement enums
  • #68 * Of course case objects can be used to implement enums
  • #69 * Of course case objects can be used to implement enums
  • #70 * Of course case objects can be used to implement enums
  • #71 Ook test frameworks
  • #73 Proberen stukje realworld code van Java->Scala als Java programmeur->Idiomatische Scala
  • #78 * TIOBE top-30: beating Groovy, Haskell
  • #79 * TIOBE top-30: beating Groovy, Haskell
  • #82 Java -> Scala voorbeeld: een Scala - methode wordt vertaald naar $minus$. Veel conventies voor compiler gegenereerde classes.