Sorry guys, but I somewhat feel the need to
disillusion a bit about Scala and Java.
> That depends on your purpose.
Absolutely. But often the purpose is to write some
app with UI and persistence. Scala is --at least currently--
not in an autonomous position here.
> So, I'll rephrase your question as "Is learning Scala enough,
> or do I need to learn Java too to program in Scala?".
In my opinion, at least at the current state of
the Scala infrastructure, you have. No way around.
> Learning Scala is enough, and I think Programming in Scala
> does a great job of doing it, but, then again, I know a lot
> about Java.
Right. And that will make us blind for so much problems of
Non-Javaists.
> There are two things about Java that you might miss, though:
>
> 1. The whole Java infrastructure.
>
> You may want to make "jar" files (or even "war" files or
> similar stuff), run it on web servers or computers without
> Scala installed, and things like that. This kind of stuff is
> not covered by Programming in Scala. Then again, this kind of
> stuff is usually learned through experience, not books.
"Experience" does not mean "not books" in the sense of "no Java
literature" or "no Java learning". It means to first take
some literature and work through it "hands on".
So even without "books": Without the typical "getting started"
stuff, "tutorials" or "user manuals" you will have a BAD experience.
You need some guidance to know where to start and where to go.
This guidance stuff is mostly written in context of Java today.
(Not Scala, nor Clojure, nor Groovy, not JRuby, not Jython ...)
> 2. Java libraries.
>
> There are many, many Java libraries that you might be
> interested in. There is no shame in that. After all, Scala
> itself uses Java's standard library extensively, and there
> are tons of good stuff out there. There is no sense in
> spending days to display a simple graph of data when there
> are libraries which will display your data in dozens of
> different graphic formats.
>
> It's important that you are able to read API documents, and
> understand simple examples.
>
> I don't think either of these two things require a more
> formal Java education. If you can get by, it should be enough.
You mean reading about scala.swing is enough to work with the
Swing framework? I doubt. At least if you want to do some
things beyond simple basic GUIs.
You mean reading about scala.io is enough to work with the
file system? I doubt too. You will have to learn about
java.io.File and its tricky Java semantics, about all the
different pluggable Reader/Writer things a.s.o.
There is no sophisticated scala file system handling beyond
scala.io.Source imho.
And even if you could write such stuff without deep knowledge
of the Java below, you will experience a shock when first
trying to debug some less obvious bug.
My statement: As long as a JVM-language does not completely
replace rt.jar on user level, you will not do without Java
knowledge. That's the "thin wrapper layer" problem of today's
JVM-languages.
Much more if you want to use tools which have Java, but not
Scala APIs. For example try to use OOo's UNO bridge without
Java knowledge... No chance. And there is much more that
you can easily Scala-fy AFTER you understood the Java stuff.
After you have done all this, what big is the distance to
"having learned Java"? The question was not about formal
education IMHO. "Learning Java" just starts at a much simpler
level.
Hopefully some day much more basic stuff will be written
originally in Scala....
Just my 2ct
Dirk