Day 4: Scala

Scala is one of the most discussed languages in the past years. It covers the most urgent problems of programming and uses the java virtual machine as runtime environment so you can use all of your java code. Scala is functional and compatible to java bytecode.

Scala can become the next big thing, because Java is not working well in modern environments. Scala covers the problem of concurrency by using a functional paradigm. It is incredible easy to write applications with multiple threads without any headaches. If you want to write high scalable applications in a Java environment Scala is a good choice.

There are some drawbacks compared to a “real” functional language. Scala is like C++ – a programming language caught into two different worlds. As long Scala is creating new concepts in the JVM it’s simply great, but using the old Java stuff is so wrong… Let me give you an example – mutable variables. Let us asume that you have the following code:

val harry = new Person("Harry", "Webber")
harry.buyFromAmazon()
harry.playSmartphone()
harry.doWork()

As long as harry is immutable you can do the three methods in any order or at the same time! That is beautiful and functional programming languages are working like that. But because Scala want’s catch more Java developer it is also possible to have mutable variables. This breaks the whole concept :-/

Anyway Scala can become the next big language on the market like C++ became – also a language that was caught into two different worlds…

2nd and 3rd day: Io + Prolog

Oh – my brain is not made for them… Well, Io is pretty cool, but the lack of syntactic sugar kills my brain. It’s really important to understand the concept of messages. Of course we are all using messages in the object oriented languages (usually called methods) for the understanding of Io it seems to be important to take a closer look at this concept. The idea of using prototyping instead of having classes is similar to JavaScript.

Prolog is unbelievable impressive! And very different from writing programs in any other kind of language. With Prolog you can solve logical problems extremely fast – not fast in the meaning of execution time, but fast in the meaning of programming time. Let me explain it… Usually you are writing a program by telling the computer each step of what to do and how to do it, Prolog is different. If you want to solve a sudoku in C will probably use a backtracking algorithm. So you tell the computer what is a valid solution and then test each combination by using the algorithm and of course you have to give the computer the ‘unfinished’ solution as starting point.

With Prolog only tell the computer the rules and the starting point. No need to write any algorithm! This problem can fully be solved by the given rules. It’s like magic 🙂

2nd day: Io

Yesterday it was harder than I thought. Two of the ten excercises in the book are were exert. It is a long time ago since I’ve developed my own tree data structure and meta programming was very new for me. But today I will learn Io!

Io is a very small and modern prototyping language – like JavaScript. I hope Io will help me to understand JavaScript much better, than I do today.

Five Languages in Five Days!

A few month ago I bought a book called “Seven Languages in Seven Days” written by the brilliant Bruce Tate. Bruce explains how to learn seven different computer languages in seven weeks. It turns out, that I was not able to find at least one hour a day for this book. Now I will give me a second and more competitive try: Five languages in five days.

I’m on holiday now and for that reason I’ve five days to learn new stuff and this will be: Ruby, Io, Prolog, Scala and Erlang. To be honest I know Ruby, but maybe it will give me a different view to this language – and it’s a nice and comfortable warm up.

So let’s start with day one: Ruby!