C++ or Java?

trippintrippin Chatt, TN
edited July 2003 in Science & Tech
Which is a better langauge C++ or Java?

Comments

  • hitokirihitokiri NYC
    edited June 2003
    I think that C++ is a better language. Once you have mastered C++, other languages come easier, i.e. Java, et al
  • CycloniteCyclonite Tampa, Florida Icrontian
    edited June 2003
    Ditto...
  • AranyicAranyic Casstown, OH Icrontian
    edited June 2003
    I think C++ probably (though I havn't gotten around to java yet). It seemed like a very nice first language, very structured and laid a nice foundation I feel like.

    I'm in the process of learning C# at the moment actually. Having some trouble with it and databases (well anything that uses the ado.net I'm having trouble with).
  • edited June 2003
    What ever happened to C. Where am I? Ok C++ is C with great pointer management. C# is M$ plan to dominate the software industry, isn't it??
  • EMTEMT Seattle, WA Icrontian
    edited June 2003
    I learned some Java and I'm more familiar with C++, but really Java was a pain in the butt. It's a shame some official education programs (e.g.... all high schools) are switching to Java. Oh well, less supply of useful programmers = more demand = more $
  • R4CK3RR4CK3R Oklahoma
    edited June 2003
    In my high school we have a GWBasic class...

    We had alot of dumb ppl in my class and somthing simple like C would be to much for them.
  • edited June 2003
    C++ is a wonderful language. However I thought that it could get quite complicated at times. Either that or my teachers really didn't know how to teach.
  • edited June 2003
    The two languages are far different. I dont say one is better than the other, although I prefer C++ myself. Java in it of itself is a kickass concept and I wish I had the dedication to get good at it...but I dont.
  • EMNEMN
    edited June 2003
    C++ > *.
  • SlackerSlacker CA, USA
    edited June 2003
    C++ is good for Windows applications, Java's GUI is too slow and ugly to become popular here. The Java language, however, is great for web based programming (stuff like game applets and java server pages)
  • a2jfreaka2jfreak Houston, TX Member
    edited June 2003
    I voted for C++ but I think the best language is dictated more by situation than by what all the language offers, because as long as it offers enough for the situation and makes things easy, without eating the CPU or sucking RAM, then it should be fine.

    C# has some really nice features though.
    D (digitalmars.com) has some very nice features too.

    I've never played with Oberon-2, but I've heard it's good. I personally don't like the way it looks so I never bothered learning it.

    There is no perfect language.
    There is no best language for every situation.

    For instance, if I were writing a log parser, I'd probably do it in perl.

    If I'm writing a Windows app that is very basic, then I'll use VB.

    If I'm doing something that I really enjoy, I'll use C, or C++ (normally C++).

    As for Java, it has its place, just not with stuff I do.

    You wouldn't use a Dodge Neon to haul a 20 foot trailer would you?
    You wouldn't buy a Hummer if you needed 40 miles per gallon.

    The Neon is better in some situations, the hummer is better in others. Sometimes you need something in-between. It all depends on the situation.
  • ktulu_tcoktulu_tco Akita, Japan
    edited June 2003
    Voted C++, but I really like Java, it isn't as slow as you people think for things that aren't graphic intensive. I mean, obviously FPS aren't going to programmed in Java. But, it runs pretty fast even on an old Linux Box (that means no JIT compiler). Java is totally different from C++, so I think Java has its place too.
  • a2jfreaka2jfreak Houston, TX Member
    edited June 2003
    Originally posted by ktulu_tco
    Java is totally different from C++, so I think Java has its place too.

    That is so true!
    I think many people bundle them together because the syntax is very similar on the surface.
  • CyrixInsteadCyrixInstead Stoke-on-Trent, England Icrontian
    edited June 2003
    I have to agree with Slacker here...
    C++ is good for Windows applications, Java's GUI is too slow and ugly to become popular here. The Java language, however, is great for web based programming (stuff like game applets and java server pages)
  • a2jfreaka2jfreak Houston, TX Member
    edited June 2003
    By GUI I'm guessing you and Slacker are referring to the widget set?

    There is more than 1 widget set available for Java, so don't let that be the reason you don't like the language.
    Originally posted by CyrixInstead
    I have to agree with Slacker here...
  • KyleKyle Lafayette, LA New
    edited June 2003
    I voted for C++ because... well like EMN said, C++ > *

    However, I think Sun has realized that Java will never be the next great way to make simple utility applications. They are focusing more on Java Server Pages and Servlets.

    I think the concept of Java being "slow" stems from criticism when it was initially released (it is much faster now than it was then) and the imbedded belief that all interpreted languages are slower than running Quake3 on a 486.

    Java definitely has its place in the market. However, I think that high schools should teach C++ first, teach about objects and classes, then teach Java. Learning Java as your first language will not only be the most uncomfortable and difficult thing you've ever done in your life, but it can also warp your perception of how objects and classes work in other languages, making those even more difficult to master.


    (Oh and I like the new Icrontic. Keep up the good work guys)
  • edited June 2003
    None of the above *s*
    C# is the merging of C++ and Java and is better than both of them.

    C++
    pros:
    Fast, powerful, quite fun to program.
    cons:
    Difficult, and the code gets messy, .h files.

    Java
    pros:
    Easy, structured code, platform independance (yea right, full screen mode and video acceleration someone?)
    cons:
    SLOW, not all that powerful.

    C#
    pros:
    Fast, nice code, very powerful, versitile, easy to learn.
    cons:
    Microsoft behind it
  • a2jfreaka2jfreak Houston, TX Member
    edited July 2003
    C# is similar to both C++ and Java, but stating it is better than both is probably not accurate, at least not at this juncture.

    C++ is not a difficult language. I do not know why this myth still floats around, but it does.

    Code can get messy, but that's not an inherent flaw of the language because the language makes it easier to make clean code than most other languages.

    what's wrong with header files?

    I will say what I've seen of C# is nicer than java, as I'm just not a huge java fan. C# is immature and because it contains more constructs is actually more difficult to learn than C++, though neither is truly difficult.

    Overall, I think C and C++ are the two languages that best fit most stand-alone* situations--but definitely not all situations--and since they are so similar, it makes switching from one to the other relatively easy.


    by stand-alone I mean an executable file on one's computer that does not tie back into another program and also not a web-based apllication or in the case of a place like this, a web-based forum. PHP is much easier to use and deal with than using C/C++.
    Originally posted by Xaake
    None of the above *s*
    C# is the merging of C++ and Java and is better than both of them.

    C++
    pros:
    Fast, powerful, quite fun to program.
    cons:
    Difficult, and the code gets messy, .h files.

    Java
    pros:
    Easy, structured code, platform independance (yea right, full screen mode and video acceleration someone?)
    cons:
    SLOW, not all that powerful.

    C#
    pros:
    Fast, nice code, very powerful, versitile, easy to learn.
    cons:
    Microsoft behind it
  • a2jfreaka2jfreak Houston, TX Member
    edited July 2003
    Start a SourceForge project.
    Originally posted by M33PiNS

    Guys got me in the mood to make a game with C++ or something :D And... Java is slow :P Especially Sun's own ( Ironic huh? )
  • edited July 2003
    Originally posted by a2jfreak
    C# is similar to both C++ and Java, but stating it is better than both is probably not accurate, at least not at this juncture.

    C++ is not a difficult language. I do not know why this myth still floats around, but it does.

    Code can get messy, but that's not an inherent flaw of the language because the language makes it easier to make clean code than most other languages.

    what's wrong with header files?

    The LANGUAGE C# is definitely better than both C++ and Java, I don't think alot of people that has experience in them all would disagree with me. As for the whole package (compilers IDE etc.) I am not so sure.

    Header files are bad because they make reading the code much more difficult, not to talk about programming. I've never understood why you would want anything else but the Java/C# style of class declarations, where both the access method and the actual methods/fields are at the same place.
  • a2jfreaka2jfreak Houston, TX Member
    edited July 2003
    Narrow-mindedness in programming is something that limits one's ability. By stating that C# is definitely better, then you are painting yourself into a corner in situations where C# is not advantageous.

    I'm not saying don't use C#.
    I think C# has a lot of good points to it and in time might actually be the "definitely" better language. Only time will show, but at this juncture C# is not the best language for most situations, simply because of it's immaturity and lack of native libraries.

    As for your statement about IDEs.
    I think Microsoft, as horrible a company as they are, makes the best IDE that I've tried and since C# shares the same IDE in Visual Studio .Net, I don't see where the IDE would hold C# back, except for the native-library area, but I guess if you're using .Net you don't truly worry about anything being "native."

    Headers allow even more abstraction, but they do not have to be used. You can put the entire class definition inside of a .cpp file and nothing is stopping you. If you did not know this then perhaps you are not educated enough in C++ to issue an informed opinion.

    If you're not talking about the usual .h/.cpp separation, then please clarify your stance.


    I hope this doesn't come off like I'm on the offensive because I'm not, I just do not like to see misinformation/myth spread about languages. Even VB, as much as I hate its syntax and its resource hogging has its place and can be considered--by many--the best language for certain situations. I employ the use of VB in trivial apps where I do not need to do a lot, or where resource hogging is not an issue.
    Originally posted by Xaake


    The LANGUAGE C# is definitely better than both C++ and Java, I don't think alot of people that has experience in them all would disagree with me. As for the whole package (compilers IDE etc.) I am not so sure.

    Header files are bad because they make reading the code much more difficult, not to talk about programming. I've never understood why you would want anything else but the Java/C# style of class declarations, where both the access method and the actual methods/fields are at the same place.
  • edited July 2003
    Originally posted by a2jfreak
    Narrow-mindedness in programming is something that limits one's ability. By stating that C# is definitely better, then you are painting yourself into a corner in situations where C# is not advantageous.

    I'm not saying don't use C#.
    I think C# has a lot of good points to it and in time might actually be the "definitely" better language. Only time will show, but at this juncture C# is not the best language for most situations, simply because of it's immaturity and lack of native libraries.

    As for your statement about IDEs.
    I think Microsoft, as horrible a company as they are, makes the best IDE that I've tried and since C# shares the same IDE in Visual Studio .Net, I don't see where the IDE would hold C# back, except for the native-library area, but I guess if you're using .Net you don't truly worry about anything being "native."

    Headers allow even more abstraction, but they do not have to be used. You can put the entire class definition inside of a .cpp file and nothing is stopping you. If you did not know this then perhaps you are not educated enough in C++ to issue an informed opinion.

    If you're not talking about the usual .h/.cpp separation, then please clarify your stance.

    Let me clarify even more what I mean. C++ is a better language because it has those native libraries you are talking about, and because it is widely used, and because it is compiled to native code, not to talk about there being C++ compilers for any platform you want.

    C# Lacks theese kinds of things, but that is something that I consider has to do with other things that the actual language. What I mean when talking about the language is the actual syntax and nothing more, not the class library or anything like that.

    I agree with you that Microsoft makes the best IDE:s, although I haven't tried some of the highly praised IDE:s on Mac and Linux (I am not talking Emacs here, more the likes of KDevelop). The reason for using IDE in my previous post was just to give examples of things that I didn't consider language related.
    class myClass
    {
    private:
        int myInt;
    public:
        myClass(int anInt);
        void myMethod();
    };
    
    myClass::myClass(int anInt)
    {
        myInt=anInt;
    }
    
    myClass::myMethod()
    {
        .....
    }
    
    
    class myClass
    {
        int myInt;
        
        public myClass(int anInt)
        {
            myInt=anInt;
        }
    
        public void myMethod()
        {
            .......
        }
    }
    

    This is what I am talking about when talking about .h files (and the problem is almost as bad if you have the .h and .cpp in the same file), the first is C++ and the second the exactly same thing in C#. I think the C# one is alot more readable.

    Lastly the problem that C# does not have native libraries. That is not a problem, since the loss of speed is not that great. And if you think it is too much, you can compile C# code to native code (pre jitting it with NGen, it speeds up the code a bit (you still need the framework though, as it will still run in managed mode).
  • a2jfreaka2jfreak Houston, TX Member
    edited July 2003
    Ok.

    Libraries/community/etc (anything that takes a while to build up) aside, since C# is disadvantaged in those areas through no fault of its own except its relative "newness."

    The language itself may be better.
    Personally I prefer C++, but honestly the syntax (in the areas C++ and C# share) is very similar.

    KDevelop is nice, but it stops there.
    I've waited years on KDevelop and it's seemed to grow by hops and steps rather than by leaps and bounds. Not that I'm complaining, as I've not contributed to KDevelop, just stating the way I see it.

    As for your C++ code, you can just in-line the functions and it looks very similar to the C# way.
    class myClass
    {
    private:
        int myInt;
    
    public:
        myClass(int anInt)
        {
            myInt=anInt;
        }
    
        void myMethod()
        {
            .....
        }
    
    };
    

    The only true difference is the private and public attributes. C++ makes it a grouping, C# forces--like Java--public/private/protected to mate with only the one function/method, or with one int/float/etc declaration.

    I'm not sure if you could stick this all in a .cpp file and have NOTHING except the #ifdef, #ifndef, #endif in the .h, but I know all this could go in the .h file.
    Originally posted by Xaake


    Let me clarify even more what I mean. C++ is a better language because it has those native libraries you are talking about, and because it is widely used, and because it is compiled to native code, not to talk about there being C++ compilers for any platform you want.

    C# Lacks theese kinds of things, but that is something that I consider has to do with other things that the actual language. What I mean when talking about the language is the actual syntax and nothing more, not the class library or anything like that.

    I agree with you that Microsoft makes the best IDE:s, although I haven't tried some of the highly praised IDE:s on Mac and Linux (I am not talking Emacs here, more the likes of KDevelop). The reason for using IDE in my previous post was just to give examples of things that I didn't consider language related.

    class myClass
    {
    private:
        int myInt;
    public:
        myClass(int anInt);
        void myMethod();
    };
    
    myClass::myClass(int anInt)
    {
        myInt=anInt;
    }
    
    myClass::myMethod()
    {
        .....
    }
    
    
    class myClass
    {
        int myInt;
        
        public myClass(int anInt)
        {
            myInt=anInt;
        }
    
        public void myMethod()
        {
            .......
        }
    }
    

    This is what I am talking about when talking about .h files (and the problem is almost as bad if you have the .h and .cpp in the same file), the first is C++ and the second the exactly same thing in C#. I think the C# one is alot more readable.

    Lastly the problem that C# does not have native libraries. That is not a problem, since the loss of speed is not that great. And if you think it is too much, you can compile C# code to native code (pre jitting it with NGen, it speeds up the code a bit (you still need the framework though, as it will still run in managed mode).
  • edited July 2003
    Hi guys, this is my 1st post back at the new Icrontic, just had to sign up again for this thread.

    Ive used both C++ and java, but for the last 3 years at uni ive had to use java.

    Java is a superb OO language, its just a shame that its interpreted - thats its strongpoint and weakness all in one.

    I remember reading a leaked internal memo from sun that was going around the labs saying about how bad java was basicaly. There were bugs listed that could not be fixed because of the way the JVM worked and some crazy bit saying about even the simplest "Hello world!" program needing over a meg of memory(loading the JVM etc).

    As for making GUIs in java, awt just does not cut it, nor does swing which is just pollished awt. I mainly build GUIs using swing and they just are not as responsive as other UIs coded in another language.

    Anyway, I must say however, that I still prefer java. It is extremely logical and the way that you can extend any component easily and even look through the source has to be a plus in anyones book.
  • a2jfreaka2jfreak Houston, TX Member
    edited July 2003
    Java definitely has its nice points.

    I also agree that it being interpreted is both a strength and a weakness.

    Strength because it allows the JVM to be optimized and then all the Java apps run better, whereas C/C++ apps would have to be recompiled to take advantage of new compiler optimizations.

    Weakness because interpreted is almost always slower and decompiling Java is much easier than decompiling C/C++, which allows people to see just how your code works w/out having to know ASM like the back of their hands.

    I've seen "benchmarks" showing Java equaling or even outpacing C++ apps in many situations. While I'm not saying this is impossible, I'd definitely say it has not been my experience. I also feel that these "benchmarks" were probably run using a C++ compiler that produced very slow code and used no optimizations, whereas the JVM was probably one of the quickest around, especially in the particular task being "benchmarked." I put benchmark in quotes because I believe these to be a farce by someone who hates C++ and will do just about anything to discredit it.
    Originally posted by Phoboss
    Hi guys, this is my 1st post back at the new Icrontic, just had to sign up again for this thread.

    Ive used both C++ and java, but for the last 3 years at uni ive had to use java.

    Java is a superb OO language, its just a shame that its interpreted - thats its strongpoint and weakness all in one.

    I remember reading a leaked internal memo from sun that was going around the labs saying about how bad java was basicaly. There were bugs listed that could not be fixed because of the way the JVM worked and some crazy bit saying about even the simplest "Hello world!" program needing over a meg of memory(loading the JVM etc).

    As for making GUIs in java, awt just does not cut it, nor does swing which is just pollished awt. I mainly build GUIs using swing and they just are not as responsive as other UIs coded in another language.

    Anyway, I must say however, that I still prefer java. It is extremely logical and the way that you can extend any component easily and even look through the source has to be a plus in anyones book.
  • edited July 2003
    Thanks a2jfreak.

    Java outperforming C++ - those results must have been "tweaked".
Sign In or Register to comment.