SlideShare uma empresa Scribd logo
1 de 19
Baixar para ler offline
What it is and why it rocks,[object Object],Peter Maas,[object Object],2011-Q2,[object Object]
Goals,[object Object],You’ll learn the what & why of Scala,[object Object],You’ll learn what basic Scala programs look like,[object Object],You’ll get an insight in how deep Scala can be,[object Object]
Peter Maas,[object Object],Technical team lead at eBay Classifieds group working at Marktplaats.,[object Object],Interested in programming languages in general; every new concept you learn might help you solve problems in a smarter / cleaner way.,[object Object],Hasn’t worked on a MS Windows machine for quite a while.,[object Object],Background in Sound & Music, specialized in pattern recognition. But spend the last decade on web development.,[object Object],Might know me from: ,[object Object],Marktplaats.nl (admarkt),[object Object],VPRO (3voor12, cinema.nl, …),[object Object],Kennis- SURFnet (Video portals, Wikiwijs, Leraar24),[object Object],DBGA (Erfpacht register),[object Object],RaboBank (RaboMobiel),[object Object],Ruby, Clojure, Devnology or DuSeusergroups,[object Object],Proud dad of two beautiful kids. ,[object Object]
Scala,[object Object],ScalableLanguage,[object Object],Statically typed,[object Object],First class citizen on the JVM,[object Object],Multi paradigm: OO, FP,[object Object]
Who uses it,[object Object]
Basic features,[object Object],Immutable value:,[object Object],valname:Type = …,[object Object],Mutable value:,[object Object],varname:Type = …,[object Object],A function:,[object Object],deffunctionName(argName:argType):returnType=/* functionBody */,[object Object],Class,[object Object],classClassName(constructorArg:argType) { },[object Object],Object:,[object Object],object ObjectName { },[object Object],Tuple,[object Object],(1,2) or (1,2,"booh",4,5) /* access t._1 ,  t._3 etc. */,[object Object]
Basic control flow,[object Object],If:,[object Object],if(x < 5) doAelsedoB,[object Object],For:,[object Object],for(x <- 0 to 5) println(x),[object Object],for(x <- 0 to 5) yield(x * 2) /* returns collections containing x*2 vals */,[object Object],for(x <- 0 to 5; y <- 0 to x) yield(x * y) /* comprehensions */	,[object Object],Pattern Matching:,[object Object],something match {,[object Object],casea:Int => println(a),[object Object], case (a:Int, b:String) =>,[object Object],  case x :: xs => /* head, tail */,[object Object],	  case _ =>,[object Object],},[object Object]
(Case) Classes,[object Object],Java:,[object Object],publicclass Person {,[object Object],publicfinalString name;,[object Object],publicfinalint age;,[object Object],    Person(String name, int age) {,[object Object],this.name = name;,[object Object],this.age = age;,[object Object],    },[object Object],    // TODO: implement equals,[object Object],    // TODO: implement hashCode,[object Object],},[object Object],Scala:,[object Object],caseclass Person(valname:String, valage:Int),[object Object]
Collections :: Immutable,[object Object]
Collections :: Mutable,[object Object]
Collections :: Operations,[object Object],Traversing,[object Object],list.foreach( it => println(it) ),[object Object],list.foreach( println(_) ),[object Object],Transforming,[object Object],list.map( _ * 2),[object Object],urls.par.map(io.Source.fromURL(_).mkString("")),[object Object],Reducing / Folding,[object Object],list.reduceLeft(_+_) /* f(f(f(a,b),c),d), f = + */,[object Object],list.foldLeft(5)(_+_) /* f(f(f(f(5,a),b),c),d), f = + */,[object Object],list.foldRight(List[Int]())((i,l) => if(i%2 == 0) i :: l else l ),[object Object],Filtering,[object Object],list.filterNot(_%2 == 0),[object Object],Sorting,[object Object],list.sorted, list.sortBy(it => it.name),[object Object]
Collections :: Operations,[object Object],Grouping,[object Object],	(1 to 10).groupBy(v => v%5) /* Map[Int, Vector[Int]] */,[object Object],Zip,[object Object],List(1,2,3,4).zip(List(5,6,7,8)) /* List((1,5), (2,6), (3,7), (4,8)) */,[object Object],Much more:,[object Object],diff, distinct, exists, grouped, intersect, slice,[object Object]
More concepts,[object Object],Case classes,[object Object],Structural Typing,[object Object],Traits,[object Object],Implicit conversions,[object Object],Operators are functions,[object Object],Actors,[object Object],Laziness / Streams,[object Object]
Structural typing,[object Object],Statically typed version of duck typing,[object Object],Immutable value:,[object Object],deffeed(anyThing: { defeat(f:Food):Unit }) = { ,[object Object],anyThing.eat(myFood),[object Object],},[object Object],Keeps coupling as low as possible.,[object Object]
Actors,[object Object],Scalas’ main construct for parallelizing tasks,[object Object],Actors are concurrent processes that communicate by exchanging messages,[object Object],Akka!,[object Object]
Frameworks,[object Object],All existing Java frameworks,[object Object],Database,[object Object],Querulous,[object Object],Casbah,[object Object],Web,[object Object],Play! Scala module,[object Object],Lift,[object Object],Messaging,[object Object],Kafka,[object Object],Kestrel,[object Object]
Note on tools,[object Object],During this presentations you’ve seen SBT, VIM and Intellij Idea in action,[object Object],All major (Java) build systems include support (Maven, Ant, Grails, Buildr, SBT),[object Object],Scala IDE (Eclipse based, maintained by TypeSafe),[object Object],Scala plugin for Intellij IDEA,[object Object],Scala plugin for NetBeans,[object Object],And yes… it’s not 100% on par with tooling Java people are generally used to; but still good enough to work in a comfortable way.,[object Object]
More info,[object Object],http://scala-lang.org,[object Object],Programming in Scala 2nd edition (Odersky),[object Object],twitter.com/p3t0r,[object Object],log4p.com,[object Object]
Q&a(yes: We are hiring),[object Object],One more thing:,[object Object]

Mais conteúdo relacionado

Último

NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopBachir Benyammi
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?IES VE
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesDavid Newbury
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024SkyPlanner
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesMd Hossain Ali
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintMahmoud Rabie
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioChristian Posta
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding TeamAdam Moalla
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URLRuncy Oommen
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureEric D. Schabell
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1DianaGray10
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAshyamraj55
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.YounusS2
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Brian Pichman
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Adtran
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarPrecisely
 
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDELiveplex
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemAsko Soukka
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 

Último (20)

NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 Workshop
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond Ontologies
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership Blueprint
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and Istio
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URL
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability Adventure
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
 
20230104 - machine vision
20230104 - machine vision20230104 - machine vision
20230104 - machine vision
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity Webinar
 
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystem
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 

Introduction to Scala for hackersnl gathering

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.