The great battle. Java VS C++
Craig`
2008-12-14 04:28:06
Please note this thread is in this sub forum because I cannot access the programming ones at this moment in time.
I have knowledge of C++ and to be honest I really like it, just when I looked into GUI's WIN32 to be precise that freaked me out, that's when I came across Processing (.org) and with Processing you can draw shapes to the screen with ease.. This is were Java comes in, Processing is made with Java so I'd have to learn Java to learn Processing..
But there's problems..
C++ is faster and in my opinion a more professional language, though I do not want to spend hours on a project that could take a matter of minutes in Processing..
Also Processing can be embedded into web pages, unlike C++.
Please say which one you think and WHY.
I don't want "Bc0z 1 54Y 50" I want logical and explained answers please, this may be the start of my career..
~ Mathematics.
Wizzup?
2008-12-14 04:32:56
Java and C++ both have their advantages. But in the end I think C++ wins. (Although C is better)
You can also make the GUI with Java (processing) and the rest with C++, using the JNI.
I don't like Java's garbage collector. But java definitely has possibilities.
Craig`
2008-12-14 05:23:47
Thank you, but why would you think C was better than C++?
Most argue the other way around?
Buckleyindahouse
2008-12-14 07:05:51
From: Mathematics
Thank you, but why would you think C was better than C++?
Most argue the other way around?
Just for future reference, please make your font bigger.
Capricorn
2008-12-14 07:24:05
No programming language is better then the other. Each has their own weaknesses and strengths.
And about starting your career, I suggest you ask yourself what you want to do. Then you research those jobs and see what languages they require. If they require knowledge of C++, maybe C++ is the best choice.
boberman
2008-12-14 09:03:22
Honestly, this question really should be C# vs Java. As those two languages are the most similar. When you start comparing two fairly dissimilar languages your answer almost immediately becomes "It depends on what you are trying to do."
C++ is good because it has a lot of high level and low level features. It can be very fast and easier to program then other low level languages (fortran). Wizzup, the day when C was almost always faster then C++ is over, a good C++ compiler will optimize C++ just as much as it will C.
Java is good because it is stupidly easy to make a cross platform application. It is also easier to make things like window, buttons, ect. Java has a fairly fast execution time (not as fast as C++). For most, computers have gotten sufficiently fast that any speed loss is a moot point compared to the development speed gain.
If I was to recommend learning a language, I would say go with C# (the other option) Most developers (at least in the US) use this as their main language. Few actually get down to the nitty gritty of the hardware stuff. With C# you enjoy things like automatic garbage collection, a huge API (the .Net architecture) filled with many functions and features, and lots of support from the MSDN (One of the BEST API documentations ever written. Seriously, you just don't get much better then the MSDN)
Yakman
2008-12-14 09:53:22
really? my experiance with MSDN is it being sometimes really vague and unclear, and doesnt link together very well.
i much prefer javadocs to msdn, they have things which msdn simply does not.
like the "use" and "tree" thing, also you can easily make your own javadocs with the javadoc tool which is included by default with the java SDK.
as far as i know you cant make your own msdn.
with java you also get automatic garbage collection and a huge API.
also, in some cases java's JIT compiler can beat c++ in speed. (some people dont believe this because it seems counter-intuitive, but is true i assure you)
also boberman, maybe wizzup wasnt thinking of speed when he said c > c++.
but the main reason i dont use c# is beacuse it doesnt work on my operating system. (mono has been around for 5 years and acheived not very much, clearly microsoft wants it to fail)
slewx
2008-12-14 12:57:06
This entire situation is like micro$oft(vista, xp) vs Linux(distros), it will never end as both have there pros and cons. Now the reason why(truthfully) think most perfer c++ above java is because:
1- Micro$oft made it(so it must be better… hahaha)
2- It gets mass attention
Mass attention kills anything, which IMO it did for c++. ((Also it was killed because micro$oft distributes it))
Markus
2008-12-14 13:06:36
Wizzup?
2008-12-14 13:13:03
From: Markus
http://www.idiom.com/~zilla/Computer/javaCbenchmark.html
Do note that gcc isn't the best C Compiler when it comes to optimizations.
A G E N T
2008-12-14 15:08:00
From: slewx
Now the reason why(truthfully) think most perfer c++ above java is because:
1- Micro$oft made it(so it must be better… hahaha)
Microsoft makes and distributes C# and Visual C++, both of which are their own flavours based on the .NET framework/Windows API. C++ was made by a fellow named Bjarne Stroustrup in 1979, while Microsoft was still busy writing Altair BASIC -
http://upload.wikimedia.org/wikipedia/commons/9/9a/Altair_BASIC_Paper_Tape.jpg .
boberman
2008-12-14 15:35:42
From: Yakman
really? my experiance with MSDN is it being sometimes really vague and unclear, and doesnt link together very well.
i much prefer javadocs to msdn, they have things which msdn simply does not.
like the "use" and "tree" thing, also you can easily make your own javadocs with the javadoc tool which is included by default with the java SDK.
as far as i know you cant make your own msdn.
with java you also get automatic garbage collection and a huge API.
also, in some cases java's JIT compiler can beat c++ in speed. (some people dont believe this because it seems counter-intuitive, but is true i assure you)
also boberman, maybe wizzup wasnt thinking of speed when he said c > c++.
but the main reason i dont use c# is beacuse it doesnt work on my operating system. (mono has been around for 5 years and acheived not very much, clearly microsoft wants it to fail)
Ok, I've never used javadocs, so I couldn't say if MSDN is better or worse then them. However, I have used man pages. In some areas, a function or procedure has been documented pretty well, but in others its a PITA to figure things out.
Don't believe me? See how long it takes you to figure out how to move the mouse in Linux or even get a pixel color on the screen. Not very easy, XLib documentation is very patchy in a lot of ways.
As for the speed thing, if not speed, what else is there? For the average programmer C++ can do everything that C can and more. There are some changes but most will never notice them. OOP rules.
slewx
2008-12-14 21:13:39
From: A G E N T
Microsoft makes and distributes C# and Visual C++, both of which are their own flavours based on the .NET framework/Windows API. C++ was made by a fellow named Bjarne Stroustrup in 1979, while Microsoft was still busy writing Altair BASIC - http://upload.wikimedia.org/wikipedia/commons/9/9a/Altair_BASIC_Paper_Tape.jpg .
If I remember correct micro$oft had a contract with sun to publish java under there visual studio until they went over board and was sued by sun. They where forced to stop publishing it. They called it j# I believe. That's what I was getting at.
Wizzup?
2008-12-15 06:39:38
From: boberman
Ok, I've never used javadocs, so I couldn't say if MSDN is better or worse then them. However, I have used man pages. In some areas, a function or procedure has been documented pretty well, but in others its a PITA to figure things out.
Don't believe me? See how long it takes you to figure out how to move the mouse in Linux or even get a pixel color on the screen. Not very easy, XLib documentation is very patchy in a lot of ways.
As for the speed thing, if not speed, what else is there? For the average programmer C++ can do everything that C can and more. There are some changes but most will never notice them. OOP rules.
The thing is, C is so low level than you can do anything with that you can do with C++, it might just take more code in C. However, you simply have more control over your code in C, which is why I like it.
boberman
2008-12-15 11:19:07
From: Wizzup?
The thing is, C is so low level than you can do anything with that you can do with C++, it might just take more code in C. However, you simply have more control over your code in C, which is why I like it.
Thats the thing, You can't do anything in C that you can do in C++. Ever tryed to make a constructor/deestructor in C? Give it a whirl with your Class objects. On the other hand, you CAN do anything in C++ that you can do in C, with exactly the same code. You have just as much control over your code with C++ as you do with C.
C++ might as well be called C with OOP support.
Yakman
2008-12-15 11:30:58
i think what wizzup means is how c++ is too safe.
for a start i think it forces annoying casting onto you,
i know what windows BYTE* is exactly the same char*, c++ forces you to cast between the two, but c does not, and it makes for much nicer, cleaner and easier programming in some cases.
Wizzup?
2008-12-15 11:39:34
From: boberman
Thats the thing, You can't do anything in C that you can do in C++. Ever tryed to make a constructor/deestructor in C? Give it a whirl with your Class objects. On the other hand, you CAN do anything in C++ that you can do in C, with exactly the same code. You have just as much control over your code with C++ as you do with C.
C++ might as well be called C with OOP support.
You can also make OOP with C, just not if you want to use actual constructor keywords.
boberman
2008-12-15 12:05:42
From: Wizzup?
You can also make OOP with C, just not if you want to use actual constructor keywords.
There are no constructor keywords in C. (constructor is the method, not a keyword, used to setup an object, destructor is the method to destroy an object. C has neither. If you us a struct for your objects you have to explicitly create and destroy the object, the object can't take care of that on its own)
Wizzup?
2008-12-15 13:41:09
From: boberman
There are no constructor keywords in C. (constructor is the method, not a keyword, used to setup an object, destructor is the method to destroy an object. C has neither. If you us a struct for your objects you have to explicitly create and destroy the object, the object can't take care of that on its own)
That's what I said. :)
boberman
2008-12-15 15:38:59
From: Wizzup?
That's what I said. :)
I should have said C++. You can't make a constructor for C. (C++ doesn't use keywords per say to make their constructors.)
Wizzup?
2008-12-15 18:21:19
From: boberman
I should have said C++. You can't make a constructor for C. (C++ doesn't use keywords per say to make their constructors.)
Which is why I said
From: Wizzup?
You can also make OOP with C, just not if you want to use actual constructor keywords.
:)
Craig`
2008-12-16 02:24:30
Me and my friend have decided to learn C then C++.
Most people don't like that approach but the heck with it.
~ Mathematics.
boberman
2008-12-16 06:18:56
From: Mathematics
Me and my friend have decided to learn C then C++.
Most people don't like that approach but the heck with it.
~ Mathematics.
Well, the only reason I would disagree with that approach is that if you end goal is to learn C++, then you are waisting time with C.
Just make sure you are actually learning C and not a C++/hybrid. The way you tell is this, if you are including <string>, <vector>, <iostream>, <fstream>, <sstream> or anything else that has a stream in it, you are using C++. All of those libraries use objects to make them work better. (What that means is no using cout, string, vector, fstream, ect)
For C, the libraries are <stdc.h>, <stdioc.h>, ect (I'm a little fuzzy on them as I don't use them very often).
Basically, you use commands like printf, getf, puts, ect. Just watch out for buffer overflows, it will bit you hard if you aren't careful (just ask microsoft)
Craig`
2008-12-16 12:26:51
Yeah thanks, well me and my friend are both getting new PC's at Christmas so will start our C journey there.
At the moment he was no programming experience but is eager to learn, I can do loops, declarations/initializations that type of beginner things.
Thanks all.
~ Mathematics.
n3ss3s
2011-04-17 21:24:29
I've been messing around with C# for a while now and the msdn library is quite convinient, except for the fact that in some cases you'll run into a runtime exception which has absolutely no documentation, happens to a shitload of people with a different situation for each of them, making you go backwards and change some aspect of your program to go around it. Happened to me and I was barely able to avoid the straitjacket.
Maybe a bit off topic but boberman brought it up so…
i luffs yeww
2011-04-17 21:48:56
By the way, more topics like this should happen. :p Brilliant discussion topic, really.
I see absolutely NO situation where Java should ever be used over another language (e.g., C++), except if your purpose is very specifically aimed toward a Java game (RS), and even then, I wouldn't use Java still.
Also, C# is fine I suppose. I have nothing much against it, other than that Microsoft tries to make everyone use a lame Windows compiler and lame libraries. It is a pretty general purpose language though, which is nice (I've used it for wp7-related development and also just general computing stuff).
C++ > C, also.
Smartzkid
2011-04-17 23:17:46
IMHO, C# for frontend code, C++ for backend code.
C# gives you WPF, Windows Forms, GTK, and more, while C++ gives you lots of flexibility for optimization.
C is good to know, especially if you want to work with embedded systems some day.
Wizzup?
2011-04-18 10:42:01
From: Smartzkid
IMHO, C# for frontend code, C++ for backend code.
C# gives you WPF, Windows Forms, GTK, and more, while C++ gives you lots of flexibility for optimization.
C is good to know, especially if you want to work with embedded systems some day.
Uh. You're once again only talking about Windows. C# is not an option on other platforms than Microsoft Windows™©. Mono just sucks. Aside from it being heavily patent encumbered and Microsoft being able to terminate support for it on platforms at any time, it simple doesn't offer any serious advantage over other languages. If you want to write proper GUI's, why not use Qt? Python and C++ both have very good Qt bindings. I don't see why you'd want to do that with .NET.
I don't think boberman visits the forums these days, but for future reference: I find man pages to be more than satisfying. I used them to write the Simba Linux base, no problems there. On the other hand, I could hardly make sense of the Microsoft documentation, but perhaps that's just because the Win32 API is one of the worst and widely used API's in existence. It has grown so old and it is so encumbered with compatibility… At least GNU/Linux dares to break compatibility.
Echo_
2011-04-18 12:40:26
The gravedig was worth it, I love this topic.
I use C# instead of Java for applications that require a lot of GUI development, I have no problems with the cross platform issue because I have Windows :p Other than that, I use Java.
C is great though, if you learn C then you can use that knowledge and have a good grasp on most programming languages used today.
n3ss3s
2011-04-18 17:25:11
If I get some input on this in this thread I'll start another - what do people use to make the aesthetic kind of GUIs? I know you can use regions etc, but I'm pretty sure they use some sort of a 3rd party tool? (Highly doubt it's just a crapton of photoshop and mouse events)
Now with this I mean stuff like the steam interface and similar, "official" stuff…
Smartzkid
2011-04-18 18:38:40
From: Wizzup?
Uh. You're once again only talking about Windows. C# is not an option on other platforms than Microsoft Windows™©. Mono just sucks. Aside from it being heavily patent encumbered and Microsoft being able to terminate support for it on platforms at any time, it simple doesn't offer any serious advantage over other languages. If you want to write proper GUI's, why not use Qt? Python and C++ both have very good Qt bindings. I don't see why you'd want to do that with .NET.
If you code the backend in C++, there's nothing to stop you from writing a frontend for windows in C# and a separate linux frontend in Qt/GTK/other.
Best of both worlds.
Craig`
2011-04-18 19:17:53
lol at my younger self.
i luffs yeww
2011-04-18 19:25:45
From: Craig`
lol at my younger self.
go on..
Nose Smasher
2011-04-18 22:47:24
Any info on "Processing"(.org)? One of my buddies is playing around with it and is asking for my help, is it even worth it to learn "Processing"?
-This is the only thread where it's mentioned… :p
theheretic
2011-04-24 09:23:15
I think its silly to compare the two. People have a tendency to try and compare programing languages when really, they have different uses. Would I write a website with c++ and cgi? Hell no, that is the job of PHP, PHP is meant to do web site back end tasks and be used as a templating engine. Its a case of apples and oranges.
But people will endlessly beat the horse :duh:
nielsie95
2011-04-24 09:52:13
From: Nose Smasher
Any info on "Processing"(.org)? One of my buddies is playing around with it and is asking for my help, is it even worth it to learn "Processing"?
-This is the only thread where it's mentioned… :p
It's worth learning if you're going to use it for something that it's meant to do :p
HyperSecret
2011-04-24 13:03:56
From: Nose Smasher
Any info on "Processing"(.org)? One of my buddies is playing around with it and is asking for my help, is it even worth it to learn "Processing"?
-This is the only thread where it's mentioned… :p
I am doing a project where I have to use micro-controllers and the language you upload to the micro-controller is written in processing. It eventually gets translated into C and compiles with the gcc compiler, then uploaded to the micro-controller.
Wizzup?
2011-04-24 14:02:06
From: Nose Smasher
Any info on "Processing"(.org)? One of my buddies is playing around with it and is asking for my help, is it even worth it to learn "Processing"?
-This is the only thread where it's mentioned… :p
We used it at the university for some classes, but we've since dropped it for Python.
i luffs yeww
2011-04-24 15:25:42
From: theheretic
I think its silly to compare the two. People have a tendency to try and compare programing languages when really, they have different uses. Would I write a website with c++ and cgi? Hell no, that is the job of PHP, PHP is meant to do web site back end tasks and be used as a templating engine. Its a case of apples and oranges.
But people will endlessly beat the horse :duh:
Well comparing PHP to some languages can be a bit silly, but C++ and Java are in a similar boat, kinda.
masterBB
2011-04-24 18:56:08
From: i luffs yeww
Well comparing PHP to some languages can be a bit silly, but C++ and Java are in a similar boat, kinda.
For me they aren't. In my personal experience, don't have any evidence nor benchmarks, Java is slower as C++. Also Java feels a bit limited. But if development speed was important, I would chose Java over C++. If time is not the problem but performance is, I would go for C++. I know this isn't true for all cases, but for a lot it is.
So I've used Java for different programs, mostly with a lot of text and interactive environments.
And I use C++ for games and programs with a need of power.
i luffs yeww
2011-04-24 19:01:15
Well C++ can be faster than just about any language, so that's an argument that C++ wins every time.
Java is an awful language, in my opinion. Also nowhere near as general purpose than C++.
And I never said that they were the same, but they do have similar uses.
Iamadam
2011-04-24 19:32:48
/me consoles Java.
It's ok, I will always love you :)
From: Iamadam
/me consoles Java.
It's ok, I will always love you :)
Java is the only thing I want to program in… oh the joy :)
i luffs yeww
2011-04-24 21:03:58
From: LolL
Java is the only thing I want to program in… oh the joy :)
Well that wasn't too prescriptive. Why would you want to program in Java? Or use it?
TRiLeZ
2011-04-24 22:46:45
From: i luffs yeww
Java is an awful language, in my opinion.
Why do you think that?
i luffs yeww
2011-04-24 22:58:28
For the reasons I've said.
The syntax is fine really, but it runs horrendously. I can't put up with the JVM anymore. It's just so slow and is quite the resource hog. Also, it has awful memory management, or everyone is just taught terribly, because it's quite atrocious, in my opinion.
Smartzkid
2011-04-25 00:03:34
Why I don't use java: I like unsigned value types.
From: HyperSecret
I am doing a project where I have to use micro-controllers and the language you upload to the micro-controller is written in processing. It eventually gets translated into C and compiles with the gcc compiler, then uploaded to the micro-controller.
Why not just code in C? Out of curiosity, what micro are you using?
i luffs yeww
2011-04-25 00:08:50
From: Smartzkid
Why I don't use java: I like unsigned value types.
I completely agree with this as well.
Bad Processor
2011-04-26 13:34:39
C# all the way.
Real men program in brainfuck though, so >++++++++++[>++++++++++>++++++++++>++++++++++++>++++++++++>+++>++++++++++>+++>++++++++++>++++++++++>+++++++++++>+++++++++++>++++++++++++>+++>++++++++++>++++++++++>++++++++++++>++++++++++++>++++++++++>+++++++++++>+++><<<<<<<<<<<<<<<<<<<<<-]>++++>—>–>+>++>—>++>++++>—>++>++>+>++>+>—>—–>—->+>++++>+++><<<<<<<<<<<<<<<<<<<<<>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.
– >++++++++++[>+++++++>++++++++><<<-]>—->><<<>.>.
i luffs yeww
2011-04-26 17:14:56
Why C#? :/ It's not very useful if you just say "Language X is better than language Y."
Wizzup?
2011-04-27 18:05:24
From: Smartzkid
Why I don't use java: I like unsigned value types.
Buh, that sounds hardly like a good reason. You always have the BitField and BigInteger classes.
Smartzkid
2011-04-27 20:11:41
I like the ability to easily interface with serial devices, show pretty forms, use a parallel design & code cycle (a la
Expression Blend), and compile my code (a la NGEN).
This is vs java, not python. I'm learning python right now and - while I'm still unsure about dynamic languages - I'm liking it.
i luffs yeww
2011-04-27 20:59:03
From: Smartzkid
I like the ability to easily interface with serial devices, show pretty forms, use a parallel design & code cycle (a la Expression Blend), and compile my code (a la NGEN).
This is vs java, not python. I'm learning python right now and - while I'm still unsure about dynamic languages - I'm liking it.
Nooooooooo! Don't go to the dark side! Keep your good practices! :<
Smartzkid
2011-04-27 21:00:59
I'm not liking it that much ;)