Moving from Java to C++

Programming, for all ages and all languages.
User avatar
Colonel Kernel
Member
Member
Posts: 1437
Joined: Tue Oct 17, 2006 6:06 pm
Location: Vancouver, BC, Canada
Contact:

Re: Moving from Java to C++

Post by Colonel Kernel »

MessiahAndrw wrote:In my experience in the video game industry C++ is used near universally in game frameworks, game code, and related development tools.
True, but games are only one class of applications. :)
I'm all welcome for change, but since C++ has established itself I don't see it moving for a quite a long time.
For some games, portability to different consoles is also important, which is another reason C++ hangs on.
I don't know of what general application development or systems programming is in general, but I'm guessing it's the same scenario.
I was talking about "general application development" in my previous post. :) As for systems programming, it's a totally different scenario. I think C (not C++) is still #1 there.

In terms of "general applications", the most common/popular ones today fall into two categories: desktop apps running on Windows (can't argue with market share), and web apps that everyone uses every day. C++ is quickly dying in the former category, and disappeared almost a decade ago in the latter.
Top three reasons why my OS project died:
  1. Too much overtime at work
  2. Got married
  3. My brain got stuck in an infinite loop while trying to design the memory manager
Don't let this happen to you!
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Moving from Java to C++

Post by Solar »

Guys, they've been talking about the death of C++ for the last ten years or so...
Every good solution is obvious once you've found it.
DeletedAccount
Member
Member
Posts: 566
Joined: Tue Jun 20, 2006 9:17 am

Re: Moving from Java to C++

Post by DeletedAccount »

It will live at least as long as i live .... But Colonel can be right ,There are reasons which we both know , but would like to keep it a secret .

Regards
Shrek
Last edited by DeletedAccount on Tue Jan 27, 2009 10:43 am, edited 1 time in total.
User avatar
stephenj
Member
Member
Posts: 140
Joined: Wed Jul 23, 2008 1:37 am
Location: Canada

Re: Moving from Java to C++

Post by stephenj »

I think there are two forms of death for a technology.

The first kind is the obvious, when legacy applications need to be ported. The second kind is far less apparent, but none the less important, when new projects stop using said technology (I suppose this is more about declining rather than dying).

The first kind of death is pretty rare in languages, and even some platforms. I know people who are still COBOL programmers. The theory is that when the last of them retire the need to port will increase. But it can take a long time to kill old code sitting on servers. I've maintained C older than myself (and the ANSI '88 standard). I've seen FORTRAN code older than the '77 standard still in use, and I've heard of assembly from the '60s still kicking around (with barely anyone available to maintain it).

As long as there are programmers more comfortable with C++ than any other language, there will still be new apps written in it. So we probably have another thirty years of new C++ projects, easily. Meaning that the second form of death is going to take a long time.

So the big question is, how many young C++ programmers are cropping up? In my experience, not as many as in the previous two decades. Which eventually leads us to point two, which in turn takes us to point one. But C++ is going to live, in some capacity, for many decades to come.

To try and make my comments more inline with the original topic, I firmly believe that Java will be the COBOL of the early 21st century... And if my experience with older COBOL programmers has taught me anything, it is that you don't want to be in that dead sea 40 years from now (I just turned 25, and I may still be in the field when I'm 65).
User avatar
Colonel Kernel
Member
Member
Posts: 1437
Joined: Tue Oct 17, 2006 6:06 pm
Location: Vancouver, BC, Canada
Contact:

Re: Moving from Java to C++

Post by Colonel Kernel »

I said C++ was dying, not dead. ;) Fortran has been dying for years now...
Top three reasons why my OS project died:
  1. Too much overtime at work
  2. Got married
  3. My brain got stuck in an infinite loop while trying to design the memory manager
Don't let this happen to you!
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: Moving from Java to C++

Post by Love4Boobies »

I find it a bit ackward that everyone's talking about the death of C++ but (AFAIK) no one has ever mentioned the death of C. Why's that?
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
User avatar
Colonel Kernel
Member
Member
Posts: 1437
Joined: Tue Oct 17, 2006 6:06 pm
Location: Vancouver, BC, Canada
Contact:

Re: Moving from Java to C++

Post by Colonel Kernel »

Love4Boobies wrote:I find it a bit ackward that everyone's talking about the death of C++ but (AFAIK) no one has ever mentioned the death of C. Why's that?
Because C is already dead as far as application programming is concerned. :mrgreen: At the same time, IMO it enjoys more popularity in systems programming than C++ because it's simpler and more portable.
Top three reasons why my OS project died:
  1. Too much overtime at work
  2. Got married
  3. My brain got stuck in an infinite loop while trying to design the memory manager
Don't let this happen to you!
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: Moving from Java to C++

Post by Love4Boobies »

It's true that it's simpler (although that can sometimes work against it) and there are more people using it in systems programming, however I see no reason for considering C++ less portable than C (I might be wrong, though).
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
User avatar
stephenj
Member
Member
Posts: 140
Joined: Wed Jul 23, 2008 1:37 am
Location: Canada

Re: Moving from Java to C++

Post by stephenj »

Love4Boobies wrote:I find it a bit ackward that everyone's talking about the death of C++ but (AFAIK) no one has ever mentioned the death of C. Why's that?
Because C is basically a portable abstraction of assembly. That is, for the most part, it's niche, and has been since the 1970s.

C++ is a much more complex language. Over the years, I've heard it be defended as a suitable candidate for everything, and by being everything to everyone, C++ is losing out to domain specific languages. Resulting in a loss of mindshare over the past two decades.

CK, you beat me to it!
User avatar
Colonel Kernel
Member
Member
Posts: 1437
Joined: Tue Oct 17, 2006 6:06 pm
Location: Vancouver, BC, Canada
Contact:

Re: Moving from Java to C++

Post by Colonel Kernel »

Love4Boobies wrote:It's true that it's simpler (although that can sometimes work against it) and there are more people using it in systems programming, however I see no reason for considering C++ less portable than C (I might be wrong, though).
You've obviously never had to write C++ code that needs to be portable to five different *nix flavours spanning versions as much as ten years old. :P

C++ is kinda like make... It's hard to write a portable makefile, unless you use a portable make. :) It's easy to write portable C++ code, if you're using a portable C++ compiler (gcc). ;)
Top three reasons why my OS project died:
  1. Too much overtime at work
  2. Got married
  3. My brain got stuck in an infinite loop while trying to design the memory manager
Don't let this happen to you!
me
Posts: 6
Joined: Tue Jan 27, 2009 11:17 am

Re: Moving from Java to C++

Post by me »

just out of curiosity , what would be the java /C# coding style of a C++ coder ? Where should a C++ coder be careful ( consider someone who is more inclined towards C , than C++ ) ? .
You can always spot a C++ guy a mile away if you get a chance to look at their for loops (if they were even mildly experienced with C++). They'll use preincrement :)

They also may use for loops where a foreach loop would suffice, atleast in the beginning.

Not that I've ever done either of these things in C# :shock:


on the C++ topic, I claim C++ is still the best language for developing desktop applications. The applications tend to be snappier, and that's a big deal for the user experience. There are counter examples to this (Paint.Net comes to mind), but in general I think this still holds true.

Server's can generally afford to be a little more wasteful of memory (and to a lesser extend CPU cycles) because the applications tend to be I/O bound, and they tend to scale by adding more machines. Not so for desktop applications.

OTOH I'm biased :) I love C++ and no I won't apologize for that :P
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Moving from Java to C++

Post by Solar »

me wrote:You can always spot a C++ guy a mile away if you get a chance to look at their for loops (if they were even mildly experienced with C++). They'll use preincrement :)
Yes! :shock: You're right, of course...

(For those not knowing what this is about: Postfix increment returns the value of the variable before the increment. While that's trivial with e.g. a size_t or an int, it means construction of a temporary object if it's a class. Hence, C++ coders consider it good practice to use preincrement, always, just to be safe.)
They also may use for loops where a foreach loop would suffice, atleast in the beginning.
ACK, again.
Every good solution is obvious once you've found it.
JohnnyTheDon
Member
Member
Posts: 524
Joined: Sun Nov 09, 2008 2:55 am
Location: Pennsylvania, USA

Re: Moving from Java to C++

Post by JohnnyTheDon »

One place where I think C++ and other 'native' languages will always be better than Java, etc. is high performance applications. Someone previously mentioned games programming, but stuff like large scale database servers (or any other server for that matter) probably won't move to Java or similar languages because of performance issues. The language that will finally kill C++ in these fields will probably

1. Use cross-platform assembly (.NET, LLVM, etc.), possibly with JIT capabilities
2. Have a standard library that does most platform specific tasks that you would ever need to do
3. Be the same or comparable in performance benchmarks
4. Retain the power of C++ with pointers and such
5. Run on all/most platforms

For application programming, I think this would be the most likely to remove C++ from the picture. M$'s .NET sort of did this, but its support for other operating systems is all third-party (Mono) and it completely fails on # 4.
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: Moving from Java to C++

Post by Love4Boobies »

JohnnyTheDon wrote:4. Retain the power of C++ with pointers and such
You're not talking about super-performant applications here anymore. There's no need to cope with pointers, they increase probability for bugs - let's face it, most programmers are sloppy and they want tools that will help them as much as possible. Programming should be as easy as possible and as accessible as possible to everyone.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
JohnnyTheDon
Member
Member
Posts: 524
Joined: Sun Nov 09, 2008 2:55 am
Location: Pennsylvania, USA

Re: Moving from Java to C++

Post by JohnnyTheDon »

Love4Boobies wrote:
JohnnyTheDon wrote:4. Retain the power of C++ with pointers and such
You're not talking about super-performant applications here anymore. There's no need to cope with pointers, they increase probability for bugs
It is still nice to have them sometimes. This is probably the least important of the 5 I listed to be honest.
Post Reply