scala for c# developers

Post on 10-May-2015

3.566 Views

Category:

Technology

5 Downloads

Preview:

Click to see full reader

DESCRIPTION

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.

TRANSCRIPT

Scala for C# DevelopersOmer van Kloeten

Hi!

CTO at

Eight years working in C#

Two years suffering Java

Two years enjoying Scala newBrandAnalytics AppMyDay

What is Scala?

JVM Language

Academic roots

Released 2003

Maintained by TypeSafe

Continuously updated

Why should I care?

CLR vs. JVM

The Hummus Manifesto

Java is old, Scala is the new hotness

Learn, learn, learn

Who uses Scala?

Similar Backgrounds

Trying to replace Java

Benevolent Dictators Design-by-committee sucks!

Strongly and statically typed

Object-functional

Imperative vs. Functional

Imperative C# Functional LINQ…

…But In Reality

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…

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

...

Syntax Doesn’t Matter, Defaults Do

C#

Private by default

Non-virtual by default

Scala

Public by default

Virtual by default

Java mentality

Immutable By Default

val and var C#’s readonly

lazy val .NET’s Lazy[T]

Collections

Tuples and Case Classes

Tuples First-class citizen Completely typed

Tuples and Case Classes

Tuples First-class citizen Completely typed

Case classes Easy, immutable types

Everything Is An Expression

Pattern Matching: Basics

Pattern Matching: Unapply

Pattern Matching: Collections

Pattern Matching: Summary

switch/case on steroids

First-class language construct

Statically checked for comprehensiveness

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

Wait, what?!

Well, kinda… ...is translated to:

Language Topics Not Covered :(

Streams

Type inference

Tail recursion

Multiple inheritance

Operators

Implicits

Structural Type Definitions

Companion objects

Parallelization and concurrency

Monads

Macros

Reflection

More underscores!

Tooling and Libraries

Almost twenty years of Java Scala wrappers

Great community Engineers Scientists

Tooling: IDEs

Scala plugin

JetBrains of ReSharper fame

Scala over Eclipse

TypeSafe Maintainers of Scala

NetBeans, Sublime, etc.

Tooling: REPL

Tooling: Build System

Maven

Better than Ant

Bloated

Written in Java for Java

SBT

Simple Build Tool

Irony

Written in Scala for Scala

Frameworks

Web Frameworks Play! Framework Lift Scalatra

Object-Relational Mappers Slick Squeryl

Unit Testing Specs2 ScalaTest

AND

EVERYTHING

FROM JAVA!

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

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)

Thank youQuestions?@omervk

top related