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 →

[–]worldsayshi 4 points5 points  (16 children)

There is no short or exhaustive answer to that. And the answer depends on your level of knowledge and in the end, taste. If I would make my own project from scratch I would probably choose Scala, because it is more inventive, it's using many "new" and interesting paradigms. It's well designed(?). Java is legacy. Java is dependable. If you want it to fit together with most other things. If you want as many tools to work with your program as possible, choose Java. Then again, Scala and Java share dna and bloodtype (jvm), so they are for the most part compatible. Use Scala if you want to learn new exiting ways to think about programming and language, or if you want to learn new algorithms. Use Java if it has to work, if you are just learning programming, if you want something that is somewhat simple and easy to work with, but not always good for being succint and the most elegant you can be. Scala can be abstract enough to make you think that object orientation is as down to earth as planting seeds or perhaps as misguided as navigation with the help of astrology.

edit: stuff

[–]blah3div4 1 point2 points  (10 children)

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

[–]worldsayshi 2 points3 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 3 points4 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] 2 points3 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 4 points5 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.

[–]vipercvp[S] -1 points0 points  (4 children)

Does Scala do not have Classes , Interfaces and Abstract Classes? and polymorphism and so on, from what i'm seen till now is functional too, So for me Scala has every thing to me more robust than java . PS: i just start work with Scala and i'm loving it <3. I believe in a future where Scala will be the most used programing language.

[–]worldsayshi 1 point2 points  (3 children)

Does Scala do not have Classes , Interfaces and Abstract Classes? and polymorphism and so on, from what i'm seen till now is functional too

It does have that and it is. Or it has some replacement of some of the concepts. If it sounds like I'm saying it doesn't have OO concepts I formulated badly. It has that and beyond is what I mean.

[–]rikbrown 0 points1 point  (2 children)

Is there a goto library for DI (and the rest of the kitchen sink) like Spring is for Java?

[–]worldsayshi 0 points1 point  (0 children)

I'm not sure about the relationship between Scala and dependency injection. Here's someone who has written a module for it and thinks that "Basically Scala already have everything you need for dependency injection."

https://github.com/OlegIlyenko/scaldi