SlideShare una empresa de Scribd logo
1 de 4
TS left, scala right
class Student {
constructor(fn: string, ln:string) {
this.fname = fn;
this.lname = ln;
}
fname: string;
lname: string;
name() { return this.fname+this.lname;}
greet() {
return "Hello, " + this.name;
}
}
var s = new Student("John", "Doe");
var l = [s,s,s];
var res = l.map(s=>s.name().length).reduce((x,y)=>x+y);
println(res);
class Student (fn:String, ln:String) {
var fname: String=fn;
var lname: String=ln;
def name() = { this.fname+this.lname;}
def greet() = {
"Hello, " + this.name();
}
}
var s = new Student("John", "Doe");
var l = List(s,s,s);
var res = l.map(s=>s.name().length).reduce((x,y)=>x+y);
println(res);
TS left, short form scala right
class Student {
constructor(fn: string, ln:string) {
this.fname = fn;
this.lname = ln;
}
fname: string;
lname: string;
name() { return this.fname+this.lname;}
greet() {
return "Hello, " + this.name;
}
}
var s = new Student("John", "Doe");
var l = [s,s,s];
var res = l.map(s=>s.name().length).reduce((x,y)=>x+y);
println(res);
class Student (val fname:String, val lname:String) {
def name = s”$fname $lname”
def greet = "Hello, “ + name
}
var s = new Student("John", "Doe")
var l = List(s,s,s)
var res = l.map(_.name.length).reduce((x,y)=>x+y)
println(res)
differences
• The class definition is also the constructor, that’s
the major difference to note. Also, the keyword
‘var’ has the preferred version ‘val’ in scala, which
denotes immutability to enforce sanity, but ‘var’
works just as well.
• … most of it, especially the functional line that
sums up the length of all names (it uses map and
reduce), is basically the exact same syntax with
the exact same meaning, see the line with ‘var
res=’.
thoughts
• the two languages, except for Scala being designed to be less
verbose, have more in common, including interfaces, mixins,
generics etc. But where Typescript stops and Node limits to one
thread processing, Scala goes on from here, to full monadic
comprehensions (Microsoft’s Lynq and assorted asynchronous
DSLs), asynchronous and reactive programming, parallel collections
library and full type system, DSL capability, embedded
asynchronous distributed processing etc… due to its telecom and
backend heritage (having evolved from Erlang and Haskell).
• In addition, scala, being a self-contained ecosystem, also compiles
to JVM bytecode, which makes it binary compatible with all JVM
libraries but also compiles to JS/node and JS/web (newer
compilers). The .NET compiler was its first I believe, but it was
discontinued sometime ago.

Más contenido relacionado

Similar a Quick typescript vs scala slide

Miles Sabin Introduction To Scala For Java Developers
Miles Sabin Introduction To Scala For Java DevelopersMiles Sabin Introduction To Scala For Java Developers
Miles Sabin Introduction To Scala For Java Developers
Skills Matter
 
(How) can we benefit from adopting scala?
(How) can we benefit from adopting scala?(How) can we benefit from adopting scala?
(How) can we benefit from adopting scala?
Tomasz Wrobel
 
BCS SPA 2010 - An Introduction to Scala for Java Developers
BCS SPA 2010 - An Introduction to Scala for Java DevelopersBCS SPA 2010 - An Introduction to Scala for Java Developers
BCS SPA 2010 - An Introduction to Scala for Java Developers
Miles Sabin
 

Similar a Quick typescript vs scala slide (20)

Miles Sabin Introduction To Scala For Java Developers
Miles Sabin Introduction To Scala For Java DevelopersMiles Sabin Introduction To Scala For Java Developers
Miles Sabin Introduction To Scala For Java Developers
 
Softshake 2013: 10 reasons why java developers are jealous of Scala developers
Softshake 2013: 10 reasons why java developers are jealous of Scala developersSoftshake 2013: 10 reasons why java developers are jealous of Scala developers
Softshake 2013: 10 reasons why java developers are jealous of Scala developers
 
Introduction To Scala
Introduction To ScalaIntroduction To Scala
Introduction To Scala
 
Introduction to Functional Languages
Introduction to Functional LanguagesIntroduction to Functional Languages
Introduction to Functional Languages
 
(How) can we benefit from adopting scala?
(How) can we benefit from adopting scala?(How) can we benefit from adopting scala?
(How) can we benefit from adopting scala?
 
Stepping Up : A Brief Intro to Scala
Stepping Up : A Brief Intro to ScalaStepping Up : A Brief Intro to Scala
Stepping Up : A Brief Intro to Scala
 
2014 holden - databricks umd scala crash course
2014   holden - databricks umd scala crash course2014   holden - databricks umd scala crash course
2014 holden - databricks umd scala crash course
 
BCS SPA 2010 - An Introduction to Scala for Java Developers
BCS SPA 2010 - An Introduction to Scala for Java DevelopersBCS SPA 2010 - An Introduction to Scala for Java Developers
BCS SPA 2010 - An Introduction to Scala for Java Developers
 
An Introduction to Scala for Java Developers
An Introduction to Scala for Java DevelopersAn Introduction to Scala for Java Developers
An Introduction to Scala for Java Developers
 
Scala Introduction
Scala IntroductionScala Introduction
Scala Introduction
 
Short Reference Card for R users.
Short Reference Card for R users.Short Reference Card for R users.
Short Reference Card for R users.
 
Reference card for R
Reference card for RReference card for R
Reference card for R
 
The Scala Programming Language
The Scala Programming LanguageThe Scala Programming Language
The Scala Programming Language
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 
Scala Talk at FOSDEM 2009
Scala Talk at FOSDEM 2009Scala Talk at FOSDEM 2009
Scala Talk at FOSDEM 2009
 
Scala - brief intro
Scala - brief introScala - brief intro
Scala - brief intro
 
Scala or functional programming from a python developer's perspective
Scala or functional programming from a python developer's perspectiveScala or functional programming from a python developer's perspective
Scala or functional programming from a python developer's perspective
 
Scala in Places API
Scala in Places APIScala in Places API
Scala in Places API
 
Scala Bootcamp 1
Scala Bootcamp 1Scala Bootcamp 1
Scala Bootcamp 1
 
R command cheatsheet.pdf
R command cheatsheet.pdfR command cheatsheet.pdf
R command cheatsheet.pdf
 

Último

%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 

Último (20)

OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 

Quick typescript vs scala slide

  • 1. TS left, scala right class Student { constructor(fn: string, ln:string) { this.fname = fn; this.lname = ln; } fname: string; lname: string; name() { return this.fname+this.lname;} greet() { return "Hello, " + this.name; } } var s = new Student("John", "Doe"); var l = [s,s,s]; var res = l.map(s=>s.name().length).reduce((x,y)=>x+y); println(res); class Student (fn:String, ln:String) { var fname: String=fn; var lname: String=ln; def name() = { this.fname+this.lname;} def greet() = { "Hello, " + this.name(); } } var s = new Student("John", "Doe"); var l = List(s,s,s); var res = l.map(s=>s.name().length).reduce((x,y)=>x+y); println(res);
  • 2. TS left, short form scala right class Student { constructor(fn: string, ln:string) { this.fname = fn; this.lname = ln; } fname: string; lname: string; name() { return this.fname+this.lname;} greet() { return "Hello, " + this.name; } } var s = new Student("John", "Doe"); var l = [s,s,s]; var res = l.map(s=>s.name().length).reduce((x,y)=>x+y); println(res); class Student (val fname:String, val lname:String) { def name = s”$fname $lname” def greet = "Hello, “ + name } var s = new Student("John", "Doe") var l = List(s,s,s) var res = l.map(_.name.length).reduce((x,y)=>x+y) println(res)
  • 3. differences • The class definition is also the constructor, that’s the major difference to note. Also, the keyword ‘var’ has the preferred version ‘val’ in scala, which denotes immutability to enforce sanity, but ‘var’ works just as well. • … most of it, especially the functional line that sums up the length of all names (it uses map and reduce), is basically the exact same syntax with the exact same meaning, see the line with ‘var res=’.
  • 4. thoughts • the two languages, except for Scala being designed to be less verbose, have more in common, including interfaces, mixins, generics etc. But where Typescript stops and Node limits to one thread processing, Scala goes on from here, to full monadic comprehensions (Microsoft’s Lynq and assorted asynchronous DSLs), asynchronous and reactive programming, parallel collections library and full type system, DSL capability, embedded asynchronous distributed processing etc… due to its telecom and backend heritage (having evolved from Erlang and Haskell). • In addition, scala, being a self-contained ecosystem, also compiles to JVM bytecode, which makes it binary compatible with all JVM libraries but also compiles to JS/node and JS/web (newer compilers). The .NET compiler was its first I believe, but it was discontinued sometime ago.