Jump Start into Apache Spark (Seattle Spark Meetup)Denny Lee
Denny Lee, Technology Evangelist with Databricks, will demonstrate how easily many Data Sciences and Big Data (and many not-so-Big Data) scenarios easily using Apache Spark. This introductory level jump start will focus on user scenarios; it will be demo heavy and slide light!
Performance Optimization Case Study: Shattering Hadoop's Sort Record with Spa...Databricks
Performance Optimization Case Study: Shattering Hadoop's Sort Record with Spark and Scala
Talk given by Reynold Xin at Scala Days SF 2015
In this talk, Reynold talks about the underlying techniques used to achieve high performance sorting using Spark and Scala, among which are sun.misc.Unsafe, exploiting cache locality, high-level resource pipelining.
Sous ce nom de session trollesque se cache une présentation de l'outil SBT. L'idée est de mettre en avant ce que SBT peut apporter en plus dans le quotidien du développeur comparé aux outils reconnus tel que maven.
Nous parlerons ici de son utilisation au sein de projets Java même s'il s'est développé conjointement avec le scala. Durant cette présentation, nous verrons les fonctionnalités clefs qui pourront influencer vos choix sur vos projets.
Jump Start into Apache Spark (Seattle Spark Meetup)Denny Lee
Denny Lee, Technology Evangelist with Databricks, will demonstrate how easily many Data Sciences and Big Data (and many not-so-Big Data) scenarios easily using Apache Spark. This introductory level jump start will focus on user scenarios; it will be demo heavy and slide light!
Performance Optimization Case Study: Shattering Hadoop's Sort Record with Spa...Databricks
Performance Optimization Case Study: Shattering Hadoop's Sort Record with Spark and Scala
Talk given by Reynold Xin at Scala Days SF 2015
In this talk, Reynold talks about the underlying techniques used to achieve high performance sorting using Spark and Scala, among which are sun.misc.Unsafe, exploiting cache locality, high-level resource pipelining.
Sous ce nom de session trollesque se cache une présentation de l'outil SBT. L'idée est de mettre en avant ce que SBT peut apporter en plus dans le quotidien du développeur comparé aux outils reconnus tel que maven.
Nous parlerons ici de son utilisation au sein de projets Java même s'il s'est développé conjointement avec le scala. Durant cette présentation, nous verrons les fonctionnalités clefs qui pourront influencer vos choix sur vos projets.
You don't yet speak Scala? Then let us invite you to a journey on which we will explore the outstanding features of this programming language for the Java Virtual Machine. As an introduction we will briefly talk about Scala's key characteristics. Then we will explore this language and some of its typical applications, e.g. concise OO and powerful functional collections. If you are a developer and expect vivid examples and live coding, then you will like this session.
Knoldus organized a Meetup on 1 April 2015. In this Meetup, we introduced Spark with Scala. Apache Spark is a fast and general engine for large-scale data processing. Spark is used at a wide range of organizations to process large datasets.
Scala: Pattern matching, Concepts and ImplementationsMICHRAFY MUSTAFA
In the following slides, we attempt to present the pattern matching and its implementation in Scala.
The concepts introduced are: Basic pattern matching, Pattern alternative, Pattern guards, Pattern matching and recursive function, Typed patterns, Tuple patterns, Matching on option, Matching on immutable collection, Matching on List, Matching on case class, Nested pattern matching in case classes, and
Matching on regular expression.
Mémoire de fin d'étude - La big data et les réseaux sociauxChloé Marty
Comment l’explosion quantitative de la data va donner aux marques l’opportunité de mieux cibler et de mieux s’adresser à leurs publics sur les réseaux sociaux alors que l’utilisation et l’exploitation de ces données s’avère être très complexe et pose un problème d’éthique ?
Scala eXchange: Building robust data pipelines in ScalaAlexander Dean
Over the past couple of years, Scala has become a go-to language for building data processing applications, as evidenced by the emerging ecosystem of frameworks and tools including LinkedIn's Kafka, Twitter's Scalding and our own Snowplow project (https://github.com/snowplow/snowplow).
In this talk, Alex will draw on his experiences at Snowplow to explore how to build rock-sold data pipelines in Scala, highlighting a range of techniques including:
* Translating the Unix stdin/out/err pattern to stream processing
* "Railway oriented" programming using the Scalaz Validation
* Validating data structures with JSON Schema
* Visualizing event stream processing errors in ElasticSearch
Alex's talk draws on his experiences working with event streams in Scala over the last two and a half years at Snowplow, and by Alex's recent work penning Unified Log Processing, a Manning book.
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Elevating Tactical DDD Patterns Through Object CalisthenicsDorra BARTAGUIZ
After immersing yourself in the blue book and its red counterpart, attending DDD-focused conferences, and applying tactical patterns, you're left with a crucial question: How do I ensure my design is effective? Tactical patterns within Domain-Driven Design (DDD) serve as guiding principles for creating clear and manageable domain models. However, achieving success with these patterns requires additional guidance. Interestingly, we've observed that a set of constraints initially designed for training purposes remarkably aligns with effective pattern implementation, offering a more ‘mechanical’ approach. Let's explore together how Object Calisthenics can elevate the design of your tactical DDD patterns, offering concrete help for those venturing into DDD for the first time!
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
You don't yet speak Scala? Then let us invite you to a journey on which we will explore the outstanding features of this programming language for the Java Virtual Machine. As an introduction we will briefly talk about Scala's key characteristics. Then we will explore this language and some of its typical applications, e.g. concise OO and powerful functional collections. If you are a developer and expect vivid examples and live coding, then you will like this session.
Knoldus organized a Meetup on 1 April 2015. In this Meetup, we introduced Spark with Scala. Apache Spark is a fast and general engine for large-scale data processing. Spark is used at a wide range of organizations to process large datasets.
Scala: Pattern matching, Concepts and ImplementationsMICHRAFY MUSTAFA
In the following slides, we attempt to present the pattern matching and its implementation in Scala.
The concepts introduced are: Basic pattern matching, Pattern alternative, Pattern guards, Pattern matching and recursive function, Typed patterns, Tuple patterns, Matching on option, Matching on immutable collection, Matching on List, Matching on case class, Nested pattern matching in case classes, and
Matching on regular expression.
Mémoire de fin d'étude - La big data et les réseaux sociauxChloé Marty
Comment l’explosion quantitative de la data va donner aux marques l’opportunité de mieux cibler et de mieux s’adresser à leurs publics sur les réseaux sociaux alors que l’utilisation et l’exploitation de ces données s’avère être très complexe et pose un problème d’éthique ?
Scala eXchange: Building robust data pipelines in ScalaAlexander Dean
Over the past couple of years, Scala has become a go-to language for building data processing applications, as evidenced by the emerging ecosystem of frameworks and tools including LinkedIn's Kafka, Twitter's Scalding and our own Snowplow project (https://github.com/snowplow/snowplow).
In this talk, Alex will draw on his experiences at Snowplow to explore how to build rock-sold data pipelines in Scala, highlighting a range of techniques including:
* Translating the Unix stdin/out/err pattern to stream processing
* "Railway oriented" programming using the Scalaz Validation
* Validating data structures with JSON Schema
* Visualizing event stream processing errors in ElasticSearch
Alex's talk draws on his experiences working with event streams in Scala over the last two and a half years at Snowplow, and by Alex's recent work penning Unified Log Processing, a Manning book.
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Elevating Tactical DDD Patterns Through Object CalisthenicsDorra BARTAGUIZ
After immersing yourself in the blue book and its red counterpart, attending DDD-focused conferences, and applying tactical patterns, you're left with a crucial question: How do I ensure my design is effective? Tactical patterns within Domain-Driven Design (DDD) serve as guiding principles for creating clear and manageable domain models. However, achieving success with these patterns requires additional guidance. Interestingly, we've observed that a set of constraints initially designed for training purposes remarkably aligns with effective pattern implementation, offering a more ‘mechanical’ approach. Let's explore together how Object Calisthenics can elevate the design of your tactical DDD patterns, offering concrete help for those venturing into DDD for the first time!
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Albert Hoitingh
In this session I delve into the encryption technology used in Microsoft 365 and Microsoft Purview. Including the concepts of Customer Key and Double Key Encryption.
In his public lecture, Christian Timmerer provides insights into the fascinating history of video streaming, starting from its humble beginnings before YouTube to the groundbreaking technologies that now dominate platforms like Netflix and ORF ON. Timmerer also presents provocative contributions of his own that have significantly influenced the industry. He concludes by looking at future challenges and invites the audience to join in a discussion.
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
Climate Impact of Software Testing at Nordic Testing DaysKari Kakkonen
My slides at Nordic Testing Days 6.6.2024
Climate impact / sustainability of software testing discussed on the talk. ICT and testing must carry their part of global responsibility to help with the climat warming. We can minimize the carbon footprint but we can also have a carbon handprint, a positive impact on the climate. Quality characteristics can be added with sustainability, and then measured continuously. Test environments can be used less, and in smaller scale and on demand. Test techniques can be used in optimizing or minimizing number of tests. Test automation can be used to speed up testing.
Pushing the limits of ePRTC: 100ns holdover for 100 daysAdtran
At WSTS 2024, Alon Stern explored the topic of parametric holdover and explained how recent research findings can be implemented in real-world PNT networks to achieve 100 nanoseconds of accuracy for up to 100 days.
Essentials of Automations: The Art of Triggers and Actions in FMESafe Software
In this second installment of our Essentials of Automations webinar series, we’ll explore the landscape of triggers and actions, guiding you through the nuances of authoring and adapting workspaces for seamless automations. Gain an understanding of the full spectrum of triggers and actions available in FME, empowering you to enhance your workspaces for efficient automation.
We’ll kick things off by showcasing the most commonly used event-based triggers, introducing you to various automation workflows like manual triggers, schedules, directory watchers, and more. Plus, see how these elements play out in real scenarios.
Whether you’re tweaking your current setup or building from the ground up, this session will arm you with the tools and insights needed to transform your FME usage into a powerhouse of productivity. Join us to discover effective strategies that simplify complex processes, enhancing your productivity and transforming your data management practices with FME. Let’s turn complexity into clarity and make your workspaces work wonders!
The Metaverse and AI: how can decision-makers harness the Metaverse for their...Jen Stirrup
The Metaverse is popularized in science fiction, and now it is becoming closer to being a part of our daily lives through the use of social media and shopping companies. How can businesses survive in a world where Artificial Intelligence is becoming the present as well as the future of technology, and how does the Metaverse fit into business strategy when futurist ideas are developing into reality at accelerated rates? How do we do this when our data isn't up to scratch? How can we move towards success with our data so we are set up for the Metaverse when it arrives?
How can you help your company evolve, adapt, and succeed using Artificial Intelligence and the Metaverse to stay ahead of the competition? What are the potential issues, complications, and benefits that these technologies could bring to us and our organizations? In this session, Jen Stirrup will explain how to start thinking about these technologies as an organisation.
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
A tale of scale & speed: How the US Navy is enabling software delivery from l...sonjaschweigert1
Rapid and secure feature delivery is a goal across every application team and every branch of the DoD. The Navy’s DevSecOps platform, Party Barge, has achieved:
- Reduction in onboarding time from 5 weeks to 1 day
- Improved developer experience and productivity through actionable findings and reduction of false positives
- Maintenance of superior security standards and inherent policy enforcement with Authorization to Operate (ATO)
Development teams can ship efficiently and ensure applications are cyber ready for Navy Authorizing Officials (AOs). In this webinar, Sigma Defense and Anchore will give attendees a look behind the scenes and demo secure pipeline automation and security artifacts that speed up application ATO and time to production.
We will cover:
- How to remove silos in DevSecOps
- How to build efficient development pipeline roles and component templates
- How to deliver security artifacts that matter for ATO’s (SBOMs, vulnerability reports, and policy evidence)
- How to streamline operations with automated policy checks on container images
A tale of scale & speed: How the US Navy is enabling software delivery from l...
Scala - A Scalable Language
1. Scala
... a Scalable Language
06.10.2009
XPUG Rhein Main
Mario Gleichmann
Mario Gleichmann XPUG Rhein/Main
2. Introduction
Mario Gleichmann
site: www.mg-informatik.de
blog: 'brain driven development'
gleichmann.wordpress.com
mail: mario.gleichmann@mg-informatik.de
Mario Gleichmann XPUG Rhein/Main
3. Motivation
Open your mind ...
• Scala vs. Java 9
• Functional programming for the imperative mind
• Discover the (new) possibilities ...
Mario Gleichmann XPUG Rhein/Main
4. Motivation
Open your mind ...
“If Java programmers want to
• Scala vs. Java 9
use features that aren't present
• Functional programming forthe language, I think they're
in the imperative mind
probably best off using another
• Discover the (new) possibilities ...
language that targets the JVM,
such as Scala and Groovy“
Joshua Bloch
Mario Gleichmann XPUG Rhein/Main
5. Motivation
Open your mind ...
● Functions & Closures
• Scala vs. Java 9 ●
Extended Type System
• Functional programming for the imperative mind
● Extended Module System
• ●
Properties
Discover the (new) possibilities ...
●
Essence over Ceremony
● Extended Control Structs
Mario Gleichmann XPUG Rhein/Main
6. Motivation
Open your mind ...
• Scala vs. Java 9 “If i were to pick a language
• Functional programming foruse today other than Java,
to the imperative mind
it would be Scala“
• Discover the (new) possibilities ...
James Gosling
Mario Gleichmann XPUG Rhein/Main
7. Motivation
Open your mind ...
• Functional programming for the imperative mind
• Discover the possibilities ...
Imparative programming
is a programming paradigm
that describes computation
in terms of statements
that change a programs state
Mario Gleichmann XPUG Rhein/Main
8. Motivation
Open your mind ...
• Functional programming for the imperative mind
• Discover the possibilities ...
Functional programming
is a programming paradigm
that describes computation as the
evaluation of mathematical functions
avoiding state and mutable data
Mario Gleichmann XPUG Rhein/Main
9. Motivation
Open your mind ...
• Functional programming for the imperative mind
• Discover the possibilities ...
Lazy Evaluation
Continuations
Monads
Recursion
Higher Order Functions
Closures
Currying
Immutable Datatypes
Mario Gleichmann XPUG Rhein/Main
10. Motivation
Open your mind ...
• Discover the (new) possibilities ...
Control Structure Abstraction
Composition Traits
Pattern Matching Type Variance
Modularity
Type Extentions / Conversions
Mario Gleichmann XPUG Rhein/Main
11. Motivation
Open your mind !!!
•
“Scala taught me to program and reason about
programming differently. I stopped thinking in terms of
allocating buffers, structs and objects and of changing those
pieces in memory. Instead I learned to think about most of
my programs as transforming input to output.
This change in thinking has lead to lower defect rates,
more modular code, and more testable code“
David Pollak
Mario Gleichmann XPUG Rhein/Main
12. What is Scala ?
A programming language ...
• Pure Object Oriented
• Statically Typed
• Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
13. What is Scala ?
A programming language ...
• Pure Object Oriented
• Martin Odersky (EPFL Switzerland)
• Functional
•
Pizza, Fummel & Co.
Statically Typed Java
Generic
•
•
• javac Reference Compiler
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
14. What is Scala ?
A programming language ...
''Everything is an Object''
• Pure Object Oriented
1 + 2 <=> 1.+( 2 )
• Statically Typed
• Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
15. What is Scala ?
A programming language ...
''Everything is an Object''
• Pure Object Oriented
1 + 2 <=> 1.+( 2 )
• Statically Typed
''No primitive Types''
123.hashCode
• Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
16. What is Scala ?
A programming language ...
''Everything is an Object''
• Pure Object Oriented
1 + 2 <=> 1.+( 2 )
• Statically Typed
''No primitive Types''
123.hashCode
• Functional
''Operations are method calls''
• Runs on the JVM actor ! msg <=> actor.!( msg )
Mario Gleichmann XPUG Rhein/Main
17. What is Scala ?
A programming language ...
• Pure Object Oriented
•
public BigInteger factorial( BigInteger n ){
Functional
Jav
a
if( n.equals( BigInteger.ZERO )
return BigInteger.ONE
else
• Statically Typed
return
n.multiply(
factorial( n.subtract( BigInteger.ONE ) ) );
• Runs on the JVM
}
Mario Gleichmann XPUG Rhein/Main
18. What is Scala ?
A programming language ...
• Pure Object Oriented
• Functional
Scal
a
def factorial( n: BigInt ): BigInt = if (n == 0 ) 1 else n * factorial( n – 1 )
• Statically Typed
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
19. What is Scala ?
A programming language ...
• Pure Object Oriented
• Functionalintroduction
Method Result Type Scal
a
def factorial( n: BigInt ): BigInt = if (n == 0 ) 1 else n * factorial( n – 1 )
• Statically Typed
Parameter list Type declaration Definition
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
20. What is Scala ?
A programming language ...
• Pure Object Oriented
• Functional
Scal
a
def factorial( n: BigInt ): BigInt = if (n == 0 ) 1 else n * factorial( n – 1 )
• Statically Typed
● (almost) everything is an expression
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
21. What is Scala ?
A programming language ...
• Pure Object Oriented
• Functional
Scal
a
def factorial( n: BigInt ): BigInt = if (n == 0 ) 1 else n * factorial( n – 1 )
• Statically Typed
● (almost) everything is an expression
BigInt 'integrates' like a Built-In type (but it's not!)
●
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
22. What is Scala ?
A programming language ...
• Pure Object Oriented
• Functional
class BigInt( val bigInteger: BigInteger ) extends java.lang.Number{
override def hashCode(): Int = this.bigInteger.hashCode()
• Statically Typed BigInt =
def + (that: BigInt):
new BigInt( this.bigInteger.add( that.bigInteger ) )
...
• }
Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
23. What is Scala ?
A programming language ...
• Pure Object Oriented
Introduction of class definition
• Functional val bigInteger: BigInteger ) extends java.lang.Number{
class BigInt(
override def hashCode(): Int = this.bigInteger.hashCode()
• Statically Typed BigInt =
def + (that: BigInt):
new BigInt( this.bigInteger.add( that.bigInteger ) )
...
• }
Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
24. What is Scala ?
A programming language ...
class value parameter
• Pure Object Oriented (primary constructor)
• Functional val bigInteger: BigInteger ) extends java.lang.Number{
class BigInt(
override def hashCode(): Int = this.bigInteger.hashCode()
• Statically Typed BigInt =
def + (that: BigInt):
new BigInt( this.bigInteger.add( that.bigInteger ) )
...
• }
Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
25. What is Scala ?
A programming language ...
• Pure Object Oriented Single Inheritance
• Functional val bigInteger: BigInteger ) extends java.lang.Number{
class BigInt(
override def hashCode(): Int = this.bigInteger.hashCode()
• Statically Typed BigInt =
def + (that: BigInt):
new BigInt( this.bigInteger.add( that.bigInteger ) )
...
• }
Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
26. What is Scala ?
A programming language ...
• Pure Object Oriented
Mandatory !
• Functional
class BigInt( val bigInteger: BigInteger ) extends java.lang.Number{
override def hashCode(): Int = this.bigInteger.hashCode()
• Statically Typed BigInt =
def + (that: BigInt):
new BigInt( this.bigInteger.add( that.bigInteger ) )
...
• }
Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
27. What is Scala ?
A programming language ...
• Pure Object Oriented
• Functional
class BigInt( val bigInteger: BigInteger ) extends java.lang.Number{
override def hashCode(): Int = this.bigInteger.hashCode()
• Statically Typed BigInt =
def + (that: BigInt):
new BigInt( this.bigInteger.add( that.bigInteger ) )
...
• }
Runs ordinary Method
on the JVM
Mario Gleichmann XPUG Rhein/Main
28. What is Scala ?
A programming language ...
• Pure Object Oriented
• Functional
class BigInt( val bigInteger: BigInteger ) extends java.lang.Number{
override def hashCode(): Int = this.bigInteger.hashCode()
• Statically Typed BigInt =
def + (that: BigInt):
new BigInt( this.bigInteger.add( that.bigInteger ) )
...
• }
RunsClass Instantiation
on the JVM
Mario Gleichmann XPUG Rhein/Main
29. What is Scala ?
A programming language ...
• Pure Object Oriented
• Functional
class BigInt( val bigInteger: BigInteger ) extends java.lang.Number{
override def hashCode(): Int = this.bigInteger.hashCode()
• Statically Typed BigInt =
def + (that: BigInt):
new BigInt( this.bigInteger.add( that.bigInteger ) )
...
• }
Runs on the JVM Self reference
Mario Gleichmann XPUG Rhein/Main
30. What is Scala ?
A programming language ...
Example: Implement your own Type
• Object Oriented
● Stack of Int values
● Immutable (Functional style)
• Functional
• Statically Typed
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
31. What is Scala ?
A programming language ...
Example: Implement your own Type
• Object Oriented
● Stack of Int values
● Immutable (Functional style)
• Functional
Empty Stack : Non Empty Stack :
[]
• Statically Typed element: Int [ 7 ]
Rest: Stack :
element: Int [ 23 ]
• Runs on the JVM Rest: Stack :
[]
Mario Gleichmann XPUG Rhein/Main
32. What is Scala ?
A programming language ...
Example: Implement your own Type
• Object Oriented
● Stack of Int values
● Immutable (Functional style)
• Functional
Empty Stack : Non Empty Stack :
[] element: Int [ 10 ]
Rest: Stack :
• Statically Typed element: Int [ 7 ]
Rest: Stack :
element: Int [ 23 ]
• Runs on the JVM Rest: Stack :
[]
Mario Gleichmann XPUG Rhein/Main
33. What is Scala ?
A programming language ...
Example: Implement your own Type
• Object Oriented
abstract class IntStack {
def push(x: Int): IntStack = new NonEmptyIntStack( x, this )
• Functional
def isEmpty: Boolean
• Statically Typed Int
def top:
def pop: IntStack
}
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
34. What is Scala ?
A programming language ...
Example: Implement your own Type
• Abstract class
Object Oriented
abstract class IntStack {
def push(x: Int): IntStack = new NonEmptyIntStack( x, this )
• Functional
def isEmpty: Boolean Abstract method
• Statically Typed Int
def top: Abstract method
def pop: IntStack Abstract method
}
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
35. What is Scala ?
A programming language ...
Example: Implement your own Type
• Object Oriented
class EmptyIntStack extends IntStack {
def isEmpty = true
• Functional
def top = throw new EmptyStackException
• Statically Typed = throw new EmptyStackException
def pop
}
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
36. What is Scala ?
A programming language ...
Example: Implement your own Type
• Object Oriented Inheritance
class EmptyIntStack extends IntStack {
def isEmpty = true
• Functional
def top = throw new EmptyStackException
• Statically Typed = throw new EmptyStackException
def pop
}
Throwing a 'checked' Exception
• Runs on the JVM ... but catching is optional
Mario Gleichmann XPUG Rhein/Main
37. What is Scala ?
A programming language ...
Example: Implement your own Type
• Object Oriented
class EmptyIntStack extends IntStack {
def isEmpty = true
• Functional
def top = throw new EmptyStackException
• Statically Typed = throw new EmptyStackException
def pop
}
val zeroInts = new EmptyIntStack
• Runs on the JVM
var noInts = new EmptyIntStack
Mario Gleichmann XPUG Rhein/Main
38. What is Scala ?
A programming language ...
Example: Implement your own Type
• Object Oriented
class EmptyIntStack extends IntStack {
def isEmpty = true
• Functional
def top = throw new EmptyStackException
• Statically Typed = throw new EmptyStackException
def pop
}
val zeroInts = new EmptyIntStack 'Immutable' value
• Runs on the JVM
var noInts = new EmptyIntStack 'mutable' variable
Mario Gleichmann XPUG Rhein/Main
39. What is Scala ?
A programming language ...
Example: Implement your own Type
• Object Oriented
class EmptyIntStack extends IntStack {
def isEmpty = true
• Functional
def top = throw new EmptyStackException
• Statically Typed = throw new EmptyStackExceptionNo need
def pop
} for multiple
val zeroInts = new EmptyIntStack Instances of
• Runs on the JVM EmptyIntStack
var noInts = new EmptyIntStack
Mario Gleichmann XPUG Rhein/Main
40. What is Scala ?
A programming language ...
Example: Implement your own Type
• Object Oriented
object EmptyIntStack extends IntStack {
• Functional def isEmpty = true
def top = throw new EmptyStackException
• Statically Typed = throw new EmptyStackException
def pop
}
• Runs on the Singleton Object
●
JVM
Mario Gleichmann XPUG Rhein/Main
41. What is Scala ?
A programming language ...
Example: Implement your own Type
• Object Oriented
object EmptyIntStack extends IntStack {
• Functional def isEmpty = true
def top = throw new EmptyStackException
• Statically Typed = throw new EmptyStackException
def pop
}
val zeroInts = new EmptyIntStack
• Runs on the JVM
var noInts = new EmptyIntStack
Mario Gleichmann XPUG Rhein/Main
42. What is Scala ?
A programming language ...
Example: Implement your own Type
• Object Oriented
class NonEmptyIntStack( elem: Int, rest: IntStack )
extends IntStack {
• Functional
def isEmpty = false
def top = elem
• Statically Typed
def pop = rest
}
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
43. What is Scala ?
A programming language ...
Example: Implement your own Type
• Object Oriented
class NonEmptyIntStack( elem: Int, rest: IntStack )
extends IntStack {
• Functional
def isEmpty = false
def top = elem
• Statically Typed
def pop = rest
}
• Runs on the JVM
var s = EmptyIntStack push 23 push 7 push 10
Mario Gleichmann XPUG Rhein/Main
44. What is Scala ?
A programming language ...
• Pure Object Oriented
• Statically Typed
• Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
45. What is Scala ?
A programming language ...
Refined Type System
• Pure Object Oriented
• Statically Typed
• Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
46. What is Scala ?
A programming language ...
Refined Type System
• Pure Object Oriented ● Using Stack with other types than Int
● Concept of stacking elements is generic
• Statically Typed
• Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
47. What is Scala ?
A programming language ...
Refined Type System
• Pure Object Oriented ● Using Stack with other types than Int
● Concept of stacking elements is generic
• Statically Typed
=> Generic Types
• Functional
(Type Parameterization)
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
48. What is Scala ?
A programming language ...
Refined Type System
• Pure Object Oriented abstract class Stack[A] { Type Paramter
def push(x: A): Stack[A] =
• Statically Typed new NonEmptyStack[A]( x, this )
def isEmpty: Boolean
• Functional def top: A
def pop: Stack[A]
• Runs on the JVM }
Mario Gleichmann XPUG Rhein/Main
49. What is Scala ?
A programming language ...
Refined Type System
• Pure Object Oriented class NonEmptyStack[A](
elem: A,
rest: Stack[A] ) extends Stack[A] {
• Statically Typed
def isEmpty = false
• Functional def top = elem
def pop = rest
}
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
50. What is Scala ?
A programming language ...
Refined Type System
• Pure Object Oriented val s = new EmptyStack[Int]
val t = s push 1 push 2 push 3
• Statically Typed
t.pop.top => 2
• Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
51. What is Scala ?
A programming language ...
Refined Type System
• Pure Object Oriented val s = new EmptyStack[Int]
val t = s push 1 push 2 push 3
• Statically Typed
t.pop.top => 2
Parameterized Type
• Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
52. What is Scala ?
A programming language ...
Refined Type System
• Pure Object Oriented val s = new EmptyStack[Int]
val t = s push 1 push 2 push 3
• Statically Typed
t.pop.top Mandatory
=> 2
( no Raw Types ! )
• Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
53. What is Scala ?
A programming language ...
Refined Type System
• Pure Object Oriented ● A Stack implementation only for numbers
• Statically Typed
• Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
54. What is Scala ?
A programming language ...
Refined Type System
• Pure Object Oriented ● A Stack implementation only for numbers
● Restrict the upper Type to Number
• Statically Typed
• Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
55. What is Scala ?
A programming language ...
Refined Type System
• Pure Object Oriented ● A Stack implementation only for numbers
● Restrict the upper Type to Number
• Statically Typed
●
Upper Type Bound
• Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
56. What is Scala ?
A programming language ...
Refined Type System
• Pure Object Oriented ● A Stack implementation only for numbers
● Restrict the upper Type to Number
• Statically Typed
●
Upper Type Bound
• Functional abstract class Stack[A <: Number]{ ... }
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
57. What is Scala ?
A programming language ...
Refined Type System
• Pure Object Oriented ● A Stack implementation only for numbers
● Restrict the upper Type to Number
• Statically Typed
●
Upper Type Bound
• Functional abstract class Stack[A <: Number]{ ... }
Defined by the implementor,
• Runs on the JVM not by the user !
Mario Gleichmann XPUG Rhein/Main
58. What is Scala ?
A programming language ...
Refined Type System
• Pure Object OrientedIs Stack[String] a super type of Stack[Any] ?
• Statically Typed
• Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
59. What is Scala ?
A programming language ...
Refined Type System
• Pure Object OrientedIs Stack[String] a super type of Stack[Any] ?
• Statically Typed
Jav
a
List<String> sList = new ArrayList<String>();
List<Object> oList = sList;
• Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
60. What is Scala ?
A programming language ...
Refined Type System
• Pure Object OrientedIs Stack[String] a super type of Stack[Any] ?
• Statically Typed
Jav
a
List<String> sList = new ArrayList<String>();
List<Object> oList = sList;
• Functional
Compile Error:
''Type mismatch: cannot convert
• Runs on the JVM List<String> to List<Object>''
Mario Gleichmann XPUG Rhein/Main
61. What is Scala ?
A programming language ...
Refined Type System
• Pure Object OrientedIs Stack[String] a super type of Stack[Any] ?
• Statically Typed
Jav
a
List<String> sList = new ArrayList<String>();
List<Object> oList = sList;
• Functional
Generic Types are
• Runs on the JVM INVARIANT
Mario Gleichmann XPUG Rhein/Main
62. What is Scala ?
A programming language ...
Refined Type System
• Pure Object Orientedbut ...
• Statically Typed
Jav
a
String[] sArray = new String[]{};
Object[] oArray = sArray;
• Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
63. What is Scala ?
A programming language ...
Refined Type System
• Pure Object Orientedbut ...
• Statically Typed
Jav
a
String[] sArray = new String[]{};
Object[] oArray = sArray;
• Functional
Arrays are
• Runs on the JVM COVARIANT
Mario Gleichmann XPUG Rhein/Main
64. What is Scala ?
A programming language ...
Refined Type System
• Pure Object Orientedbut ...
• Statically Typed
Jav
a
String[] sArray = new String[]{};
Object[] oArray = sArray;
• Functional
oArray[0] = BigDecimal.ONE;
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
65. What is Scala ?
A programming language ...
Refined Type System
• Pure Object Orientedbut ...
• Statically Typed
Jav
a
String[] sArray = new String[]{};
Object[] oArray = sArray;
• Functional
oArray[0] = BigDecimal.ONE;
ArrayStoreException
• Runs on the JVM
at Runtime !
Mario Gleichmann XPUG Rhein/Main
66. What is Scala ?
A programming language ...
Refined Type System
• Pure Object Oriented Scal
a
abstract class Stack[+A]{
• Statically Typed def push(x: A): Stack[A] =
new NonEmptyStack[A]( x, this )
...
• Functional }
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
67. What is Scala ?
A programming language ...
Refined Type System
• Pure Object Oriented Covariant subtyping Scal
a
abstract class Stack[+A]{
• Statically Typed def push(x: A): Stack[A] =
new NonEmptyStack[A]( x, this )
...
• Functional }
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
68. What is Scala ?
A programming language ...
Refined Type System
• Pure Object Oriented Covariant subtyping Scal
a
abstract class Stack[+A]{
• Statically Typed def push(x: A): Stack[A] =
new NonEmptyStack[A]( x, this )
...
• Functional }
Compile Error:
''covariant type A occurs in
• Runs on the JVM contravariant position in type A
of value x''
Mario Gleichmann XPUG Rhein/Main
69. What is Scala ?
A programming language ...
Refined Type System
• Pure Object Oriented Scal
a
abstract class Stack[+A]{
• Statically Typed def push[B >: A](x: B): Stack[B] =
new NonEmptyStack[B](x, this)
...
• Functional }
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
70. What is Scala ?
A programming language ...
Refined Type System
• Pure Object Oriented Scal
a
abstract class Stack[+A]{
• Statically Typed def push[B >: A](x: B): Stack[B] =
new NonEmptyStack[B](x, this)
...
• Functional }
Lower Type Bound
''Parameter B is restricted to range
• Runs on the JVM only over supertypes of type A''
Mario Gleichmann XPUG Rhein/Main
71. What is Scala ?
A programming language ...
Refined Type System
• Pure Object Oriented Scal
a
abstract class Stack[+A]{
• Statically Typed def push[B >: A](x: B): Stack[B] =
new NonEmptyStack[B](x, this)
...
• Functional }
val s1 = new EmptyStack[Int] push 1 push 2
• Runs on the JVM val s2 = s1 push "x"
Mario Gleichmann XPUG Rhein/Main
72. What is Scala ?
A programming language ...
Refined Type System
• Pure Object Oriented Scal
a
abstract class Stack[+A]{
• Statically Typed def push[B >: A](x: B): Stack[B] =
new NonEmptyStack[B](x, this)
...
• Functional } Stack[Int]
val s1 = new EmptyStack[Int] push 1 push 2
• Runs on the JVM val s2 = s1 push "x" Stack[Any]
Mario Gleichmann XPUG Rhein/Main
73. What is Scala ?
A programming language ...
Type inference
• Pure Object Oriented val creator: String = “Odersky“
• Statically Typed
• Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
74. What is Scala ?
A programming language ...
Type inference
• Pure Object Oriented val creator: String = “Odersky“
val creator = “Odersky“
• Statically Typed
• Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
75. What is Scala ?
A programming language ...
Type inference
• Pure Object Oriented val creator: String = “Odersky“
val creator = “Odersky“
• Statically Typed
• Functional def add( a: Int, b: Int ): Int = a + b
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
76. What is Scala ?
A programming language ...
Type inference
• Pure Object Oriented val creator: String = “Odersky“
val creator = “Odersky“
• Statically Typed
• Functional def add( a: Int, b: Int ): Int = a + b
def add( a: Int, b: Int ) = a + b
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
77. What is Scala ?
A programming language ...
Implicit Type conversion
• Pure Object Oriented “Scalable Language“ - 'a'
=> Sc l ble L ngu ge
• Statically Typed
• Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
78. What is Scala ?
A programming language ...
Implicit Type conversion
• Pure Object Oriented “Scalable Language“ - 'a'
• Statically Typed class StringExtension( s: String ){
def -( sub: Char ) = s.replace( sub, ' ' )
}
• Functional
new StringExtension( “Scala“ ).-( 'a' )
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
79. What is Scala ?
A programming language ...
Implicit Type conversion
• Pure Object Oriented “Scalable Language“ - 'a'
• Statically Typed class StringExtension( s: String ){
def -( sub: Char ) = s.replace( sub, ' ' )
}
• Functional
implicit def toStringExtension( s: String ) =
new StringExtension( s )
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
80. What is Scala ?
A programming language ...
Implicit Type conversion
• Pure Object Oriented “Scalable Language“ - 'a'
Implicit conversion to StringExtension
• Statically Typed class StringExtension( s: String ){
def -( sub: Char ) = s.replace( sub, ' ' )
}
• Functional
implicit def toStringExtension( s: String ) =
new StringExtension( s )
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
81. What is Scala ?
A programming language ...
• Pure Object Oriented
• Statically Typed
•
Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
82. What is Scala ?
A programming language ...
●
Lambda Calculus (A. Church)
• Pure Object Oriented
●
Functions are first class values
• Statically Typed
•
Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
83. What is Scala ?
A programming language ...
●
Lambda Calculus (A. Church)
• Pure Object Oriented
●
Functions are first class values
• Statically Typed Function Literals
( x: Int ) => x + 1
•
Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
84. What is Scala ?
A programming language ...
●
Lambda Calculus (A. Church)
• Pure Object Oriented
●
Functions are first class values
• Statically Typed Function Literals
( x: Int ) => x + 1 => λ x . x + 1
•
Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
85. What is Scala ?
A programming language ...
●
Lambda Calculus (A. Church)
• Pure Object Oriented
●
Functions are first class values
• Statically Typed Function Literals
( x: Int ) => x + 1 => λ x . x + 1
•
Functional
Argument list Definition
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
86. What is Scala ?
A programming language ...
●
Lambda Calculus (A. Church)
• Pure Object Oriented
●
Functions are first class values
• Statically Typed Function Literals
( x: Int ) => x + 1 => λ x . x + 1
•
Functional val succ = ( x: Int ) => x + 1
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
87. What is Scala ?
A programming language ...
●
Lambda Calculus (A. Church)
• Pure Object Oriented
●
Functions are first class values
• Statically Typed Function Literals
( x: Int ) => x + 1 => λ x . x + 1
•
Functional val succ = ( x: Int ) => x + 1
succ( 7 ) => 8
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
88. What is Scala ?
A programming language ...
●
Lambda Calculus (A. Church)
• Pure Object Oriented
●
Functions are first class values
• Statically Typed Function Literals
( x: Int ) => x + 1 => λ x . x + 1
•
Functional val succ = ( x: Int ) => x + 1
succ( 7 ) => 8
• Runs on the JVM type of succ: ( Int ) => Int
Mario Gleichmann XPUG Rhein/Main
89. What is Scala ?
A programming language ...
Closures
• Pure Object Oriented val ages = List( 2, 20, 14, 19, 49, 11, 62 )
var barrier = 18
• Statically Typed val minors = { ( x :Int ) => x < barrier }
val germanMinors = ages.filter( minors )
•
Functional
=> List( 2, 14, 11 )
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
90. What is Scala ?
A programming language ...
Closures
• Pure Object Oriented val ages = List( 2, 20, 14, 19, 49, 11, 62 )
var barrier = 18 List[Int] (Type inference)
• Statically Typed val minors = { ( x :Int ) => x < barrier }
val germanMinors = ages.filter( minors )
•
Functional
... accepting a function which
=> List( 2, 14, 11 )and results to boolean
accepts an Int
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
91. What is Scala ?
A programming language ...
Closures
• Pure Object Oriented val ages = List( 2, 20, 14, 19, 49, 11, 62 )
var barrier = 18 free variable
• Statically Typed val minors = { ( x :Int ) => x < barrier }
val germanMinors = ages.filter( minors )
•
Functional
bound variable
'open term'
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
92. What is Scala ?
A programming language ...
Closures
• Pure Object Oriented val ages = List( 2, 20, 14, 19, 49, 11, 62 )
var barrier = 18 capturing
• Statically Typed val minors = { ( x :Int ) => x < barrier }
val germanMinors = ages.filter( minors )
•
Functional
● bound within lexical scope of function
• Runs on the JVM
=> open term is closed
Mario Gleichmann XPUG Rhein/Main
93. What is Scala ?
A programming language ...
Closures
• Pure Object Oriented val ages = List( 2, 20, 14, 19, 49, 11, 62 )
var barrier = 18
• Statically Typed val minors = { ( x :Int ) => x < barrier }
val germanMinors = ages.filter( minors )
•
Functional
barrier = 21
val usMinors = ages.filter( minors )
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
94. What is Scala ?
A programming language ...
Closures
• Pure Object Oriented val ages = List( 2, 20, 14, 19, 49, 11, 62 )
var barrier = 18
• Statically Typed val minors = { ( x :Int ) => x < barrier }
val germanMinors = ages.filter( minors )
'dynamic' bound
•
Functional
barrier = 21
val usMinors = ages.filter( minors )
• Runs on the JVM
=> 2, 20, 14, 19, 11
Mario Gleichmann XPUG Rhein/Main
95. What is Scala ?
A programming language ...
Currying
• Pure Object Oriented val add = ( a: Int, b: Int ) => a + b
• Statically Typed A function
... accepting two Args
•
Functional
... resulting in a value of type Int
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
96. What is Scala ?
A programming language ...
Currying
• Pure Object Oriented val add = ( a: Int, b: Int ) => a + b
• Statically Typed
type of function add: ( Int, Int ) => Int
•
Functional
'resulting in ...'
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
97. What is Scala ?
A programming language ...
Currying
• Pure Object Oriented val add = ( a: Int, b: Int ) => a + b
• Statically Typed
Quiz:
''transform into a function which is accepting
•
Functional only one single Argument after another''
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
98. What is Scala ?
A programming language ...
Currying
• Pure Object Oriented val add = ( a: Int ) => ( b: Int ) => a + b
• Statically Typed
•
Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
99. What is Scala ?
A programming language ...
Currying
• Pure Object Oriented val add = ( a: Int ) => ( b: Int ) => a + b
• Statically Typed A function
... accepting one Arg
•
Functional
... resulting in another function
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
100. What is Scala ?
A programming language ...
Currying
• Pure Object Oriented val add = ( a: Int ) => ( b: Int ) => a + b
• Statically Typed
... accepting one Arg
•
Functional
... resulting in a value of type Int
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
101. What is Scala ?
A programming language ...
Currying
• Pure Object Oriented val add = ( a: Int ) => ( b: Int ) => a + b
• Statically Typed
type of function add: (Int) => (Int) => Int
•
Functional 'resulting in ...'
'resulting in ...'
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
102. What is Scala ?
A programming language ...
Currying
• Pure Object Oriented val add = ( a: Int ) => ( b: Int ) => a + b
• Statically Typed val succ = add( 1 )
succ( 7 ) => 8
•
Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
103. What is Scala ?
A programming language ...
Currying
• Pure Object Oriented val add = ( a: Int ) => ( b: Int ) => a + b
A function ...
val succ = add( 1 ) ... accepting one Arg
• Statically Typed
... resulting in another function
succ( 7 ) => 8
•
Functional
... accepting one Arg
... resulting in a value of type Int
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
104. What is Scala ?
A programming language ...
Curried Methods
• Pure Object Oriented def mult( a: Int )( b: Int ) = a * b
• Statically Typed
•
Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
105. What is Scala ?
A programming language ...
Curried Methods
• Pure Object Oriented def mult( a: Int )( b: Int ) = a * b
• Statically Typed
multiple parameter lists
•
Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
106. What is Scala ?
A programming language ...
Curried Methods
• Pure Object Oriented def mult( a: Int )( b: Int ) = a * b
• Statically Typed
multiple parameter lists
•
Functional
Signature: mult ( Int ) ( Int ) : Int
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
107. What is Scala ?
A programming language ...
Curried Methods
• Pure Object Oriented def mult( a: Int )( b: Int ) = a * b
val double = mult( 2 ) _
• Statically Typed
•
Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
108. What is Scala ?
A programming language ...
Curried Methods
• Pure Object Oriented def mult( a: Int )( b: Int ) = a * b
val double = mult( 2 ) _
• Statically Typed
Partially applied 2nd Arg unapplied
•
Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
109. What is Scala ?
A programming language ...
Curried Methods
• Pure Object Oriented def mult( a: Int )( b: Int ) = a * b
val double = mult( 2 ) _
• Statically Typed
•
Functional Coercion into a function of
type ( Int ) => Int
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
110. What is Scala ?
A programming language ...
Curried Methods
• Pure Object Oriented def mult( a: Int )( b: Int ) = a * b
val double = mult( 2 ) _
• Statically Typed
double( 6 ) => 12
•
Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
111. What is Scala ?
A programming language ...
Curried Methods
• Pure Object Oriented val hours = ( 0 to 23 ).toList
def modulo( n: Int )( x: Int ) = ( x % n ) == 0
• Statically Typed
hours.filter( modulo( 2 ) _ )
•
Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
112. What is Scala ?
A programming language ...
Curried Methods
• Pure Object Oriented val hours = ( 0 to 23 ).toList List[Int]
def modulo( n: Int )( x: Int ) = ( x % n ) == 0
• Statically Typed
hours.filter( modulo( 2 ) _ )
•
Functional
expects function of type ( Int ) => Boolean
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
113. What is Scala ?
A programming language ...
Curried Methods
• Pure Object Oriented val hours = ( 0 to 23 ).toList
def modulo( n: Int )( x: Int ) = ( x % n ) == 0
• Statically Typed
hours.filter( modulo( 2 ) _ )
•
Functional
curried to function of type ( Int ) => Boolean
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
114. What is Scala ?
A programming language ...
Curried Methods
• Pure Object Oriented val hours = ( 0 to 23 ).toList
def modulo( n: Int )( x: Int ) = ( x % n ) == 0
• Statically Typed
hours.filter( modulo( 2 ) _ )
=> List( 0, 2, 4, 6, 8, 10, 12, …, 20, 22 )
•
Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
115. What is Scala ?
A programming language ...
Curried Methods
• Pure Object Oriented val hours = ( 0 to 23 ).toList
def modulo( n: Int )( x: Int ) = ( x % n ) == 0
• Statically Typed
hours.filter( modulo( 2 ) _ )
=> List( 0, 2, 4, 6, 8, 10, 12, …, 20, 22 )
•
Functional
hours.filter( modulo( 4 ) )
• Runs on the JVM => List( 0, 2, 4, 8, 12, …, 16, 20 )
Mario Gleichmann XPUG Rhein/Main
116. What is Scala ?
A programming language ...
OO + FP Fusion
●
• Pure Object Oriented
• Statically Typed
• Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
117. What is Scala ?
A programming language ...
OO + FP Fusion
●
• Pure Object Oriented • Everything is an Object
• Statically Typed
• Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
118. What is Scala ?
A programming language ...
OO + FP Fusion
●
• Pure Object Oriented • Everything is an Object
• Functions are Objects
• Statically Typed
• Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
119. What is Scala ?
A programming language ...
OO + FP Fusion
●
• Pure Object Oriented • Everything is an Object
• Functions are Objects
• Statically Typed
val succ = ( x: Int ) => x + 1
• Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
120. What is Scala ?
A programming language ...
OO + FP Fusion
●
• Pure Object Oriented • Everything is an Object
• Functions are Objects
• Statically Typed
val succ = new Function1[Int, Int]{
override def apply( x: Int ) = x + 1
• Functional }
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
121. What is Scala ?
A programming language ...
OO + FP Fusion
●
• Pure Object Oriented • Everything is an Object
• Functions are Objects
• Statically Typed
val succ = new Function1[Int, Int]{
override def apply( x: Int ) = x + 1
• Functional }
succ( 7 )
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
122. What is Scala ?
A programming language ...
OO + FP Fusion
●
• Pure Object Oriented • Everything is an Object
• Functions are Objects
• Statically Typed
val succ = new Function1[Int, Int]{
override def apply( x: Int ) = x + 1
• Functional }
succ.apply( 7 )
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
123. What is Scala ?
A programming language ...
• Pure Object Oriented
• Statically Typed
• Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
124. What is Scala ?
A programming language ...
... so does Groovy, Clojure, JRuby ...
• Pure Object Oriented
• Statically Typed
• Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
125. What is Scala ?
A programming language ...
... so does Groovy, Clojure, JRuby ...
• Pure Object Oriented • Dynamically typed (MOP & Co)
• Significant Performance Overhead !
• Statically Typed
• Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
126. What is Scala ?
A programming language ...
... so does Groovy, Clojure, JRuby ...
• Pure Object Oriented • Dynamically typed (MOP & Co)
• Significant Performance Overhead !
• Statically Typed
•
Scala is statically typed !
• Functional
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
127. What is Scala ?
A programming language ...
... so does Groovy, Clojure, JRuby ...
• Pure Object Oriented • Dynamically typed (MOP & Co)
• Significant Performance Overhead !
• Statically Typed
•
Scala is statically typed !
• Functional
• Compiles to Bytecode
• Seamless Java Interoperability
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
128. What is Scala ?
A programming language ...
... so does Groovy, Clojure, JRuby ...
• Pure Object Oriented • Dynamically typed (MOP & Co)
• Significant Performance Overhead !
• Statically Typed
•
Scala is statically typed !
• Functional
• Compiles to Bytecode
• Seamless Java Interoperability
• Runs on the JVM • Performance on par with Java
Mario Gleichmann XPUG Rhein/Main
129. What is Scala ?
A programming language ...
“I can honestly say if someone
• Pure Object Oriented
had shown me the Programming
in Scala book ... back in 2003
• Statically Typed
I'd probably have never created
Groovy“
• Functional
James Strachan
• Runs on the JVM
Mario Gleichmann XPUG Rhein/Main
130. Characteristics
•
Expressive
•
High Level
•
Concise
•
Extensible
•
Pragmatic
Mario Gleichmann XPUG Rhein/Main
131. Characteristics
•
Expressive
case class Person( name: String, age: Int )
•
High Level var persons = List( Person( "Hans", 11 ),
Person( "Hugo", 19 ),
Person( "Helga", 16 ),
Person( "Heinz", 38 ) )
•
Concise
val (adults, minors) = persons.partition( _.age > 18 )
•
Extensible
Can you spot the intention ?
•
Pragmatic
Mario Gleichmann XPUG Rhein/Main
132. Characteristics
•
Expressive
case class Person( name: String, age: Int )
•
High Level var persons = List( Person( "Hans", 11 ),
Person( "Hugo", 19 ),
Person( "Helga", 16 ),
Person( "Heinz", 38 ) )
•
Concise
val (adults, minors) = persons.partition( _.age > 18 )
•
Extensible
''Split Persons into minors and adults by their age''
•
Pragmatic
Mario Gleichmann XPUG Rhein/Main
133. Characteristics
•
Expressive
case class Person( name: String, age: Int )
•
High Level var persons = List( Person( "Hans", 11 ),
Person( "Hugo", 19 ),
Person( "Helga", 16 ),
Results into a Tuple2[List[Person],List[Person]]
Person( "Heinz", 38 ) )
•
Concise
val (adults, minors) = persons.partition( _.age > 18 )
•
Extensible
''Split Persons into minors and adults by their age''
•
Pragmatic
Mario Gleichmann XPUG Rhein/Main
134. Characteristics
•
Expressive
case class Person( name: String, age: Int )
•
High Level var persons = List( Person( "Hans", 11 ),
Person( "Hugo", 19 ),
Person( "Helga", 16 ),
Results into a Tuple2[List[Person],List[Person]]
Person( "Heinz", 38 ) )
•
Concise
val (adults, minors) = persons.partition( _.age > 18 )
•
Extensible Pattern Matching:
''Split Persons into minors and adults by their age''
bound to single elements of a Tuple2
•
Pragmatic
Mario Gleichmann XPUG Rhein/Main
135. Characteristics
•
Expressive
case class Person( name: String, age: Int )
•
High Level var persons = List( Person( "Hans", 11 ),
Person( "Hugo", 19 ),
Person( "Helga", 16 ),
Person( "Heinz", 38 ) )
•
Concise
val (adults, minors) = persons.partition( _.age > 18 )
•
Extensible
''Split Persons into minors and adults by their age''
adults => List(Person(Hugo,19), Person(Heinz,38))
•
Pragmatic minors => List(Person(Hans,11), Person(Helga,16))
Mario Gleichmann XPUG Rhein/Main
142. Characteristics
•
Expressive
•
High Level
•
Concise
•
Extensible
•
Pragmatic
Mario Gleichmann XPUG Rhein/Main
143. Characteristics
Upper Case in given name ? Jav
•
Expressive
a
boolean hasUpperCase = false;
•
High Level for( int i=0; i < name.length; i++ ){
if( Character.isUpperCase( name.charAt( i ) {
•
Concise hasUpperCase = true;
break;
}
•
Extensible
}
•
Pragmatic
Mario Gleichmann XPUG Rhein/Main
144. Characteristics
Upper Case in given name ? Scal
•
Expressive
a
val hasUpperCase =
name.exists( c: Char => c.isUpperCase )
•
High Level
•
Concise
•
Extensible
•
Pragmatic
Mario Gleichmann XPUG Rhein/Main
145. Characteristics
Upper Case in given name ? Scal
•
Expressive
a
val hasUpperCase =
name.exists( c: Char => c.isUpperCase )
•
High Level
•
Concise 'Higher Order Method' Function
•
Extensible
•
Pragmatic
Mario Gleichmann XPUG Rhein/Main
146. Characteristics
Upper Case in given name ? Scal
•
Expressive
a
val hasUpperCase =
name.exists( c: Char => c.isUpperCase )
•
High Level
•
Concise 'Higher Order Method' Function
val hasUpperCase =
•
Extensible
name.exists( c => c isUpperCase )
•
Pragmatic Type inference
Mario Gleichmann XPUG Rhein/Main
147. Characteristics
Upper Case in given name ? Scal
•
Expressive
a
val hasUpperCase =
name.exists( c: Char => c.isUpperCase )
•
High Level
•
Concise 'Higher Order Method' Function
val hasUpperCase =
•
Extensible
name.exists( _ isUpperCase )
•
Pragmatic parameter shortcut
Mario Gleichmann XPUG Rhein/Main