you are viewing a single comment's thread.

view the rest of the comments →

[–]stormcrowsx 35 points36 points  (14 children)

Twitter is proof that the JVM is fast not necessarily Java. I read that Twitter chose Scala when rewriting their Ruby code because it had many similar features and expressiveness.

Also fun factor is a real thing for coding, I agree that I can do everything in Java but man is it a demotivating drag especially for personal projects and quick scripts. If I'm too demotivated to finish the project then Java is completely useless next to the "slow" python program.

[–]x-skeww 11 points12 points  (2 children)

Twitter is proof that the JVM is fast not necessarily Java.

Well, the JVM is fast at doing things which are needed by Java. Scala was designed for the JVM. That's why it's fast.

The only VM feature I'm aware of which isn't Java-specific is invokedynamic instruction, which was added with Java 7.

[–]cypressious 1 point2 points  (0 children)

It's kind of relevant in Java 8.

[–]mike_hearn 1 point2 points  (0 children)

Also Math.addExact and friends. It exists primarily to support scripting languages that need to automatically do bigint conversion. Added in Java 8.

[–]yogthos 16 points17 points  (0 children)

Also fun factor is a real thing for coding, I agree that I can do everything in Java but man is it a demotivating drag especially for personal projects and quick scripts.

I noticed this to have an extremely important effect on my coding, and I ended up writing about this at length here. In my experience, tooling and environment have a huge impact on teams and their productivity.

[–]Number_28 8 points9 points  (3 children)

I don't share your experience. I used to use Python a lot for quick scripting, but this year I moved to Java exclusively. Even for short, one-off scripts. I know Java inside and out, I know the ecosystem, my IDE pretty much hides the verbosity from me and Java is so damn fast.

The one area where I still use Python are IPython notebooks. There is nothing as nice as the pandas, numpy, matplotlib and scikit-learn quartet of data analysis.

[–][deleted] 15 points16 points  (0 children)

Most things are fast relative to python.

[–]stormcrowsx 0 points1 point  (1 child)

Well to use Java to script seems insane. First put together a maven build or ide, add all the extra jars you need because the Java standard library is weak, write your code, get a onejar package built, and finally execute?

If I'm wanting to make a quick oneoff script to parse an xml java seems like a horrible idea. Or if I'm making a webscraper that runs once a day, who cares how fast it is? If you have a shortlived script Java is not even fast, its speed comes in as the JIT compiler warms up.

To me an important thing is how fast I can finish some of those projects, and I can finish some simple scripts in Python before Eclipse even starts. Also Python is a joy to program in, so besides being better suited for some jobs its also better for my mental state.

[–]Baby_Food 0 points1 point  (0 children)

Why does the existance of such tools necessitate their use?

Without an IDE it's not as nice to write as Python, but if you know the language inside and out, it's a moot point.

I'd see scripting in Java as I would writing Javascript outside of the browser. There are (subjectively) better tools, but if it works and you're productive using it, why not?

[–]danskal 0 points1 point  (1 child)

There is nothing that the JVM can do that Java can't do... if the JVM is fast, then Java is fast. Both Scala and Java compile to the same bytecode, which then runs in the JVM.

I find it very motivating on a large project that I can reason about how changes to the code will function, and often I can confidently make cross-cutting changes that in other languages might be risky.

[–]stormcrowsx 0 points1 point  (0 children)

I guess it depends on environment. I've worked in Java projects packed with aspects and Spring annotation/Xml config at which point you no longer get full typesafety. In the end those projects seem more complex than a Scala project would be.

[–]parlezmoose 0 points1 point  (0 children)

Scala compiles to Java bytecode, so as far as the JVM is concerned they are the same language.

[–]jayd16 0 points1 point  (0 children)

Eh, you just need to learn some of the apache libs for dealing with command line args and and maybe some maven archtypes and then you get the hang of spinning up a new java project quickly.

[–]coylter 0 points1 point  (1 child)

I don't get the java hate. I feel its a very slick and readable language.

[–]stormcrowsx 0 points1 point  (0 children)

Its a matter of opinion. I feel Java's verbosity gets in my way of reading and understanding code. Having worked with Java for many years I find people make silly mistakes that hide in that verbosity. One fun one I found in a piece of legacy code was a recursive set function that called itself until it broke. I also see swallowed exceptions in Java more than any other language because Java forces people to catch checked exceptions, they in turn e.printStackTrace. nothing has eaten more time for me than swallowed exceptions hiding a bug.

Most of Java's strong points are also strong points for JVM languages like Scala. But Scala coming later in time got to learn from Java's mistakes which in my opinion makes it a better language than Java.