when to choose java over scala in mixed scala/java projects [closed] - java

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
Context: I am a novice to JVM and trying to build an app using Scala.
I was wondering, in mixed language projects (Scala/Java), for example Apache Spark, Apache Kafka, when do people choose to use Java to write a module where they already have been using Scala so far to write other modules, i.e. why those parts are not written in Scala itself?
Basically what are some example scenarios?

If for whatever reason you need to define a native java enum. Scala 2 has no syntax for defining them.
If you need an API that can be used by java programmers and you want to guarantee that not a single Scala specific feature or compilation artifact (mangled names, MODULE$ fields on objects ...) leaks out.

Related

Does Kotlin provide any performance boosts? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Does Kotlin provide any performance boosts?
Is there any benchmarking?
Is Kotlin faster than Java?
I found this in the Kotlin website. https://kotlinlang.org/docs/reference/comparison-to-java.html
Talking about the language features but not performance.
Kotlin generates very similar bytecode to Java, so the performance of Kotlin code is in most cases the same as the performance of the equivalent Java code.
One way in which Kotlin can be faster than Java is inline functions. With inline functions, code using higher-order functions such as filter or map can be compiled to simple loop-based bytecode that doesn't create any objects or use any virtual calls (unlike Java code that uses the same type of functions).
Some benchmarks for Kotlin can be found here, here and here.

What parts of Java SE is NOT used in Android development? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
threads are not used, generics are not used.
Android uses only fraction of Java features, i know this, but what parts are NOT used?
p.s. this is not opinion type of question - i m asking about actual parts, i.e. specific answer, facts.
my opinion: threads are not used, generics are not used.
That's wrong. The whole java.util.concurrent package was ported up to java 1.6. And Generics are also full supported. What is not yet in, is the new java 1.8 features, like streams and lambda, and part of java 1.7, the new File.NIO 2
How about AWT and Swing? Android has it's own UI Framework.

Implementing a Language in Java [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm planning on designing and implementing my own programming language. Is it a good idea to build my language in Java and run it off of the JVM or would my language be faster if I wrote it in C and ran the code off of my own virtual machine?
Maybe you can write your compiler in Java and let it compile to Java byte code.
If you want to do this, you can have a look at the book "Compiler Construction" by Niklaus Wirth for the compiler part and use ASM(Java) to generate the bytecode.
But you should think, wether you really want to build a compiler - it is not very easy.

Guidelines for writing Scala API as wrapper over Java API [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I have java product with rich set of api. I want to write scala api as a wrapper over those java api. Are there any guidelines for the same. Please share your experience
This is a very vague question as others have noted, but I suppose there are some broad suggestions:
Use JavaConverters to translate Java collections to Scala collections.
Use Scala annotations to represent properties or characteristics represented by other means in Java. Examples of these include #deprecated, #throws, and #BeanProperty. #BeanProperty is especially useful if you want to use a library that specifically demands JavaBeans (i.e conforms to the specification).
If the Java code uses Spring, maybe look into Spring Scala if necessary. Or use more constructor-args. Or asInstanceOf to cast any beans you manually fetch from the context.
Build files. Perhaps you want to replace any Java-specific build mechanism with SBT. Or transform your Java-focused Gradle build file to be more Scala-focused. That kind of thing.
That's all I can think of. Hopefully others will point out other considerations I've missed.

What type of Java Project is Netflix-Graph [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
Java has various project types and the worse thing is that I'm a newbie in Java.
Netflix hosts a open-source project on GitHub: github.com/Netflix/netflix-graph/.
I want to know which kind/type of project it is ? Console, EE, or ....?
Also, how can such projects be created or any reference to better analogy of various project types ?
It is a library which you can include in your Java project to work with graphs. As such, it is similar in "type" as a JSON parser or an HTTP client library.
It is not an application that you run by itself.
It does not seem to have any special dependencies, so that you can probably use it in all kinds of Java applications, most likely even on Android.

Categories