From the Scalapeño 2013 conference: http://scalapeno.underscore.co.il/
It’s no secret that in Israel, C# is one of the leading languages for development. This stems from various reasons, ranging from the power of the language to the ubiquity of Microsoft’s technologies in government and defense organizations. When it first came out, C# was Microsoft’s answer to Java and the two were on-par. Since then, C# has grown leaps and bounds and Java, while still sitting on top of the powerful JVM with a huge, open ecosystem created over nearly two decades, was left behind. Developers looking to stop paying the Microsoft-tax were faced with a language that simply did not meet their expectations.
Scala is the one of the answers to this growing need for a new, modern language for the JVM.
This lecture introduces the language, comparing its idioms to those of C#, and introduces you some of the tools and frameworks to get you started with it.
8. Functional First
Functional C# Functional Scala
Slight differences
Underscores… underscores everywhere!
Strict (immediate) vs. Non-Strict (lazy)
people.view().filter…
Lots more than we can cover here…
9. Syntax Doesn’t Matter, Right?
C#
class Foo: Bar, IBaz
class Foo<TBar>
interface IFoo
int foo(string s) { return 42;
}
...
Scala
class Foo extends Bar with Baz
class Foo[TBar]
trait Foo
def foo(s: String) = 42
...
10. Syntax Doesn’t Matter,
Defaults Do
C#
Private by default
Non-virtual by default
Scala
Public by default
Virtual by default
Java mentality
11. Immutable By Default
val and var
C#’s readonly
lazy val
.NET’s Lazy[T]
Collections
12. Tuples and Case Classes
Tuples
First-class citizen
Completely typed
13. Tuples and Case Classes
Tuples
First-class citizen
Completely typed
Case classes
Easy, immutable types
18. Pattern Matching: Summary
switch/case on steroids
First-class language construct
Statically checked for comprehensiveness
19. What Scala Doesn’t Have
A fast compiler
C#’s value types
Built-ins
Structs
Enums
Partial types and methods
Getters and Setters
Well, no, but…
Native for or foreach support
27. Where Do I Start?
Base stuff:
Download and install latest JDK (from oracle.com)
Go to http://scala-lang.org/downloads, download
and install the MSI
IntelliJ IDEA:
Go to http://jetbrains.com/idea/download,
download and install the Community Edition
Demo
28. Where Do I Start?
Twitter’s Scala School
A Tour of Scala
Another Tour of Scala
Functional Programming Principles in Scala
Scala By Example (PDF)
Programming in Scala (Book)