Scala basics: What is Scala?
Many people do not know about the programming language Scala, or why they should care. I think you should care, because Scala has some nice secrets from which you can learn a lot. Scala is a great excuse for learning new things. Even if you never use Scala again, it can be a nice addition to any programmer’s toolbox.
No matter what language you are programming in, it is a good habit to look at new developments. New ways of doing stuff keeps your brain alive. You become a better programmer with your existing tools. And maybe you get some new tools in the process.
So, onto the first question, What is Scala?
What is Scala?
Scala is a relatively young programming language. It has the following distinguishing features:
- Java compatible bytecode
- Functional programming language
Java compatible bytecode
Scala is a bit special because it runs on the Java virtual machine. This means that Scala code will compile into Java compatible bytecode. For the Java programmers, this means you can integrate Scala directly into your Java projects. This means that it is possible to create a Java interface and implement it in Scala. Or call Scala methods from Java. It also means that you can use a truckload of existing Java libraries with Scala.
This is very neat, as you do not have to convert entire projects to Scala. You can use Scala in the spots where it fits, and use Java as the main language. This makes Scala look a lot more interesting, especially in big Java shops.
Functional programming language
Scala is a functional programming language. To give a tip-of-the-iceberg-idea: every function is an object. Scala gives the possibility to pass values, but also to pass calculations to methods. This is very powerful and opens a lot of doors to all kinds of new programming constructs.
In Scala, you can make the following constructs very easily:
- Anonymous functions
- Pass a function as argument to another function
- Nested functions
- Function as return value of a function
The Hello World example
As any post about a new programming language, I cannot omit the Hello World example.
So, download Scala, copy/paste the following code and get started!
object HelloWorld { def main(args: Array[String]) { println("Hello, world!") } }
Further reading
Subscribe |



Scala basics: What is Scala?…
[...]Many people do not know about the programming language Scala, or why they should care. I think you should care, because Scala has some nice secrets from which you can learn a lot. Scala is a great excuse for learning new things. Even if you never …
[...] Scala basics: What is Scala? – ‘Daan’ [...]
I guess the real question is why would I use Scala?
You can choose for yourself. If you know what it is, you can decide if it makes sense to use it.
For me personal, Scala is a learning experience. It is refreshing to sometimes look at other technologies. When I learn more about other technologies, I can apply that knowledge to my current projects.
You can become a better programmer by looking around with an open mind, rembering the good stuff, forgetting the bad stuff.
Leave your response!
(What is RSS?)
.read popular posts
.recent comments
.categories
.blogroll
.now reading
Currently reading:
Recently finished:
View all books
jWeekend
jWeekend: Intensive, 1 and 2 day Java Technology, OO, JPA, Spring courses for busy people.
Recent Posts
Twitter
About
I'm Daan, and this is my blog. I'm a Java software developer, and at work we build open source software for the health care industry. We apply Scrum and some principles of eXtreme Programming.
We use things like Java, Spring, Hibernate, Wicket, OSGI, on Apple hardware.
Feel free to contact me via Skype.