Templates by BIGtheme NET

Scala Basics And Hello World Example

Basics
1) Scala integrates features of both object-oriented and functional programming.
Scalability = Functional Programming + Objects
2) Scala has the same compilation model as Java and C#, namely separate compilation and dynamic class loading, so that Scala code can call Java libraries, or .NET libraries in the .NET implementation.
To the JVM, Scala code and Java code are indistinguishable. The only difference is a single extra run-time library, scala-library.jar
3) The work on Scala stems from a research effort to develop better language support
for component software.
4) There are primarily two hypotheses that we would like to validate with the Scala language
experiment.
(a) First, Programming language for component software needs to be Scalable in the sense that the same
concepts can describe small as well as large parts. This leads to concentrate on mechanisms for
abstraction, composition, and decomposition rather than adding a large set of primitives which might be
useful for components at some level of scale, but not at other levels.
(b) Second, Scalable support for components can be provided by a programming language, which unies and generalizes object-oriented and functional programming.
5) Unlike Java, Scala has many features of functional programming languages like Scheme, Standard ML and Haskell, including currying, type inference, immutability, lazy evaluation, and pattern matching.
It also has an advanced type system supporting algebraic data types, covariance and contravariance, higher-order types, and anonymous types.
Other features of Scala not present in Java include operator overloading, optional parameters, named parameters, raw strings, and no checked exceptions.

1. Quick Start
Summary steps to develop an Scala application :
1) Download and Install Scala IDE for eclipse.
2) Create Scala project.
3) Add new Object to Scala Project.
4) Run as Scala project.
Tools used in this tutorial :
JDK 6 or JDK 7.
Scala IDE for eclipse.

1) Download and Install Scala IDE for eclipse.
Download Scala IDE for eclipse from given site,
http://scala-ide.org/?_ga=1.49874086.1003512104.1428388743
2) Create Scala project.
After start the scala eclipse IDE, Go to File -> New -> Scala Project
Scala Proj Creation

Provide the basic information to create project, like project name and click on finish.
1
3) Add new Object to Scala Project.
Now Scala project is created, add object to the project.
Go to File -> New -> Scala Object, select Scala Object and provide basic information like Object name.
And click on finish to complete object creation.
CreateObject
Open the object and add new print message.
ScalaHelloWorld.scala class

object ScalaHelloWorld {
  def main(args: Array[String]): Unit = {
    println("Scala Hello World")
  } 
}

3) Run as Scala project.
Right click on project or opened scala object and go to Run As -> Scala Application.

HelloWorld_Run