One line at a time

Another Java technology blog from a developer far away from home

Month: November 2014

Scala with Coursera

Scala LogoThis month, I started to work on my (non existent) Scala skills by following the online class of Coursera.  The lessons are taught by Martin Odersky itself and the best part of it: it’s free. Martin Odersky is the man behind Scala but he also worked on javac, the Java compiler and finally founded the company Typesafe Inc. This company leads many Open source projects like Akka or Play framework (which we both use at Skiddoo).

That being known, we can assume the guy knows what he is talking about !

The class runs for 7 weeks, and multiple sessions are opened every year (the last one was from Sept 15th to Nov 20th). You can join a class at any time but you won’t be eligible to a certificate (Statement of accomplishment) if you didn’t start at the opening of a session. Because at the end of each week, you have to accomplish an assignment and publish your work before a certain deadline. Obviously, when you join in the middle of the session, the deadline of the previous weeks are already gone.

But, if you’re just looking for great Scala lessons and functional programming paradigm, that’s definitely one of the place to go.

Continue reading

Lambda and method reference

Java 8 brought us the lambda expressions (and the adepts of functional programming said amen). It was possible to approach the same concept before Java 8 by using the anonymous classes, but it was very verbose. They call it a “vertical problem” (using a lots of code lines to only represent a single call to a method, for example).

I’m not saying lambda expressions are going to replace the anonymous classes, it will not. A lambda expression can’t have any field or multiple methods. The only situation where a lambda expression can replace an anonymous class is when the anonymous class implements an interface containing only one method.

Anonymous class !== lambda expression

Lambda expressions are not just about wrapping a “single method anonymous class” into a more readable syntax. They are actually different objects behind the scene in many point of view. Whether in terms of compiling, syntax or execution. Let’s dive into it.

Continue reading

© 2018 One line at a time

Theme by Anders NorenUp ↑