Why, compared to performance issues, why is Java still selected over Groovy / JRuby, etc.?

[This is an empirical state of the art question: I am not asking if Java is cooler or less cool than dynamic languages ​​that run in the JVM.]

Aside from cases where productivity is a major decision-making factor, have companies / developers still willingly chosen Java over Groovy, JRuby, or Jython?

Edit: If the answer is yes, why?

Personal note . The reason I ask is because, although I do a subset of my professional work in Ruby (and not JRuby, for now), I use Java in my personal projects. Although I wrote non-trivial applications in Groovy, I prefer Java, but I wonder if I should just get around it and do everything in Groovy. I like Java, because I feel that typing statically saves me time and refactoring helps. (No, I am not familiar with Scala.) However, I feel that this very empirical question on the topic can inform my decision.

+4
source share
6 answers

non-statically typed languages ​​do not "scale well" in the sense of service. Up to several tens of thousands of lines of code, they are supported. The past is that they simply put more effort into maintaining, re-factoring or updating. This applies to any of the non-static typed languages: Perl, Python, Groovy, Ruby, etc. There are simply no tools for working with half a million lines of Python code against the same number of lines of code in C / C ++ / Java. Now it’s true that Python makes up 1/3 to 1/5 the number of lines of code as an equivalent Java program. Thus, it will never be apples and oranges, but there is a cut-off point at which the number of lines of code in a non-stationary language will reduce the return on service. And everyone knows that maintenance is where the true cost of a software project has always been.

+7
source

Static typing is still important.

Despite the fact that it has been argued over and over again that proponents of the dynamic approach say that problems arising from dynamic input can be reduced (or even eliminated) with sufficient unit tests.

I do not want to argue whether this argument is correct, so I assume that it is for this answer.

In this case, there is another problem: many stores do not have procedures / know-how / rules / controls to obtain a sufficient number of high-quality unit tests.

And if I need to choose between dynamically typed code without unit tests and statically typed code without unit tests, I choose statically typed code every day.

A similar problem exists with double dispatch :

In Groovy, method calls are sent based on the actual types of the arguments at run time (which is almost necessary because the static type is unknown and / or Object most of the time). This means that there is no reliable way to find out which method is called at any given point in the code when faced with extensible class hierarchies.

Any code that calls a method with signature foo(String) most of the time can unexpectedly call foo(Integer) or foo(SomethingElseEntirely) , depending only on the actual type of the argument at runtime. In Java, which can never happen, since the exact signature of the method that will be called is determined at compile time.

Like other "dynamic" language functions, dual dispatching is sometimes a very useful tool, and its absence can lead to some ugly constructions in Java, but it has its own cost, because it is even more difficult to read, understand, and the reason for the code.

+7
source

Apart from cases where productivity is the main decision-making factor, have companies / developers still willingly chosen Java over Groovy, JRuby, or JPython?

Yes, and I believe that the main reason is the inertia of either the developer or the company:

  • Company : existing investments in Java (in terms of staff skills and infrastructure), the risks of change are perceived as outweighing the benefits.
  • Developer : There are many Java jobs, so why learn another language?

The lack of available resources is probably another reason, although it is something like a chicken and egg problem (or a Mexican standoff, or a self-fulfilling prophecy, or something else). I believe that there are many companies that look at Groovy, Jython, etc., but wait for them to become more widely accepted before taking the decisive step. Obviously, postponing self-acceptance, they exacerbate this lack of resources.

Personal address

Last year, I worked as a Groovy / Grails developer. I recently changed jobs, and now I'm working as a Java 1.4 developer and (compared to Groovy programming), it's as enjoyable as tearing my eyes out with a rusty spoon.

Static typing is great in that it facilitates compile-time checking and code analysis tools such as FindBugs, but does not compensate for the huge amount of (template) code that is required to perform the simplest tasks when writing Java (in particular, if you use the version earlier 1.5).

+4
source

Yes, obviously.

Why are companies still eagerly using Java?

Because companies are conservative in nature. They do not change technology because they are cool or even groovy. They are reluctant to change when there is a reasonable reason for this. Early adopters pay very heavy fines for being early followers.

Edit: this is not “inertia” in a derogatory sense, as in “there is no reason to avoid change, except to resist change,” but in the sense of discretion. The right thing is that companies do not give up what works until there is something that can be better.

And not that "makes developers happy because it's cool" is better, but in terms of faster and more reliable satisfaction of any requirements for business development in the organization.

Java offers:

  • A large base of trained experienced developers. It’s hard enough to find people who can do software development well without choosing a language that hasn’t been so long. And teaching people in a new language is expensive, both time and money.

  • Recognition of corporate identity and easily proven experience of successful projects. This is not to be taunted: if I talk about governance from above, I start a project in some new groovy language that they have never heard of, I have to train them, and they will evaluate it as a risk. With any “installed” language, I can skip this step.

  • Well-established, mature support tools and third-party support.

These advantages are superimposed on any comparison between a long-established language and a new one, not just Java and your list. I expect that one day, Groovy, et al., Will be an established language, and people will ask the same question about a newer, more brilliant language. This is a cycle. As it was longer than I was in business.

+4
source

I can tell you what is happening in my company. Our current application runs in java, but we started the transition to grails / groovy, and this is likely to become the platform for the next generation of our products.

+2
source

Since you are asking an empirical question, and I suggest looking for empirical answers:

Aside from cases where productivity is a major decision-making factor, have companies / developers still willingly chosen Java over Groovy, JRuby, or JPython?

Yes.

I don’t think there is anything to say.

+1
source

Source: https://habr.com/ru/post/1309311/


All Articles