Scala Traits by Code Example

We all might know about Java Interfaces. Traits in Scala are very much similar to Java Interfaces. There is just one exception if we compare traits with interfaces in Java (Java 7 and earlier version) and that is traits can also have methods with implementation. Let’s look from different perspective. In Scala we can treat traits same as classes which doesn’t have constructors with parameters. Continue reading “Scala Traits by Code Example”

Scala Data Types by Code Example

Being a purely object oriented language each and every value in Scala world is an object. Even all of the primitive data types of Scala are the objects. And as I also has mentioned in my earlier post related to Scala Methods, there is no native operator available in Scala. Instead, Scala uses a corresponding method which look like an operator. Continue reading “Scala Data Types by Code Example”

Scala Classes, Objects & Singleton Objects

Previously we have learned about Scala Programming Language, Variable Declaration and Method Declaration. Now we’ll have a closer look at the Scala classes and Objects. We’ll also learn about creating Singleton objects in Scala.

Similar to Java, classes in Scala describes the objects. Classes may contain reference variables, methods as well as constructors. Continue reading “Scala Classes, Objects & Singleton Objects”

Scala Programming Language : Introduction

The word “Scala” is a short form of the term “Scalable Language”. Technically, Scala programming is a combination of the two style of programming approaches and those are “Object Oriented Programming” and “Functional Programming”. The Object Oriented approach makes language very easy to build large applications with big structures and architecture and Functional approach keeps design very modular and pluggable. This is how Scala language is empowered by fusion of both of these approaches. Continue reading “Scala Programming Language : Introduction”