Niche for Scala

At last post I mentioned that i’m not using Scala because of academic nature, syntax and so on. BTW, i’ve different used programming languages, sometimes with worst syntax. I spent much time on Perl. And also i’ve used Q programing language. You know, Scala have much better syntax :) I only don’t understand why they are drop standard java syntax for standard cases? Why

for(i <- mylist ){

is better than standard:

for (i: mylist) {

, etc. I see only one reason: to be different. What for?

But actually it doesn’t matter. I’ve used Perl and Q only because they have their niche, where they’re works best (ok, perl lost it now, but you know, when I used it, 10 years ago it has it). But I don’t understand niche of Scala. What is it for? If I want to develop fast code – i will choose Java. If I’m looking for syntax sugar and easy development – Groovy. Want functional code – choose Clojure. It’s just my current vision.

I definitely will try Scale one more time. Just because i see that many interesting project are using it, GridGain for example. But first I need to understand what project better fits for Scala. Can someone help me with it?


Why groovy

For last projects i choose Groovy as a main programming language, where it’s possible. Why? Because i think it’s optimal solution for most of my projects.

It’s very pragmatic, agile, powerful and expressing language. You write less code that using Java, you don’t require to write all those “getters/setters”, wrappers, huge hierarchy of objects, etc.  If you know you can use some functional-kind tricks, so two hundred java code can be rewritten using few lines. And then it requires less time for refactor, for bugfixing, for code review, for understanding, etc, etc.

It also easy to start using it. Really. There a no learning curve. Basically it’s just plain Java with additional syntax sugar. So you can rename your *.java files to *.groovy, and, ta-da-dam, you are using Groovy :)  Maybe with some rare exceptions, but it works. And then, when you feel flavor of Groovy, you will start using its feautures. Event junior java developers can start using it after short introduction, i’ve tried to teach few juniors – just fine.

And also there are good documentation, very good IDE support (at least by IntelliJ IDEA) and by development tools (like Maven, code-coverage, etc).

JVM is my choice because i’m doing mostly server-side project, and there are no alternatives with such solid base. I has done some project using python and ruby, and even PHP and Perl, but don’t pleased of quality of libraries, development tools, etc. Of course I’ve spent some time on other languages for JVM. Scala, for example, can be good language, for some teams, but it have high learning curve, very chaotic infrastructure and syntax, and it’s too academic it think. Clojure is other good choice, i’ve used it for an small project (~8K SLOC), and can say that it’s cool, but it’s not solid, it’s too young, there are no tools and IDEs (only Emacs, but did you know any junior developer who want to use Emacs? :)), so it’s not ready for production use yet.

Main problem with Groovy that it’s slow language. But i have to say, that for last couple of years i worked on different datamining projects, and know that at leas 80% (sometimes 95%) of your time you spent on non critical code, on architecture, refactoring, etc. And using Groovy you can spent this time more effectively. And when you found an bottleneck – rewrite it using Java, if you wish. Or rewrite using C/C++. Or maybe assembler. But, you now, it’s always better to think more, and write more robust algorithm on high level. And most of libraries already written using plain Java, so it fast, of course not so fast as C, but faster that Groovy.


Facebook’s FQL Console

For my current project i need to querying Facebook’s Graph API very often, by the hand, for testing and exploring. But there was no any good tool for it, so i’d made an simple tool for querying facebook: FQL Console

It’s easy to use, you have to setup your app keys, user session, and then you can make any query. As a result you can see plain JSON response of this query, and an grid view for it. Just look at this screenshot:

I’d uploaded this tool, with sources, at github. So, if you want to use it feel free to download from there:

PS Interesting thing: official Facebook Developer Forum doesn’t support Facebook Connect (sic!), only oldschool register/confirm/login/password. So i have no way to promote my tool on this forum. If you have access to it, post about this tool, please. Thanks.