Thread: C/C++ Vs Java

  1. #1
    Registered User
    Join Date
    May 2003
    Posts
    11

    C/C++ Vs Java

    I am taking C++ courses, I have never used JAVA yet. But everytime I read an article on the net, programmers are always preferring the JAVA laguage over the C++ laguage, saying that it is more reliable and has less holes.. I need your feedback about this subject..
    Thank you

  2. #2
    Master of the Universe! velius's Avatar
    Join Date
    Sep 2003
    Posts
    219
    That would probably come from someone who does not know the C++ language. Also they are problably refering to code portability. Something you don't need to worry about with Java so much. But hell if people would write ANSI/ISO C++ code only then there would not be an issue. I personally prefer to use C++. I to don't know much about java at all. I am in college for Computer Science and the director and board chair told me I'd learn C, C++ and Java by the time I complete the four year course. He also said that I may get some assembly knowledge as well. Any ways those people are the ones that are blowing smoke up others asses.
    While you're breakin' down my back n'
    I been rackin' out my brain
    It don't matter how we make it
    'Cause it always ends the same
    You can push it for more mileage
    But your flaps r' wearin' thin
    And I could sleep on it 'til mornin'
    But this nightmare never ends
    Don't forget to call my lawyers
    With ridiculous demands
    An you can take the pity so far
    But it's more than I can stand
    'Cause this couchtrip's gettin' older
    Tell me how long has it been
    'Cause 5 years is forever
    An you haven't grown up yet
    -- You Could Be Mine - Guns N' Roses

  3. #3
    ___
    Join Date
    Jun 2003
    Posts
    806
    Java is basically a version like c++ and c for the internet.
    "When I die I want to pass peacefully in my sleep like my grandfather did, not screaming and yelling like the passengers in his car."

  4. #4
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    >>Java is basically a version like c++ and c for the internet.

    wrong. Java is popular for use on the net, that's not why it was made. I can use C on the net too.
    Java is a lot like C++, but has wrapped several procedures into functions (certain types of string conversion, things like that). It was created, as Velius mentioned, for greater portability. Because of the nature of the java interpreter, code should work on all platforms. But just like any other language, if you write code to run on windows, it won't work on *nix.
    PHP and XML
    Let's talk about SAX

  5. #5
    Registered User FloatingPoint's Avatar
    Join Date
    Jun 2003
    Posts
    191
    Personally I wouldn't bother much abt ppl saying Java is the more preffered language, until I understand fully the basics of C++. As many of you have said, learn one language and try to master it, and the others would be easy to understand.

    But sure one could always take Java as his/her first language.
    Come cast your shadow over me
    and I'll cast mine all over thee
    Take me away, into the shades
    where there is no light of day

  6. #6
    Registered User
    Join Date
    May 2003
    Posts
    161
    First, I want to say that I have been programming in Java, C, and C++ for almost 4 years.

    I'm saddened by the direction that this is going. I know that many high schools have switched their AP CS curriculum to Java and so have some universities (mine included)-- the CS program at my university doesn't even offer classes in C/C++ anymore.

    While I feel that Java has a definite niche-- web apps, small devices, "toy" programs"-- it is not a mainstream language. The syntax is clunky, the library is inconsistent, and the interpreters are dreadfully slow-- though they are improving. I think it would be a mistake for it to become the "Next Big Thing."

    That said, I think a language like Java will and should become the next big thing. Small executable size, portability, and garbage collection are becoming important factors in the programming world.

    However, Java is, IMO, missing some key features that I will mention briefly.

    1. Operator overloading
    I feel that this is very important in an object oriented language. When using objects, operators that make sense should work for that object. For example, in some sort of restaurant program, it should make sense to be able to add two orders together.

    2. "Primitives" derived from base object
    Java's primitive types cannot be stored in default containers. Containers can only hold objects derived from the base object. Java offers primitive wrappers like Integer, Double, etc-- the trouble with these wrappers is linked to the operator overloading problem above. It should make sense to be able to add two Integer objects together. Without overloading, the wrappers are practically useless except as a means to store utility functions. So you're forced to choose between expected behavior or "containerability"

    3. A consistent standard library
    Java's library is a mess. Just note the names of the primitive wrappers above-- the wrapper for double is called Double but the wrapper for int is called Integer. Why not call it Int? Why do I have to instantiate a hierarchy of objects just to do something as common as reading a file?

    4. Generic programming
    I suppose I've been spoiled by the STL. I find the algorithms and generic containers to be invaluable. Java offers generic Vector, Hashtable, Stack, etc. containers, but these only hold pointers to the base object. They cannot hold primitives (unless placed into one of the wrappers). You have to cast the result every time you want to use an object that is in the container, and, as a result, they are not type-safe.

    Note that this is not an attack on Java itself-- it is an expression of my disappointment. I feel that Sun really dropped the ball when it could have developed the first mainstream, portable, interpreted, garbage-collected application programming language.

    But, to give my input on the question at hand: "Is Java preferable to C++?"

    Well, you're comparing apples and oranges. For application programming, C++ is the absolute winner. For portability, web applets, or small devices, Java is a good choice.

    It basically boils down to the fact that it's a good idea to know a variety of languages so that you can tackle the problem at hand with the best possible tool.

    I hope this post provides some insight.

    -tf

  7. #7
    Registered User
    Join Date
    Oct 2003
    Posts
    3
    Java is a great text-book language. It makes lots of things fairly simple -- multi-threading, IO is manageable, network programming is straightforward. It enforces object-oriented principles, much to the delight of lecturers, no doubt. That's the good.

    After programming in Java for quite a while, it soon becomes frustrating. Amongst these annoyances (in no particular order):

    1. Error-handling is ugly. The enforced try-catch or throws is just a pain. C# saw this and dispensed with checked exceptions. C++ is also better in this regard.

    2. Lists are a pain. Losing type information, and the lack of compiler-enforced checks, is again a pain. It makes code involving lists horribly ugly. Once again, C# has gone some way to correct this. Java's 1.5 Generics are a hideous hack.

    3. Primitives throw a spanner in the works. Java is geared towards everything being an object. For reasons behind me (ostensibly for speed, though a good compiler should be able to use objects instead). This means that you have to box every primitive as an object just to put it into a list. It results in code so ugly and verbose that you'll want to cry.

    4. Java talks down to you. Java won't allow you to do lots of stuff C++ will -- operator overloading, for example. STL too. It sacrifices power for small-scale readability/simplicity. This readability is lost on a larger scale, though, as the lack of possible abstractions ultimately complicate code.

    5. Java GUIs are disgusting. AWT was bad, and Swing is worse. AWT had the right idea -- bindings to native code, as I understand it -- but it had the lowest-common-denominator of components to allow for portability. No trees, etc. Swing went the other way -- entirely Java-based. It's extremely slow, as a result. C++ GUIs are much better, in general. GTK is nice, and Windows GUIs are good.

    6. Java is bloated. 4mb of JRE 1.4 to execute a HelloWorld app. C++ is much better here, too.

    7. C++ is much, much faster.

    8. Java, I predict, will turn out like COBOL. A language nobody wants to get involved in. C++ has more going for it, as it is more flexible. C# addresses some, but not all, of Java's failings. C++'s backwards-compatibility with C is a bonus -- C has been around for 30-ish years, and is still going strong. In a sense, C++ is an adoption of C -- C plus object-orientation. C is proven, so I'd stick with it and its derivatives.

  8. #8
    Registered User
    Join Date
    May 2003
    Posts
    11
    By the way, has anyone heard about DigiPen and the RTIS ( Real Time Interactive Simulation) major offered there?

    If yes, I need any information you have about this subject.

    Thank you

  9. #9
    Registered User
    Join Date
    Nov 2001
    Posts
    241
    JAVA is terrible! I hate that language so much!

  10. #10
    Senior Member joshdick's Avatar
    Join Date
    Nov 2002
    Location
    Phildelphia, PA
    Posts
    1,146
    There's a guy who used to visit these boards very regular who went by the name of PolymorphicOOP. He's a student at DigiPen. I'd suggest tracking him down.
    FAQ

    "The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs." -- Joseph Weizenbaum.

    "If you cannot grok the overall structure of a program while taking a shower, you are not ready to code it." -- Richard Pattis.

  11. #11
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    >>PolymorphicOOP

    damn, i forgot about him. Weird how people come and go...do you remember that one guy who hated me and a couple other people? He had a penguin avatar, always said he was a MS beta tester...sort of a troll...damn, can't remember who he was (no not trollking). You remember who that was?
    PHP and XML
    Let's talk about SAX

  12. #12
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    Weird how people come and go...
    I agree lol...remember ethic? That wasn't too long ago (I remember him pretty clearly)...That polymorphic guy I think I remember vaguely, but he must have disappeared soon after I joined..Also, where did Prelude go?? She says she's going on a business trip and weeks later, still no Prelude
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  13. #13
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949
    Check the contests forum - she was on a second ago.
    Do not make direct eye contact with me.

  14. #14
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    Wow its like magic! I post that and then the next day, look who shows up
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  15. #15
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    I must say, I don't particularly like the way Java handles inheritance and 'interfaces'. I much prefer not only the C++ syntax, but I like the fact that you can derived from multiple base classes, for example. And the 'interface', though comparable to an ADT is a pain to have to treat differently.

    Also, I really miss C++-style pointers in Java.
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Java for real-time applications
    By zacs7 in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 08-26-2008, 06:34 AM
  2. C#, Java, C++
    By incognito in forum A Brief History of Cprogramming.com
    Replies: 10
    Last Post: 10-05-2004, 02:06 PM
  3. The Java language is being expanded
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 26
    Last Post: 06-11-2004, 09:07 PM
  4. Java woes
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 07-06-2003, 12:37 AM
  5. C or Java as a first language
    By CorJava in forum A Brief History of Cprogramming.com
    Replies: 34
    Last Post: 10-23-2002, 05:12 PM