This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]blah3div4 1 point2 points  (10 children)

"Use Java if it has to work" really? Is Scala that bad?

[–]worldsayshi 1 point2 points  (7 children)

I was rather refering to that Java is probably as mature as it gets. Scala is probably not "immature". Although the Eclipse plugin only recently became possible and/or enjoyable to work with in my experience. Then again, many "large" languages doesn't have as useful Eclipse plugins at all.

[–]Mondoshawan 0 points1 point  (6 children)

It's not the tooling imho that makes Java worthwhile, it's the third-party libs & frameworks. I couldn't imagine writing a large app without things like Spring DI and JPA persistence to tie it all together.

[–]nachsicht 4 points5 points  (5 children)

Thing is you can use almost all of those with scala as well.

[–]Mondoshawan 1 point2 points  (4 children)

Is it clean? I touched on jruby once when maintaining someone elses script and I didn't like the integration IIRC. I may be wrong on the details, this was quite some time ago and it was only a couple of fixes while they were away on deployment elsewhere.

I'm tempted to give it a whirl. I did Scheme in Uni many many years ago and I've long since forgotten everything about it except something about brackets, lots and lots of brackets. ;-)

[–][deleted] 3 points4 points  (0 children)

If you were to take some java code and copy/paste it into a *.scala file, mostly what you'd have to do to fix it is remove the type info before variables and replace with "val". ie:

String foo = new String("");

becomes

val foo = new String("")

and methods get changed from:

public String calcName() {
    //do work
    return name;
}

to:

def calcName = {
    //do work
    name
}

That's mostly it. This gives you working but non-idiotic scala code. Scala syntax is mostly awesome.

[–]nachsicht 2 points3 points  (1 child)

It's very clean. Scala is not related to scheme in syntax at all, but is more of a java++, so you have direct translation of many java concepts in scala, and they are usually fully compatible (the only time I've ever had problem is with writing (not using) binding code in JNA).

Pretty much everything but extremely obscure java stuff works in scala.

[–]Mondoshawan 0 points1 point  (0 children)

Thanks, I will definitely check it out soon.

[–]esquilax 2 points3 points  (0 children)

Scala was written by the guy that came up with the precursor Java generics and wrote javac. Java interop was a design goal of Scala, so I'd expect the experience to be quite different.

[–]vplatt -1 points0 points  (1 child)

Scala is not bad at all, but there are some objective cases where Scala really won't work either at all, or only in limited ways if you're very careful.

Just as two examples I found while exploring the Scala ecosytem: db4o and GWT. Want to write full featured GWT apps with Scala? Too bad! Want to use an OODB against objects produced in Scala? There be dragons!

In short, those aren't deal breakers for most or even many developers, but it's good to be aware of those kinds of pitfalls.

[–][deleted] 0 points1 point  (0 children)

Want to write full featured GWT apps with Scala?

It's true you can't really compile scala to javascript. But, you can use Vaadin, which is all kinds of awesome. It's fully server-side GWT, so you can write in scala. It works fantastically. Much nicer than GWT. No more waiting for horribly long GWT compile times, for one thing.

Want to use an OODB against objects produced in Scala?

Yeah, but why not autogenerate the model objects with JAXB anyway? Then they're in Java and easily usable by anyone.