Is java stronger than c++

Q&A, advice, reviews, and news about the computers, phones, TVs, stereos, and pretty much anything else that can't be easily whittled out of a stick or chipped out of stone.
User avatar
Hanker
Redshirt
Posts: 16
Joined: Wed Nov 28, 2007 4:18 pm
Real Name: ChenShiCai
Gender: Male
Location: China
Contact:

Is java stronger than c++

Post by Hanker » Thu Nov 29, 2007 1:34 am

why is java so welcome?it is stronger than any other computer language or safer?

User avatar
Deacon
Shining Adonis
Posts: 44234
Joined: Wed Jul 30, 2003 3:00 pm
Gender: Male
Location: Lakehills, TX

Re: Is java stronger than c++

Post by Deacon » Thu Nov 29, 2007 5:50 am

Java can benchpress 320, while C++ can dead lift 530.
The follies which a man regrets the most in his life are those which he didn't commit when he had the opportunity. - Helen Rowland, A Guide to Men, 1922

User avatar
JermCool
Redshirt
Posts: 4324
Joined: Fri May 04, 2007 2:33 pm
Real Name: Jeremy
Gender: Male
Location: Las Vegas, NV

Re: Is java stronger than c++

Post by JermCool » Thu Nov 29, 2007 5:55 am

Furthermore, C++ has a power level over NINE THOUSAAAAND!
Insert Banner Here
"The internet is bullcrap! And everyone on it is retarded!" - Muspar
"All threads should degenerate into the bumming of JermCool." - Rorschach

User avatar
Negative Polarity
Redshirt
Posts: 2142
Joined: Sat Nov 12, 2005 1:10 am

Re: Is java stronger than c++

Post by Negative Polarity » Thu Nov 29, 2007 8:25 am

Meanwhile, Java is chargin' it's lazer and setting up us the bomb.
My slow descent into madness seems to have abruptly become a flaming plunge.
[quote="Arc Orion";p="602569"]Negative Polarity, you're a sick, sick bastard.[/quote]

MasteR
Redshirt
Posts: 3064
Joined: Thu Mar 06, 2003 12:48 am

Re: Is java stronger than c++

Post by MasteR » Thu Nov 29, 2007 3:09 pm

I don't know if I would call it more powerful than C++, but it is defiantly more cross platform. And a lot of people say it is easier to code than C++, but that is just opinion.

User avatar
raptor9k
Redshirt
Posts: 1374
Joined: Tue May 15, 2007 8:33 pm
Gender: Male
Location: Earth

Re: Is java stronger than c++

Post by raptor9k » Thu Nov 29, 2007 3:17 pm

I would think C++ is more powerful from a "what can I do with it" standpoint. Java is mostly popular due to the cross platform abilities.

User avatar
Infin8Cyn
Redshirt
Posts: 6309
Joined: Tue Apr 29, 2003 10:02 pm
Real Name: James
Gender: Male
Location: Albuquerque, New Mexico
Contact:

Re: Is java stronger than c++

Post by Infin8Cyn » Thu Nov 29, 2007 4:00 pm

Java and C++ are used in different circumstances. C++ is solid and has been around for a long time. Java is newer, but brings some features to the table that make it's usage different. Since Java only compiles it's plain text code into Java bytecode, which is then interpretted on each individual OS differently (This is why you must have the Java Runtime Environment installed before Java is usable), however your plain text code will have the same effect on each OS.

However, Java (traditionally) is more of a resource whore and is not nearly as fast as C++ due to the fact the JRE has to interpret the bytecode then run it, where as C++ is a fully compiled language.
Image

User avatar
Deacon
Shining Adonis
Posts: 44234
Joined: Wed Jul 30, 2003 3:00 pm
Gender: Male
Location: Lakehills, TX

Re: Is java stronger than c++

Post by Deacon » Thu Nov 29, 2007 4:16 pm

What's this about C++ not being "cross platform"?? Most Windows and Linux programs are developed in C++...

Also...
your plain text code will have the same effect on each OS.
Well, if you've done your job correctly and taken into account the differences between OSes (such as file system deliminators and such).
The follies which a man regrets the most in his life are those which he didn't commit when he had the opportunity. - Helen Rowland, A Guide to Men, 1922

User avatar
Gowerlypuff
Redshirt
Posts: 2900
Joined: Fri Feb 14, 2003 12:53 pm
Gender: Male
Location: Leamington Spa, UK
Contact:

Re: Is java stronger than c++

Post by Gowerlypuff » Thu Nov 29, 2007 4:50 pm

People use Java as it can be embedded into Webpages and it's much more lenient on what you can do, as it's full of extensions, etc. A lot of control is taken away from the coder in favour of ease of use.

Java does not have a preprocessor. Therefore, you don't need header files (you can't have header files. You also can't use #define), and you also can't use enums, structs or unions (you can get around enums by using forward declarations with the final keyword).
There are no global functions in Java, everying is a member of some class (there is no standalone main, it'll be part of something. You can have static functions, but they'd need to be called with class::function, I believe).
All classes in Java inherit from the Object interface.
Java does not support multiple inheritance from many classes.
Java does not support operator overloading. (:()
Java looks after pointed at data. You can't make some dynamic data invalid if there are things pointing to it (even though Java doesn't support pointers as such).
Type checking and type requirements are much tighter in Java than in C++.
Conditional expressions in Java must evaluate to boolean rather than to integer, as is the case in C++. Statements such as if(x+y) are not allowed in Java because the conditional expression doesn't evaluate to a boolean.
Char is UTF16 in Java, rather than ASCII as in C++.
C++ requires that classes and functions be declared before they are used. This is not necessary in Java.

There's some other crap, too.

Basically, for the most part, Java allows you to get away with a bit more. There are some simplifications in Java, and it allows you to make crappy webgames. However, we use C++ at game studios because, for example, Sony never wrote a Java compiler for the PS2, as far as I'm aware.
Sloth: Am I a year behind already?
Image
February was some lyrics or quotes month or something. I don't even remember what year all this was.

User avatar
Brian
Redshirt
Posts: 1019
Joined: Sat Feb 15, 2003 4:22 am
Gender: Male
Location: Albuquerque, NM US
Contact:

Re: Is java stronger than c++

Post by Brian » Thu Nov 29, 2007 8:36 pm

It seems that people tend to say that Java is more cross-platform simply because there are toolsets like Swing built in, which allow for easier (but not necessarily better) cross-platform GUI, as well as the fact that you distribute bytecode instead of assembled binaries, meaning your distribution can be closed-source but only handing out one set of files instead of one per architecture. Of course, that assumes that people have the right version of the Java engine on their system, which can be a pain in and of itself. There are also libraries out there like wxWidgets and such which allow for cross-platform GUI C++ applications -- you still have to compile it for specific architectures, but hey, that's not too bad. I did a research project with a professor in '03 doing wxWidgets (was wxWindows then) stuff, and it was incredibly awesome to be able to take my C++ code and build it on any of the three major OSes we were required to support.

Java applets in webpages make me want to stab people. Almost anything you can do in Java, you can find another way to do, without having to lean on the slow Java engine. Rebuild it in Flash (even though, that does potentially cut some audience -- but on the other hand, choosing Java also potentially limits your audience -- but at least Flash is generally fast), or heck, JavaScript is really quite more powerful than a lot of people give it credit for, use that instead if you can. I've seen some amazing implementations of things like Conway's Game of Life in pure JavaScript that ran like a charm.

I've seen some people do some really interesting web services stuff on the backend using Java, taking advantage of a lot of the other nifty newer toys that it builds in (both DOM and SAX style XML handling, relatively easy support for WSDL/SOAP/blahblahblah). While I know you can write web services, CGI scripts, etc. in C/C++, I don't know why you would want to. The language has libraries to do the networking aspects of it, but it doesn't have a lot of the bells and whistles that make it easy to do. We had to write a web service in C++ for one of my classes in '99. That was so horribly ugly. I pray that I never have to write code to manually parse XML ever, ever again. I'll lean on Perl or Ruby or something else (but probably not Java, unless required, simply because I'm not a big fan of the language, after having written a few programs in it for various purposes).

It's all about the right tool for the job. Sure, I can use a screwdriver as a chisel, and maybe even a chisel as a screwdriver in some situations, but I'd be better suited to use the right tool at the right time. It doesn't mean I'd say to never use tools in different ways (after all, you can creatively use a lighter to open a bottle of beer and it just may be easier than tracking down a proper bottle opener for a one-time use), just that you use what's right for the job in most situations.

Seeing as C++ allows for much tighter memory control, and the fact that it's compiled into language to communicate directly with the architecture, it makes sense for games or applications that one wants/needs to run really quickly. I still know people who use Fortran for mathematical work simply because the way that it handles arrays lends itself to much faster matrix manipulation math. Java was built with a lot of web stuff in mind, both client and server, and so it does some solid stuff there. Perl can make text files dance in ways that still stun me on occasion. Ruby lends itself to speedy app development, especially when working on DB-based web apps (Rails makes me weep with joy).

Why do I feel like I got suckered into helping someone answer a homework assignment?
Reading Perl is like reading music. It can be a little hard to get into at first, but once you can read it, it's like food for the soul.

User avatar
Deacon
Shining Adonis
Posts: 44234
Joined: Wed Jul 30, 2003 3:00 pm
Gender: Male
Location: Lakehills, TX

Re: Is java stronger than c++

Post by Deacon » Thu Nov 29, 2007 9:30 pm

Gowerlypuff wrote:(:()
It's a duck!
The follies which a man regrets the most in his life are those which he didn't commit when he had the opportunity. - Helen Rowland, A Guide to Men, 1922

bagheadinc
Bay Harbor Butcher
Posts: 7928
Joined: Wed Jul 12, 2006 6:25 pm
Real Name: Matthew
Gender: Male
Location: Fruitland, MD
Contact:

Re: Is java stronger than c++

Post by bagheadinc » Thu Nov 29, 2007 9:34 pm

Deacon wrote:It's a duck!
Get in the blind?
Image

User avatar
Binks
Redshirt
Posts: 758
Joined: Sat Aug 14, 2004 5:51 pm
Gender: Male
Location: In your base, killing your dudes

Re: Is java stronger than c++

Post by Binks » Fri Nov 30, 2007 3:45 pm

In my experience Java will stop you from making mistakes better than C++ (lack of pointers and operator overloading among other things) and tends to make the code easier to understand because of it's verbosity and well named library classes (cout or System.out, which is easier for a newbie to understand?). For that reason it tends to be the popular 'teach new CS students the ropes' language (though honestly I think a higher level language like Python would be better, but that's just my opinion).

C++, on the other hand, allows you to do a lot more than Java. This means that it's easier to make stupid mistakes as a newbie, but it allows you to do much more complex things (especially things with pointers) as well. C++ will also run faster and on more hardware (seems kinda backwards until you consider that gaming systems are hardware, and don't tend to include java interpretors).

Both have their advantages. In my book Java is the better language unless you're writing a processor intensive program (game, heavy database manipulation etc) or writing for something other than a Windows, Linux, or Mac PC (though, with those kind of limitations, I'd probably choose something other than both of them, a much higher level interpreted language like Actionscript or something).

As for security, I'm not 100% sure but I think Java might be more secure to write in. It's certainly not immune to the standard attacks (buffer overflow etc.) but I think it's a little more resistant since it's interpreted and you never get to mess with actual bytes (unless you're doing bitwise operations, which is pure programming and can't be exploited to my knowledge). Also I'd say that Java's lack of dynamicity would be a plus for security, but I'm not sure if C++ is dynamic (can change it's own code on the fly is my definition of dynamic).

User avatar
NorthernComfort
Redshirt
Posts: 2762
Joined: Fri May 23, 2003 8:13 pm
Real Name: Alex
Gender: Male
Location: Brooklyn, NY

Re: Is java stronger than c++

Post by NorthernComfort » Fri Nov 30, 2007 4:53 pm

Ruby lends itself to speedy app development, especially when working on DB-based web apps (Rails makes me weep with joy).
Yep. I started a major Rails project earlier this week and couldn't be happier. It's simply a joy to work with.
"I guess I have a gift for expressing pedestrian tastes. In a way, it's kind of depressing." -Bill Watterson

User avatar
Negative Polarity
Redshirt
Posts: 2142
Joined: Sat Nov 12, 2005 1:10 am

Re: Is java stronger than c++

Post by Negative Polarity » Fri Nov 30, 2007 5:35 pm

Great, I've got a website for you to look at. You won't mind doing it for free, will you?
My slow descent into madness seems to have abruptly become a flaming plunge.
[quote="Arc Orion";p="602569"]Negative Polarity, you're a sick, sick bastard.[/quote]

Locked

Who is online

Users browsing this forum: No registered users and 1 guest