C++/Java/C#

This is a discussion on C++/Java/C# within the A Brief History of Cprogramming.com forums, part of the Community Boards category; Java has huge, easily available libraries for server-side web programming. So many, in fact, that learning just a few for ...

  1. #16
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Java has huge, easily available libraries for server-side web programming. So many, in fact, that learning just a few for comparison is quite a task. C++ has far fewer there, and of lower quality. So for the web, Java is the better choice.

    For the desktop, C++ has the better libraries available, IMO.

    Language capabilities are much more about available libraries than the language itself. The libraries tell you what you can do (with reasonable effort), while the language capabilities merely decide how you do it.
    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

  2. #17
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    C++ has crap support for classes in libraries (dlls). Compile a dll in one compiler and u get face-slapped when trying to use it in another. And you're limited to the most basic types in library interfaces, you can't use std::string as an example.

    That means there are no free functions - everything is inside objects.
    Static functions

    Numbers are not objects in C++
    Neither in java, though they have wrapper classes that objectify them

    Java does not support generic programming and templates to my knowledge.
    Java has generics. Both templates and generics have their pros and cons.

    Oh, and Java can't do multiple inheritance, can it (C++ can)?
    Multiple inheritance isn't neccessarily a good thing
    Last edited by Magos; 06-26-2008 at 04:39 AM.
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #18
    Registered User
    Join Date
    Nov 2006
    Posts
    519
    Quote Originally Posted by Magos View Post
    C++ has crap support for classes in libraries (dlls).
    C++ has no support for it at all. You mean operating systems specific compiler/loader/linker.


    Quote Originally Posted by Magos View Post
    And you're limited to the most basic types in library interfaces, you can't use std::string as an example.
    Why that? Thats a function of mine I call from a lot of different DLLs for example

    Code:
    const std::pair<int, std::string>
    get_type()
    {
    	return std::make_pair<int, std::string>(ut), std::string("T72"););	
    }

  4. #19
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    Another option that hasn't been mentioned: learn a scripting language like Python or Ruby, as well as how to interface with C and C++ from said scripting language (I'd recommend SWIG for that).

  5. #20
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Quote Originally Posted by Elysia View Post
    That means there are no free functions - everything is inside objects.
    Not 100% true. You can have static functions that don't require an object. You still need to put it in a class but you never need to make an instance of it.


    Java has huge, easily available libraries for server-side web programming. So many, in fact, that learning just a few for comparison is quite a task. C++ has far fewer there, and of lower quality. So for the web, Java is the better choice.
    For web I like PHP. Loosely typed works well for the web IMO.

    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.
    Lisp was interesting but the overuse of parenthesis make it a bear at times. I would also recommend prolog for something different.

  6. #21
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by pheres View Post
    Why that? Thats a function of mine I call from a lot of different DLLs for example

    Code:
    const std::pair<int, std::string>
    get_type()
    {
    	return std::make_pair<int, std::string>(ut), std::string("T72"););	
    }
    That opens a whole can of worms for support & program updates:
    Chapter 63. Use sufficiently portable types in a module's interface


    Quote Originally Posted by C_ntua View Post
    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
    In addition to what I already said about Java above, Java does almost everything at runtime instead of compile time. So the "Generics" that Java has is crap... If you have a List<int> and List<String>, you only have 2 List's of objects after you compile it.

  7. #22
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    In addition to what I already said about Java above, Java does almost everything at runtime instead of compile time. So the "Generics" that Java has is crap... If you have a List<int> and List<String>, you only have 2 List's of objects after you compile it.
    Type erasure is not crap. It's less powerful than substitution generics, but has the advantage of producing much leaner code.
    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

  8. #23
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,435
    Quote Originally Posted by C_ntua View Post
    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

    • In C++ you can very easily crash your computer. In Java it is a little harder.
    • In C++ you can very easily create unsafe applications. In Java it is a little harder.
    • In Java you can very easily find a job. In C++ it is a little harder.



    • In C++ it is very hard to find something you can't do with it. In java it is a little easier.
    • In C++ it is easy to interface with hardware devices. In java it is harder.
    • In C++ it is very easy imbue other languages or access application APIs. In java it is a little harder (not necessarily java fault in most cases, but because of a general lack of proper language specific APIs).


    Off the top of my head.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  9. #24
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Why that? Thats a function of mine I call from a lot of different DLLs for example
    Try to compile and use on different compilers and you'll soon notice why. I did a while back on VS and Mingw I believe with unstable results.
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  10. #25
    Registered User
    Join Date
    Jun 2008
    Location
    Houston, Texas
    Posts
    43
    Quote Originally Posted by Mario F. View Post
    • In Java you can very easily find a job. In C++ it is a little harder.
    Really? That surprises me. I guess I'm looking for work as an engineer and not a programmer, but I know from experience that me and almost all of my friends were asked if we knew C++ (and/or Matlab) when applying for jobs. I don't know of anyone who was asked about Java.

  11. #26
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,435
    Meaning there's usually more demand for java than for C++. Not that you can't find C++ jobs.

    I can though be biased my own own job market trends, although I noticed similar tends in other countries. Notably Australia, Canada and Spain.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  12. #27
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    In certain industries - like the trading industry here in Chicago and also in NY - C++ is the preferred language. In general IT, it's Java/J2EE and C#/.NET. Still some C++ there, but not nearly as much as the others.

    That's why I ask what type of programming one is interested in when asked which language to choose.

  13. #28
    Registered User
    Join Date
    Nov 2006
    Posts
    519
    Quote Originally Posted by cpjust View Post
    That opens a whole can of worms for support & program updates:
    Chapter 63. Use sufficiently portable types in a module's interface
    The link says:
    Typically, either you control the compiler and options used to build the module and all its clients, and you can use any typeor you don't, and you can use only platform-provided types and C++ built-in types (even then, document the size and representation you expect for the latter). In particular, never mention standard library types in the interface of a module unless all other modules that use it will be compiled at the same time and with the same standard library source image.
    Fortunately I control the compiler for all modules. But it was an interesting read, so thanks.

  14. #29
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by pheres View Post
    The link says:

    Fortunately I control the compiler for all modules. But it was an interesting read, so thanks.
    I would still avoid using non-primitive types across modules though, because if you apply any compiler service packs, or even change some compile settings and then fix a bug in one of your DLL's and release a patch to customers, the ABI might not be compattible anymore.

  15. #30
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,435
    So much for the Standard template library.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

Page 2 of 8 FirstFirst 12345678 LastLast
Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21