Advertisement

Is Java struggling?

Started by April 16, 2012 06:44 PM
21 comments, last by Dmytry 12 years, 5 months ago

[quote name='Stroppy Katamari' timestamp='1337858803' post='4942864']
[quote name='Krohm' timestamp='1334645733' post='4932042']
From Java... to C++?
Portability is going to be seriously fun.
I still recall last time I shared some work with a "native" Java programmer. No delete. Never. That was good. The solution? Use a garbage collected language. Ok...
Funnily, the absence of deletes in C++ code would normally indicate the code is very high quality, and is not written by someone stuck in C mindset.[/quote]
Good revive.

The runtime surely agrees with you. Running out of address space in less than half an hour (IA32) is surely a very good quality indicator. Of course we can hide ourself behind nice concepts and terms it does not change reality: in the end someone must use delete. Maybe a library, maybe some compiler construct but someone has to use it. It's not like memory releases don't happen just because we don't see them in code... but again I trust the runtime and the runtime appeared to not like it.[/quote]I wasn't criticizing you, no need to get defensive. I literally think it's funny that your "Java guy", who leaks all the memory he touches, has this thing (no deletes) in common with very good C++ coders.
It would seem to me that C++ is struggling, if they couldn't find any junior C++ programmers, and had to train Java.

About garbage collection, it's amazing as long as you don't care about performance. I find myself too often recycling old objects on Android for performance (which is 10 times more "messy" then using deletes).

Another problem is that you can't allocate simple objects on the stack (vector Math anymone?).

But then again:
1. Java has amazing free tools
2. If you don't really care about performance Garbage Collection is the bomb.

My Oculus Rift Game: RaiderV

My Android VR games: Time-Rider& Dozer Driver

My browser game: Vitrage - A game of stained glass

My android games : Enemies of the Crown & Killer Bees

Advertisement
Well, in my experience managing memory via smart pointers and pools is not such a big part of a project, as to make full 'garbage collection' an enormous bonus of some kind, especially as one can still leak memory (in the sense of keeping allocated the items that will never really be accessed) with the garbage collection. Meanwhile, allocating objects within other objects, or on stack, is a huge performance bonus. Though GC languages can do that with sufficiently smart implementation.

It's been ages since I did any java programming: how do final class members which are classes work? Do they get allocated as part of the class where they are members? My understanding is that nowadays you will have objects allocated on stack and as part of other objects, if you are careful.

edit: To summarize, in general my opinion is that none of the languages actually shifts any notable cognitive burden off programmer (beyond the high level vs asm), consequently they are all very very close to equal. To shift the cognitive burden off programmer would require some sort of automatic problem solving which would require enormous amounts of computational power and databases (think Wolfram Alpha / Watson hybrid, but a lot more advanced).

This topic is closed to new replies.

Advertisement