Thread: C++/Java/C#

  1. #1
    Registered User C_ntua's Avatar
    Join Date
    Jun 2008
    Posts
    1,853

    C++/Java/C#

    For a C programmer, knowing the basics of OOP, which of the title's language you think is better?
    If you cannot define better, then which is more easy to use knowing plain C? For example, should somebody learn C++ or just go to the newer C#?

  2. #2
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    I vote C++.
    C# is tied to dotNet, which, at the moment, is unportable.
    Further, it is slow, it is easily reverse engineered, it gives no control over memory (uses a garbage collector) and the language itself is flawed, especially in the eyes of many C++ programmers.
    Java is also interpreted which means easy reverse engineering and slow execution.

    No, C++ is the best language today IMO, because it gives you control over what you want to do and how.
    C# limits you to a slow framework, limiting your options.
    C++ is as fast as, or faster, than C. It is also backwards compatible with C. And C++ has a great deal of pre-written code.
    This means you can fall back to C if you need to communicate with hardware, for example, and yet you can program in high-level programming without sacrificing much speed.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    If you already know C, then C++ is definitely the easiest to learn (all you need to learn is the ++ )
    Java has these things they call "references", which aren't really references, they're more like pointers, but not quite. It also doesn't have a lot of basic things like a const keyword, destructors, and the option of whether you want to pass by value or by reference...

  4. #4
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    I would learn Java or C# rather than C++. It would be too easy to get stuck using C habits if you moved on to C++, and it would be easier to learn C# or Java without that burden.

    Once you learn either of those two language you can always go back and learn C++ with a different mindset and combine that with your C experience to get the most out of C++.

  5. #5
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    What kind of development do you want to do? A lot depends on that.

  6. #6
    Registered User C_ntua's Avatar
    Join Date
    Jun 2008
    Posts
    1,853
    Yeah, everything depends on what you do. Well, don't have anything in mind. I just like "thinking in simple way". Thus more like in C. But I would also want to "upgrade" to something more modern so I can use more modern libraries and all the such.

    What you say Dave is the best thing to do. I would advise it for someone new in programming. But since I have learned to program in C I would like first to go to something similar, learn its new features but still programming C-like. Then little by little I ll learn more and more features more and more functions and have a more varied way of programming.

    The 3 languages just look very similar to me. And I am kind of indecisive But I ll listen to most advises to go to C++.

  7. #7
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    >> But since I have learned to program in C I would like first to go to something similar, learn its new features but still programming C-like.

    The problem is that to get the most out of C++ you need to avoid many of the habits you learn from C. Modern C++ is very different from C even though you can still code with C style in a C++ program. New C++ programmers with C backgrounds often fall back on their C knowledge instead of learning the new (and usually better) solutions available in C++. This is why I suggest starting with a language that won't let you fall into that trap.

  8. #8
    Registered User
    Join Date
    Jun 2008
    Posts
    22
    Then would you suggest learning Java before C++?

  9. #9
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    I'd say it is a tough call, if all you want is to learn more programming languages. Daved's argument is that learning C++ right after learning C tends to cause the learner to stick to C techniques, thus missing out on C++ techniques. On the other hand, learning Java next would mean that you may pick up habits in Java that do not normally apply to C++.

    In the end, I think that the choice does not really matter: you will always have to "unlearn" something that does not apply.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  10. #10
    Registered User
    Join Date
    Jun 2008
    Posts
    22
    C++ is my first language I am learning. I am doing the tutorials online and will be taking C++ classes at my local college soon. After C++, I plan to try and tackle Java.

  11. #11
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    >> Then would you suggest learning Java before C++?
    In reference to the original question, yes I would choose Java or C# first because the OP already knows C. In general, it really depends. There's nothing wrong with learning C++ first, especially if you've already started.

    I think the choice matters, but it won't stop you from being a good programmer, it will just take you down a different path. I would suggest learning a language well enough to use it to learn broader programming concepts before moving on to another language.

  12. #12
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    You could learn something radically different from C, if you just want to broaden your horizons. You could learn Smalltalk. You could learn Lisp. You could learn Haskell.

    Java and C# are pretty much purely object-oriented, but they're still strictly typed (more strictly than C, actually), they use C-style syntax, and generally have a lot of C heritage.

    Smalltalk is purely object-oriented (one of the earliest object-oriented languages) - and I mean extremely pure - dynamically typed, and has hardly any similarity to C at all.

    Lisp (Common Lisp in particular) is a functional/imperative hybrid with strong meta-programming capabilities. Radically different from C.

    Haskell is a strictly functional language. It requires a completely different way of thinking.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  13. #13
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,229
    Java is also interpreted which means easy reverse engineering and slow execution.
    Modern JRE's do dynamic recompilation (compiling sections of frequently run code to native code based on runtime profiling), and some people have tried to show that it can be faster than a compiled language such as C++ (with optimizations based on runtime profiling which C++ programs don't have). Theoretically true, but practically, as of now, Java can only be faster than C++ on specially crafted code. But still, while it is generally slower, it's not like 5 times slower like it used to be.

    That aside, I vote for C++. C# is too proprietary for my liking, and Java is incomplete (operator overloading, and what people mentioned above). I have a feeling that Java's design assumes that programmers don't know what they are doing. While it is true that I don't know what I am doing, I don't like that feeling . Operator overloading is an example (funny how they have to use it with their string class, but allows no one else to). Pointers, too (what are references doing in there then?).

  14. #14
    Registered User C_ntua's Avatar
    Join Date
    Jun 2008
    Posts
    1,853
    Not to open a different topic, but can someone tell me what are the BIG differences in Java and C++. Differences on what you can do easily and what you can't. Lets not consider the differences in performance, safety, etc etc

  15. #15
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    I can't say much details, but as some have already mentioned: Java can't overload operators and Java is purely object-oriented.
    That means there are no free functions - everything is inside objects.
    Numbers and strings and all that are not objects in C++ - they are data types, so you can't expect "something".length() to work, as it might in Java.

    Java does not support generic programming and templates to my knowledge. And I'm sure there's more.
    Oh, and Java can't do multiple inheritance, can it (C++ can)?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed