Search This Blog

Wednesday, 29 September 2010

Scala

I'm a Java guy - I've dabbled around in other languages but generally speaking my default language of choice for a project comes back to Java. It's been that way for a while, and quite honestly it's because out of the languages that I've looked at it seems the best "general" one out there. It's extremely versatile, can do an awful lot in the right hands and despite the various myths, well written Java code is really rather speedy these days. More recently though, there's been a lot of talk about Scala - it's been around for a decade or so but it seems it's only recently it's gained a lot of attention.

Every so often something comes along that looks great from an academic perspective, but for various reasons (usually because the industry has made its mind up already) it's not adopted - left to rot and subsequently forgotten about. Then again, every so often something comes along that looks awful from an academic perspective but somehow (usually due to a large corporation investing stupid amounts of money into it) it gains a foothold and we all have to put up with it because that's just the way things are done.

If Scala does end up squarely falling into one of these categories, it'll be the first. From an academic perspective it really does look very good indeed, with much better language level support for the functional side of things that Java looks to bolt on in the 7th (or 8th!) revision of its language. It's harder to pick up in places, yes, but because of its nature it will be. You have to get into the functional mindset to appreciate or use a functional language, just as you have to get in the OO mindset to appreciate and use an OO language such as Java.

The problem? Well, it's entirely on the practical side. A new language means people learning it from scratch, getting into a new mindset, an inevitable short term decrease in productivity whilst people get accustomed to working with it - none of which are good things for a business. And for the majority of people Java is still doing absolutely fine, especially with it's java.util.concurrent libraries. There's no desperate need to switch.

It's hard to say whether it will take off, but over the next few weeks I hope to look at it on a more practical level, playing around with a few demos and seeing if there's anywhere I can sensibly use it to integrate into existing Java code. We'll see what happens!

Wednesday, 22 September 2010

A java puzzle

I like coming up with these things once in a while. They exercise the mind, make people think and occasionally someone comes up with another method or two of solving the thing I hadn't considered.

So, here we go.

You've been presented with the following class written by your boss, which is meant to print "goodbye" out to the console. However, as you can clearly see the following code actually prints "hello". Your boss has asked you to rectify this problem somehow, but his code is perfect and it must be a bug in the JDK (of course).

In fact, he's already compiled the thing and it's ready to go, so he's said the only thing you're allowed to do is to add / modify / change class files in the bosscode package before it's released. Change whatever classes you want, as long as it's not Main.class (that's the perfect one!)


package bosscode;

public class Main {
public static void main(String[] args) {
new java.lang.Runnable() {
public void run() {
System.out.println("hello");
}
}.run();
}
}


Good luck - I'll post my solution / explanation in a few days time if anyone attempts it!

Tuesday, 21 September 2010

Java 7 - and now 8?!

It'd all gone pretty quiet on the Java 7 front recently - the last that'd been heard for a while was an estimate of a late 2010 release. I was hoping no news was good news on this front and that sometime around Christmas we might hear something positive regarding a release - alas this isn't the case.

This link sheds some light on things: http://blogs.sun.com/mr/entry/rethinking_jdk7

To summarise, it seems now that JDK7 is going to have an estimated ship date of mid 2011, *but* with a lot of the new features everyone was raving about (including Lambda, Jigsaw and parts of Coin) pushed back to JDK8 which should hit home in around 2 years time. The other approach detailed is shipping JDK7 with all its original bits in mid 2012 with no updates in the meantime.

Everyone was hoping for something a bit quicker, yes, but I guess with the Sun / Oracle acquisition slowing things down Java was bound to take a bit of a back seat. It's not such bad news, and if anything I'm mildly encouraged by the fact Oracle are leaning towards the approach to release early and postpone features rather than the "release everything in one go and hope for the best" approach.

...Yes, I know, I did just say something vaguely positive about Oracle!

It'll be interesting to see how this situation unfolds, whether plan B does actually happen and if so whether it'll happen to schedule.

Thursday, 16 September 2010

The move

After a bit of thought I decided I could no longer justify shelling out for a domain and hosting package on mikkle.co.uk for what had essentially become low traffic blog. So here it is - the site in its new format on blogger.

Unfortunately I can't upload files here, but I'll set up a Google site for that and link out to them on there.

Apart from those changes things should pretty much stay as usual - same guy, same thoughts!