Page 2 of 3 FirstFirst 123 LastLast
Results 17 to 32 of 39

Thread: For OOPL developers

  1. #17
    Large Member
    Join Date
    Apr 2004
    Posts
    3,720
    Thanks
    47
    Thanked
    99 times in 64 posts
    I started this thread as a discussion of the two languages, good points, bad points, maybe some ideas for the less experienced programmer to think about. Try not to insult each other.
    To err is human. To really foul things up ... you need a computer.

  2. #18
    Senior Member
    Join Date
    Jan 2005
    Location
    Manchester
    Posts
    2,901
    Thanks
    67
    Thanked
    182 times in 136 posts
    • Butcher's system
      • Motherboard:
      • MSI Z97 Gaming 3
      • CPU:
      • i7-4790K
      • Memory:
      • 8 GB Corsair 1866 MHz
      • Storage:
      • 120GB SSD, 240GB SSD, 2TB HDD
      • Graphics card(s):
      • MSI GTX 970
      • PSU:
      • Antec 650W
      • Case:
      • Big Black Cube!
      • Operating System:
      • Windows 7
    Quote Originally Posted by DaBeeeenster
    Java has built in memory management. C++ doesn't. Java is totally portable. C++ isn't.
    C++ can have automatic GC, java forces you to - C++ is better in that you have the choice, rather than having the language ram it down your throat.

    Java is not totally portable, nor is C++. Java is only as portable as the unlying JVM implementation, which is usually written in C(++). This makes Java in fact LESS portable than C++. the number of platforms without a C/C++ compiler is very small, much smaller than the number without a JVM.

    Java is simply a higher level language with a richer set of high quality API's.
    Java is not higher level than C++, they are both the same level (3GLs). An example of a higher level language would be Lisp or functional languages. Java is just somewhat more specialised into a particular domain than C++, that doesn't make it higher level though.
    As for the APIs, that's open to debate. I'd argue there are a richer set of APIs for C++, they may not be bundled with the language, but they are available.

    In terms of flexibiliy, C++ wins hands down. It's all about choice - to use OOP or not, to have GC or not, to have buffer security checks or not, etc. In Java it's all about shoehorning your app into Sun's vision of the one true programming style. If you app happens to fit that style already, then great, use Java it'll be quicker and easier, but it's a less general purpose language than C++ because of it.

    As for speed, outside of trite example code, usually written in such a way as to validate the tester's preconceptions, C++ tends to win. If java compilers existed to a large extent, and you could remove part or all of the JVM if required then it might be different. That would remove some key features of Java though, so it's unlikely to happen.

    NB: The above is all from my point of view (3d games programmer) of course, though I've tried to be reasonably objective.

    FWIW I don't consider Java, even with the 1.5 enhancements to 3d to be of acceptable quality for use in a realtime 3d environment.

  3. #19
    Goat Boy
    Join Date
    Jul 2003
    Location
    Alexandra Park, London
    Posts
    2,428
    Thanks
    0
    Thanked
    0 times in 0 posts
    Quote Originally Posted by Butcher
    Java is not totally portable, nor is C++. Java is only as portable as the unlying JVM implementation, which is usually written in C(++). This makes Java in fact LESS portable than C++. the number of platforms without a C/C++ compiler is very small, much smaller than the number without a JVM.
    Come on! The products my company produces in Java run (without a SINGLE line of code change) on Win32, Linux, Solaris, OSX and BSD. You cannot say the same of C++.
    "All our beliefs are being challenged now, and rightfully so, they're stupid." - Bill Hicks

  4. #20
    Senior Member
    Join Date
    Jan 2005
    Location
    Manchester
    Posts
    2,901
    Thanks
    67
    Thanked
    182 times in 136 posts
    • Butcher's system
      • Motherboard:
      • MSI Z97 Gaming 3
      • CPU:
      • i7-4790K
      • Memory:
      • 8 GB Corsair 1866 MHz
      • Storage:
      • 120GB SSD, 240GB SSD, 2TB HDD
      • Graphics card(s):
      • MSI GTX 970
      • PSU:
      • Antec 650W
      • Case:
      • Big Black Cube!
      • Operating System:
      • Windows 7
    Yes you can, as long as you write the C++ to be portable. It's not uncommon to use the same codebase for multiple platforms in C++.

  5. #21
    Junior Senior Member Aaron's Avatar
    Join Date
    Jul 2003
    Location
    London, England
    Posts
    1,516
    Thanks
    0
    Thanked
    1 time in 1 post
    Actually I find this statement both snobbish, elitist and utterly wrong.

    Any programmer choosing their programming language based on nothing other than whether it is "serious" or not is being desperately unprofessional. Choose the right tool for the right job. Simple as that.
    Aplogises, I didn't mean to sound snobbish. I'm pretty language-agnostic and I wasn't trying to say that one was better than the other. What I meant was that programmers working on long-term, large-scale projects such as large software applications will typically choose C++. That's not to say that you can't do it in Java though. Eclipse is written in Java and it's fine in terms of speed and features, IMO.

  6. #22
    Goat Boy
    Join Date
    Jul 2003
    Location
    Alexandra Park, London
    Posts
    2,428
    Thanks
    0
    Thanked
    0 times in 0 posts
    I've worked on large (£3M+) C++ projects that never made it into production on account of poor memory management.
    "All our beliefs are being challenged now, and rightfully so, they're stupid." - Bill Hicks

  7. #23
    Goat Boy
    Join Date
    Jul 2003
    Location
    Alexandra Park, London
    Posts
    2,428
    Thanks
    0
    Thanked
    0 times in 0 posts
    Quote Originally Posted by Butcher
    Yes you can, as long as you write the C++ to be portable. It's not uncommon to use the same codebase for multiple platforms in C++.
    They may well have the same codebase, but I very much doubt that they would have been as portable as my java application.
    "All our beliefs are being challenged now, and rightfully so, they're stupid." - Bill Hicks

  8. #24
    Senior Member
    Join Date
    Jan 2005
    Location
    Manchester
    Posts
    2,901
    Thanks
    67
    Thanked
    182 times in 136 posts
    • Butcher's system
      • Motherboard:
      • MSI Z97 Gaming 3
      • CPU:
      • i7-4790K
      • Memory:
      • 8 GB Corsair 1866 MHz
      • Storage:
      • 120GB SSD, 240GB SSD, 2TB HDD
      • Graphics card(s):
      • MSI GTX 970
      • PSU:
      • Antec 650W
      • Case:
      • Big Black Cube!
      • Operating System:
      • Windows 7
    Depends what you call portable really. The C++ is as portable as the code is written to be, much of the system specific code is hidden in libraries, or specific files. Standard compliant C++ is portable to any platform with a compiler, without modification. By contrast the Java is as portable as the JVM, all of the system specific code is hidden in libraries in the JVM. There's really not that much of a porting advantage to Java over C++ as long as you're a bit careful.

    Java is better for portability if you just want to leap in and throw down the first code you think of (which can be useful at times). If you're planning to design the code first and think about it, then there's little to recommend one over the other (from a portability standpoint).

    Incidentally, I've written plenty of C++ code that runs on platforms your Java wouldn't - can you say the same.

  9. #25
    Goat Boy
    Join Date
    Jul 2003
    Location
    Alexandra Park, London
    Posts
    2,428
    Thanks
    0
    Thanked
    0 times in 0 posts
    How many (useful) applications have you written that use nothing other than the standard C libraries?
    "All our beliefs are being challenged now, and rightfully so, they're stupid." - Bill Hicks

  10. #26
    Senior Member
    Join Date
    Jan 2005
    Location
    Manchester
    Posts
    2,901
    Thanks
    67
    Thanked
    182 times in 136 posts
    • Butcher's system
      • Motherboard:
      • MSI Z97 Gaming 3
      • CPU:
      • i7-4790K
      • Memory:
      • 8 GB Corsair 1866 MHz
      • Storage:
      • 120GB SSD, 240GB SSD, 2TB HDD
      • Graphics card(s):
      • MSI GTX 970
      • PSU:
      • Antec 650W
      • Case:
      • Big Black Cube!
      • Operating System:
      • Windows 7
    In my line of work none (I generally require 3d support), but then I can't use Java either.

    On the other hand, if you're doing something less user-oriented, like data processing, compression or such then writing an app in standard C++ is more than possible - after all you have access to files, keyboard + screen (text only), full computation abilities. What more do you need really? I've used many image processing and other processing apps which are pure C/C++.

  11. #27
    ?!
    Join Date
    Sep 2004
    Posts
    1,045
    Thanks
    2
    Thanked
    6 times in 5 posts
    Quote Originally Posted by DaBeeeenster
    This is NOT TRUE. Java is often FASTER than C++ in tight looping (i.e. a server environment).

    http://www.idiom.com/~zilla/Computer...benchmark.html

    Google "java C++ performance". The trick is twofold:
    1. The JVM can make processor based optimisations to the java bytecode before execution
    2. The JVM can perform run-time optimisation.

    C/C++ gives you neither of these things.
    It has improved a lot, especially now the JVM's can read into the cpu in use and attempt to improve the decoding before execution, but this is only recently.

  12. #28
    DsW
    DsW is offline
    Senior Member
    Join Date
    Aug 2003
    Location
    Glasgow
    Posts
    292
    Thanks
    0
    Thanked
    0 times in 0 posts
    Quote Originally Posted by Aaron
    What I meant was that programmers working on long-term, large-scale projects such as large software applications will typically choose C++. That's not to say that you can't do it in Java though. Eclipse is written in Java and it's fine in terms of speed and features, IMO.
    In my company, the balance has actually shifted to Java being the choice for all projects (incl. large scale and long-term) unless there is a specific reason to use C++ e.g. specific client requirement, resource availability, or performance.

    I think it's also true that the choice of language depends on who you have available to do the job. In other words if you only have 3 C++ developers available at the time then you'd do it in C++. If the programmers coming out of Uni and College have more Java experience than C++ then the balance in the industry will shift towards Java.

    Quote Originally Posted by Butcher
    In Java it's all about shoehorning your app into Sun's vision of the one true programming style. If you app happens to fit that style already, then great, use Java it'll be quicker and easier, but it's a less general purpose language than C++ because of it.
    I don't see how you have to 'Shoehorn your app' into Sun's programming style. Your only constraint is the capability of the language, and this is true for all languages. If you want to do something outwith the language's capability then choose a more appropriate language - simple as that. No one is forcing you to use Java.

    I also don't see how Java is less general purpose than C++?

    cheers,
    dave

  13. #29
    Senior Member
    Join Date
    Jan 2005
    Location
    Manchester
    Posts
    2,901
    Thanks
    67
    Thanked
    182 times in 136 posts
    • Butcher's system
      • Motherboard:
      • MSI Z97 Gaming 3
      • CPU:
      • i7-4790K
      • Memory:
      • 8 GB Corsair 1866 MHz
      • Storage:
      • 120GB SSD, 240GB SSD, 2TB HDD
      • Graphics card(s):
      • MSI GTX 970
      • PSU:
      • Antec 650W
      • Case:
      • Big Black Cube!
      • Operating System:
      • Windows 7
    Quote Originally Posted by wilkied
    I think it's also true that the choice of language depends on who you have available to do the job. In other words if you only have 3 C++ developers available at the time then you'd do it in C++. If the programmers coming out of Uni and College have more Java experience than C++ then the balance in the industry will shift towards Java.
    Very true, and probably the largest factor in language choise (at least it should be!)

    Quote Originally Posted by wilkied
    I also don't see how Java is less general purpose than C++?
    Because you're tied in with the JVM and automatic GC it means you have less flexibility for certain types of app. In terms of desktop apps and server apps, you can use one or the other. But for more specialised fields like embedded, system level drivers, etc. java becomes difficult if not impossible to use due to having to have a JVM available for it.
    Maybe general purpose was the wrong wording - multi-purpose is perhaps closer to what I meant.

  14. #30
    Goat Boy
    Join Date
    Jul 2003
    Location
    Alexandra Park, London
    Posts
    2,428
    Thanks
    0
    Thanked
    0 times in 0 posts
    Quote Originally Posted by Butcher
    Very true, and probably the largest factor in language choise (at least it should be!)


    Because you're tied in with the JVM and automatic GC it means you have less flexibility for certain types of app. In terms of desktop apps and server apps, you can use one or the other. But for more specialised fields like embedded, system level drivers, etc. java becomes difficult if not impossible to use due to having to have a JVM available for it.
    Maybe general purpose was the wrong wording - multi-purpose is perhaps closer to what I meant.
    I run Java on my company web servers, serving sites with up to 500,000 page views per day, I run Java on my desktop to run my IDE (Intellij IDEA) and I have Java on my phone running J2ME. How is that not multi-purpose?
    "All our beliefs are being challenged now, and rightfully so, they're stupid." - Bill Hicks

  15. #31
    DsW
    DsW is offline
    Senior Member
    Join Date
    Aug 2003
    Location
    Glasgow
    Posts
    292
    Thanks
    0
    Thanked
    0 times in 0 posts
    Quote Originally Posted by Butcher
    Because you're tied in with the JVM and automatic GC it means you have less flexibility for certain types of app. In terms of desktop apps and server apps, you can use one or the other. But for more specialised fields like embedded, system level drivers, etc. java becomes difficult if not impossible to use due to having to have a JVM available for it.
    Maybe general purpose was the wrong wording - multi-purpose is perhaps closer to what I meant.
    I don't think automatic GC is a big issue to be honest, and in fact in many ways it's actually an advantage.

    I think it is true, however, that specialised fields such as embedded or system level drivers may be more suited to the likes of C++, but you can equally say that Java is more suited to the likes of Web development and mobile apps than C++ and so it's swings and roundabouts really.

    C++ and Java both have their merits and both are better in some areas than the other. I don't think it's as clear cut as one is better than the other.

    Choose the best language for the job.

  16. #32
    Gentoo Ricer
    Join Date
    Jan 2005
    Location
    Galway
    Posts
    11,048
    Thanks
    1,016
    Thanked
    944 times in 704 posts
    • aidanjt's system
      • Motherboard:
      • Asus Strix Z370-G
      • CPU:
      • Intel i7-8700K
      • Memory:
      • 2x8GB Corsiar LPX 3000C15
      • Storage:
      • 500GB Samsung 960 EVO
      • Graphics card(s):
      • EVGA GTX 970 SC ACX 2.0
      • PSU:
      • EVGA G3 750W
      • Case:
      • Fractal Design Define C Mini
      • Operating System:
      • Windows 10 Pro
      • Monitor(s):
      • Asus MG279Q
      • Internet:
      • 240mbps Virgin Cable
    Quote Originally Posted by DaBeeeenster
    This is NOT TRUE. Java is often FASTER than C++ in tight looping (i.e. a server environment).

    http://www.idiom.com/~zilla/Computer...benchmark.html

    Google "java C++ performance". The trick is twofold:
    1. The JVM can make processor based optimisations to the java bytecode before execution
    2. The JVM can perform run-time optimisation.

    C/C++ gives you neither of these things.
    Say what? what a load of garbage, what do you think your JVM was written in? C/C++ thats what, to say that Java performs faster than C/C++ in any way is just utterly wrong and thoughtless, OS code is written in C and Assembly. And the majority of deamons also use C, some with Assembily optimisations

    If your looping acctually DOES perform better in Java than C++, then the problem isn't with the language, its with your sloppy and ineffient loop.
    Last edited by aidanjt; 01-02-2005 at 03:03 PM.

Page 2 of 3 FirstFirst 123 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Developers browser...
    By Agent in forum Software
    Replies: 10
    Last Post: 09-08-2004, 06:39 PM
  2. Warning all developers!
    By DaBeeeenster in forum General Discussion
    Replies: 5
    Last Post: 06-08-2003, 12:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •