Scala 學習筆記(1)之入門篇

獨木發表於2013-08-11

Scala is pronounced skah-lah.

Scala 全稱為 scalable language,是一種物件導向(object)函式式(functional靜態型別(statically typed)程式設計指令碼(script)語言。

1. 全面支援函數語言程式設計(Functional Programming Paradigm)。如果之前用過LISP或者Scheme應該對這些特性比較熟悉。

  • currying
  • pattern matching
  • algebraic data types
  • lazy evaluation
  • tail recursion
  • immutability

2. 物件導向和函數語言程式設計的混合

  • functional programming constructs make it easy to build interesting things quickly from simple parts
  • object-oriented constructs make it easy to structure larger systems and to adapt them to new demands

3. 指令碼語言

很多時候程式語言的入門都是從 HelloWorld 程式開始的。

object HelloWorld extends App {
   println("Hello, World!")
 }

 

如果是Java Programmer,可能更習慣下面的程式碼:

 object HelloWorld {
     def main(args: Array[String]) {
         println("Hello, world!")
     }
 }

 

執行Scala程式碼有兩種方式,一種是直接解釋執行,另一種是先編譯再執行。

 

 

 

有用的連結:

WIKI : http://en.wikipedia.org/wiki/Scala_(programming_language)

官網 :http://www.scala-lang.org/

github: https://github.com/scala

Coursera: https://class.coursera.org/progfun-002/class

 書籍連結:

Programming in Scala

 

 

相關文章