Latest web development tutorials

Introduction to Scala

Scala is short for Scalable Language, is a multi-paradigm programming language

Federal Institute of Technology Lausanne (EPFL) in 2001, the Martin Odersky Funnel-based work began to design Scala.

Funnel is a programming language thought to functional programming and Petri nets is proposed.

Odersky previous work is Generic Java and javac (Sun Java compiler). Scala Java platform in late 2003 / early 2004 release. Scala on .NET platform release in June 2004. The second language version, v2.0, released in March 2006.

As of September 2009, the latest version is version 2.7.6. Scala 2.8 expected features include rewritable Scala library (Scala collections library), named and default parameters of the method, the object package (package object), and Continuation.

April 2009, Twitter announced that they had spent most of the back-end program to migrate from Ruby to Scala, the rest are going to migrate. In addition, Wattzon has publicly stated, the entire platform is based on Scala infrastructure already prepared.


Scala feature

Object-oriented features

Scala is a pure object-oriented language, each value is an object. Object data types and behavior described by classes and traits.

Abstract class extension mechanism, there are two ways: One way is to subclass inheritance, another approach is flexible mixing mechanism. The two ways to avoid the problems of multiple inheritance.

Functional Programming

Scala is a functional language, which can also function as a value to use. Scala provides a lightweight syntax for defining anonymous functions, it supports higher-order functions, allows nested multi-function, and supports currying. Scala's case class and its built-in pattern matching is equivalent to functional programming language commonly used algebraic types.

Furthermore, programmers can use Scala's pattern matching, write code to handle XML data similar to regular expressions.

Static type

Scala type system has, through compile-time checking to ensure code security and consistency. Specific type system supports the following features:

  • Generic class
  • Covariance and
  • Callout
  • Upper and lower bound of the type parameter
  • The classes and abstract types as object members
  • Composite type
  • Quote myself when explicitly specified type
  • view
  • Polymorphic method

Expansibility

Scala is designed to uphold the fact that, in practice, to develop a specific application fields often require specific language in the field of extension. Scala provides a unique combination of language mechanisms can be in the form of libraries seamlessly easily add new language constructs:

  • Any method may be used as a prefix or suffix operator
  • It can be automatically configured according to the intended type of closure.

Concurrency

Actor use Scala as its concurrency model, Actor entity similar thread through the mail to send and receive messages. Actor can reuse the threads, it can be used millions Actor in a program, but only create thousands of threads. In version 2.10 after using Akka as its default Actor achieve.


Who uses Scala

  • April 2009, Twitter announced that they had spent most of the back-end program to migrate from Ruby to Scala, the rest are going to migrate.
  • In addition, Wattzon has publicly stated, the entire platform is based on Scala infrastructure already prepared.
  • UBS to Scala for general products.
  • Coursera as a server using the Scala language.

Scala Web framework

Here are two more popular Web Application Framework in Scala: