Developing for multi-cores and the cloud

Posted by & filed under , .

I have noticed recently that “cloud” and “multi-core” became buzz words in the Java world. (About time if you ask me!)

The interesting bit is the implication it has on writing code — and so many developers (and not only!) are blogging their nuts off about this. All of a sudden it is ok to break design patterns and OOP principles in order to make your code multi-core friendly and parallelize it as much as possible, in order to get that extra bit of “juice” out of it. Finally the world came to realise that OOP are good but quite often you will have to sacrifice some of your design and architecture in favour of the response time. Because let’s face it, that’s the one that really matters — to your users. I couldn’t care less if Twitter was modularly designed to allow for easier extensibility and maintenance (to use one of the favourite phrases of the OOP evangelists) or whether there were any GOF design patterns applied in their code — but if my they are down or my tweet doesn’t make it through or it takes ages, I’ll give up (for a few days). (That doesn’t sound like much to you and me but for Twitter it means losing all the valuable traffic — which ultimately will have to convert to revenue.)

I’ve had some funny looks in the past when working on various systems and proposing approaches that violated OOP designs — but focused on the speed of the application — and every single time I had to seriously ask myself having encountered these reactions “Am I going mad or do they not see the pro’s in this?” As it happens I won half of those arguments and lost the other half — pretty sure as well that the thoughts of the ones involved in these discussions were 50/50 split in between “he’s a useless lunatic” and “he’s got some good ideas”. It’s interesting to see though some of these people who were waving the OOP flag now changing sides (though they don’t seem to realise it, which makes it quite funny!) and go preaching the humankind about stateless static methods and the likes.

Somehow, this reminded me of the problems one used to have when the Sinclair Spectrum was around and if you were programming games (ahem, though the term “games” in this context is quite loose 🙂 you wouldn’t do a for 1..3 whatsover, but actually copy the block of code and paste it 3 times in order to save those precious processor cycles! We’re not far away it occurs to me from doing this with the “cloud-based” approach of writing our Java apps it seems — and it’s actually ok now all of a sudden to do that! (As a side note, a for is difficult to distribute — while your unit of code called 3 times might be a good candidate for distribution across different cores.)

So I am somehow waiting for the day when some voice of authority in Java will publish the “Un-design patterns for multi-cores and the cloud” book — and no doubt everyone will embrace it! — and then I bet you Java (8 ?) will become more of a C-like clone which can run multi-platform. Oh no, wait, we already have portable libraries in C! 😀

Leave a Reply

Your email address will not be published.