danger/u/
This thread is permanently archived
Java or C++

| Been learning both because Computing College Courses.

Been wondering what is the more worth while langage to learn in the long as I just got an Intership w/ SAP CoE in Dublin, Ireland.

I could use some insight if any of you techg/u/rls know much about em.


| C++ is more efficient.
Java is easier to write and to use for multi-plateform programs, but not as much as other languages.

So if you don't become crazy when coding in C++ and are able to produce clean code (which would be surprising), go for it. Else go for Java, this way at least someone might be able to fix your code later.


| Use Haskell or LISP instead if you enjoy the art of computer science.


| >>426487
>C++ is more efficient
>Java is easier to write
Nah, I can't agree with you here. Java can be efficient too. The difference to C++ is, that it allows more inefficient code to unexperienced developers, while things does work hardly with unexperienced developers^^
>and to use for multi-plateform programs
As long you have the proper runtime environment on this platform, wich is the equivalent to the compiler of c++. I can write c++ code and compile it for all platforms too.


| >>426599
>while things does work hardly with unexperienced developers
with c++ ;-)


| >>426599
Considering that most languages allow you to use lower-level commands, you can always be relatively fast. But the virtual environment that Java creates will always slow down the program, and/or consume more ram.
I'm not really a big fan of C++ nor Java so I can't really tell about environments. All I know is that for both of them, setting up the environment is often a pain, from my experience.
Things like Python are my cup of tea.


| Well your cup of tea is quite a slow one compared to even Java that you mentioned.

C++ is a dog of readability. Java is a better choice for both readability and code reuse. It needs more resources than c++ but if you are in that spot where this becomes important, you want to go neither C++ nor Java, but C.


| >>426483
if you are set on industry then you're better off getting your head around OO principles, theory, and enterprise IDE tooling. whatever shop you end up at first will teach you what you need.

captcha: gary dross pussy


| >>426673
Python isn't slow, some implementation are. There's a java implementation for example that performs as well as Java, and a C++ implementation that does as well as C++.
And python is better than Java at both readability and reusability.
But indeed, the more important the thing you are doing, the lower the programming language's level you use will be.

##Dev:Lain##

| >>426599
>Java can be efficent too

Does java have std::pmr and monotonic allocators? Does java have std::memory_order_relaxed? Can you do _mm_prefetch() in java?

Almost all language features that are critical to performance are missing from the java language and standard library. And that's ignoring the overhead costs of the JIT and garbage collector.

If you write a Java program that uses 7GB of memory on a computer with 4GB of memory, and the garbage collector decides to run, guess what, your whole program freezes while 3GB of memory is swapped between the disk and RAM, then your program starts running, and all 3GB are immediately swapped back. Java is not suitable for many performance-critical use cases.


| >>426809
Absolutely BTFO'd


| >>426809
If your program needs more than 7G of memory, the issue may lay in the concept of your program. How much RAM do you think you would you save by using C++?
There are many ways to avoid that the JIT and garbage collector costs scale with increasing requirements of your program.
There even are things beeing faster in java than in c++ like the initialization of objects.
I think Java suffers from beeing heavy advertised for beginners, while c++ benefits from it's 1337 status.

##Dev:Lain##

| >>426869
Obviously less memory usage is better, but for large problems, 7gb may be unavoidable.

The only reason this myth that Java is "faster" at initializing objects is because Eden is a monotonic allocator. But Java has a compacting garbage collector. So you pay for that speed in the copying of your object to a survivor space and later to old object space. C++ monotonic allocators are even faster than Java's Eden.

Also, there are no ways to "work around" the inherent flaws of the garbage collector. I don't know where that myth keeps coming from.

Total number of posts: 13, last modified on: Fri Jan 1 00:00:00 1541293115

This thread is permanently archived