You should take a
lazy approach to learning Java. Learn it when you need it.
In my opinion, much of the old Java knowledge is out of date, much of the new tutorials are redundant. You certainly don't want to bother yourself with Java's antiquated
Collections, for example. Many Java-based frameworks can be safely ignored. And the heavyweight JavaEE stack can be safely bypassed until you were forced to use a part of it.
Many common patterns in Java are much simpler in Scala, with the former being burdened with much boilerplate code. Core logic should always be implemented in Scala. I believe you can do most of your work directly in Scala and only need to dip down into Java when building things like Swing or integrating with Spring, etc.
In regard to choosing and using Java libraries, my personal guidelines are:
- If Spring can do it, use Spring
- If Spring is too heavyweight, use what Spring uses.
- If Spring can't do it, check github projects
- If there's nothing on github, check Apache projects
- If there's nothing from Apache, check sourceforge(t).
- Finally, Google randomly or just build it yourself.
That's a bit tounge-in-cheek, but is the impression I get about the maturity and stability of third party libraries after having done Java for the last 12 years.
It depends entirely on your definition of "Competent Java Programmer".
A good understanding of the Java memory model and garbage collection strategies will help. As will experience with a wide range of 3rd part libraries.
On the other hand... if you're deeply indoctrinated into getter/setter dependency injection used by libraries like Spring, then you'll have to unlearn a lot of bad habits before you can properly deal with immutability - In this case, prior Java exposure is probably going to hinder you in learning Scala.
There are lots of folk coming to scala and clojure from ruby/python, lisp/scheme, C#, who need to pick up on:
JVM startup options, how hotspot works, 32 vs. 64 bit, use openJDK?
benchmarks, profiling, how to read stacktraces;
zillions of test libs for every conceivable need.
Swing API calls; Classpath; Maven, ant; Hudson, Interfaces
namespaces/packages/directory layout, and all the other things automated by:
intelliJ, netBean, or eclipse
+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:, EscapeAnalysis etc. http://groups.google.com/group/clojure/browse_frm/thread/c8f69037b26e2856#
If you want to learn Spanish, start to learning Spanish, not Latin. Same for programming languages. There are two things from Java that are good to know:
The first thing are APIs. But you need only a general overview about what exists. Even long time Java programmers don't know all the details. And finding the right API or lib for a problem is usually easy, as Java is so common, and even with weak Google Fu you shouldn't have any problems.
The second thing you need to know are some basic principles and limitations of Java and the JVM (including how to build and run), that help you to understand some of Scala's problems and design decisions. One typical example would be "type erasure": If you don't understand this limitation of Java's generics, you'll run in problems when using generics in Scala.
As you can see, the things you really need to know is limited. Everything else can be picked up on the way.
- Does being a competent scala programmer require you to be a competent java programmer?
- Why does Scala language require you initialize a instance variable instead of relying on a default value?
- Why does Scala require a return type for recursive functions?
- What advantages does Ceylon have over Java or Scala
- What advantages does Scala have over Java for concurrent programming?
- Intellij: SBT-based Scala project does not build with Java 9
- Why does Scala require partial application of curried functions when assigning to a val?
- How do you get java method annotations to work in scala
- @throws in Scala does not allow calling Java to catch correct exception type
- How exactly does Scala leverage more cores as opposed to Java or other non-functional languages?
- Why does activator/sbt add Scala version to pure Java library dependencies?
- Does Scala have Double Side Queue similar to Java Deque or Python deque?
- How does Scala java conversion work?
- Why does Scala occasionally fall back to Java objects?
- How does Scala handle Java style package statements
- What parts of Java (Standard library) do you need to know to write Scala code?
- Does Play Framework with the Scala plugin support MVC and the Java API?
- Require Java 8 to build Scala project using Maven
- Scala api and java compatibility, do you have to remap?
- Why does Scala require pattern variables to be linear?
- How does the order of instructions works inside Scala classes when you override a method
- Why does passing some functions in scala require _
- In Scala how do you update a property of an object within an array of objects, the object being selected by the user
- Can Scala run on its own (without installing Java first) and does it matter which Java is installed?
- scala type alias to java enum does not work?
- Scala file writing with Java printwriter - why does the file writer stop in this code?
- Will standalone scala program takes advantage of distributed/parallel processing? or does spark Scala require separate code?
- Implicit Java to Scala collection conversion does not work
- Experiences with Scala swing, how does it add to what's already available in Java swing? Are there any challenges?
- Does PySpark invoke java api and in turn java api invokes scala api in Apache Spark?
More Query from same tag
- Travis CI ignoring MAVEN_OPTS?
- Why is Akka Streams swallowing my exceptions?
- Difference between Class and Class.type in Scala
- Java, Akka Actor and Bounded Mail Box
- Spark scala - convert an array into values from the same table in a Hierarchy type table
- Concatenate two immutable maps - which elements are preferred?
- Extract words from a string column in spark dataframe
- Polymorphism when one argument is not always used
- Update ListMap and preserve order in Scala
- Where is the base docker image specified in Play Framework?
- sbt package is trying to download a package whose path does not exist
- query JSON data using slick(pg)
- Apache Spark runtime exception "Unable to load native-hadoop library for your platform" despite not using or referenceing Hadoop at all
- Convert date format in Scala
- Scala, animations and graphical user interface
- Apache Camel File process is resulting in TypeConversion Error
- Apache Spark streaming mapping object and printing attribute
- scala Ide Not identifying my class as main method
- What to do with operations for a specific kind of collection?
- Setting logback properly in play framework
- Convert Array[Row] to DataFrame in Spark/Scala
- Scala - Duplicates removal from List
- In Scala, is there a way to "pass through" traits to variables within a class?
- How to wrap blocking IO in Scala as non blocking
- How to run `scalaz.FreeT` into non-stack-safe monad?
- TwitterServer (Finch/Finagle) seems to block api call till it finishes its calculation
- How to start Amazon DynamoDB Local automatically in SBT tests?
- How does $(objectName) work in Scala Spark?
- Unexpected behavior of UDF for random integers with join operation
- SBT compile failure for Spark 2.2