Scala is a
multi-paradigm language, supporting both object-oriented and
functional programming approaches. Scala is concise and scalable, suitable
for everything from short scripts up to large-scale applications.
Scala is object-oriented
The need for some sort of program structure is the fundamental motivation
for object-oriented programming. Objects can contain operations as well as
data, and can be stored in other objects, or passed as arguments to
operations. So objects have a lot to do with language scalability since
the same techniques apply to the construction of small as well as large
programs.
Scala is functional
In a functional language, a function is a value like an integer or a string,
and can be stored in variables, or passed as arguments to other functions.
Further it provides a convenient means for abstracting over operations and
creating new control structures. This generalization of functions provides
great expressiveness, which often leads to very legible and concise programs.
Scala highlights
In the following we present the main hightlights of the Scala programming language and
libraries:
-
Language
-
Everything in Scala is really an object (eg. functions themselves
are objects).
-
No statics.
-
Nesting of definitions improves code locality.
-
Local type inference makes explicit type annotations superfluous in
most cases (eg. recursive methods require an explicit return type
to be specified).
-
Pattern matching.
-
Support for closures and function literals.
In Java, you would have to use an anonymous inner class here that
implements a method defined by an interface.
-
Method default and named arguments.
-
Libraries
-
Rich set of predefined types (including
java.lang
package).
-
Support for immutable, mutable and parallel collection classes.
-
Support for actor-based concurrent programming.
References
-
The Scala Language Specification (SLS), Version 2.8
Martin Odersky, November 2010
About the Author
Stéphane Micheloud is a senior software engineer. He holds a Ph.D in
computer science from
EPFL and a M.Sc in
computer science from
ETHZ. At EPFL he
worked on distributed programming and advanced compiler techniques and
participated for over six years to the
Scala project. Previously he was professor in computer science at
HES-SO // Valais in
Sierre, Switzerland.
Other Articles