Archive
Head First Akka with Scala
Howdy
Have you enjoy Scala yet ? Have you love this language and its actor model yet ?
Probably you have. I will now explore a really cool framework for building distributed system with actor model. It’s Akka Framework. It’s a reactive framework.
If you haven’t heard about the term reactive you need to check out this one first.
First we will need to install SBT first. If you have already familiar with java. Managing dependency, installing library, setting up structure is really painful if you are not using tools or IDE. SBT is a simple build tools that doesn’t sucks like Ant (with XML hell). You need to download that first from here.
Now we can start by creating SBT project for this lesson. Create a file build.sbt and insert the following content into the file.
Run sbt compile for the first time for initializing sbt and your project. It will download the required library for Akka. Your output might be different with me. At the first time it will take awhile. Just be patience.
Create directory src/main/scala
Create file HelloActors.scala. Insert the following code
Run the project by executing sbt run from the directory where build.sbt created.
Now you can continue exploring by download the following chapter and write some code !!.
Cheers
References :
http://doc.akka.io/docs/akka/2.3.4/intro/getting-started.html
http://doc.akka.io/docs/akka/2.0/intro/getting-started-first-scala.html
http://doc.akka.io/docs/akka/2.0/index.html
http://doc.akka.io/docs/akka/2.3.4/scala/index-network.html/
http://doc.akka.io/docs/akka/2.3.4/scala/cluster-usage.html#preparing-your-project-for-clustering
Tools :
http://www.jetbrains.com/idea/features/scala.html
http://confluence.jetbrains.com/display/IntelliJIDEA/Scala?_ga=1.109172037.1933020012.1406117705
Head First Scala
It’s been a long time since I learn my last programming language. I’ve been using C# for about 6 years now. I think it’s time to learn something new.
Because of my current job heavily involved with concurrency and network I choose a language that can give me great advantage for that problem. There’s no doubt that JVM is the most reliable and mature runtime in the world. A big internet company like google, amazon and linkedin use it.
The great thing about that is there are a lot of library out there when you want to write a software. Just do your research, google it and you are ready to go with the short amount of time. The problem is the Java language become old and old. It’s not fun using that anymore.
Fortunately a bunch of smart people write another JVM based language like scala, clojure, groovy, erjang etc. This is great stuff, because you can have a taste of modern language while enjoying productivity using existing Java library.
I choose scala to learn first from a bunch of JVM languages. That’s because it’s have a multi paradim programming like functional, object oriented and concurrent. Ok. Let’s get started.
The first thing you want to do is installing JDK. You can install JDK 7 or latest. Download it from the official website.
After you install the JDK make sure that you set your environment variable. Follow this instruction.
Installing scala for Windows is very easy. Just download the MSI installer from here and run it.
Now open Command Line and type scala. Print hello world to console and celebrate your victory.
Learning a new language can be boring if you have already knew a lot from your previous experience. One approach is to visit the fundamental and unique characteristic from this language first and then going deep. One book I found very interesting for introducing the language with different paradigm is Seven Languages in Seven Weeks.
Be careful this is just an appetizer to bring the appetite. . After you buy the book then open Chapter 5 about Scala, read and type the code. You will amaze how fast you can learn this language. This language is very interesting because of it’s actor model. Also it will introduce you to functional concept like pattern matching, high order function.
Enjoy your first journey with Scala
Cheers