CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9
  1. #1
    Join Date
    Jan 2010
    Posts
    1

    How java is better from c++ in term of quality and maintenance ?

    Java programming language is superior to C++ (in my opinion)

    I have a presentation in few days where I need to point why to choose JAVA over C++ in order to make a better quality product which is also better to maintain.

    Lets say you have 6 month to design and implement a project. Why would it be better in terms of quality and maintainability if I choose JAVA ?

    Please share your thoughts,

    Thanks
    Dan

  2. #2
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    Re: How java is better from c++ in term of quality and maintenance ?

    You said you believe Java is superior to C++, so you should be able to answer that question yourself - if you have good reason to believe that.

    IMO programming languages (and their implementations) are tools. You pick the most appropriate tool for the job in a given context.

    Quality and maintainability depend on the programmer, although it would be fair to say that Java gives you less opportunity to shoot yourself in the foot, and Javadoc is a useful aid to maintainability.

    When a programming language is created that allows programmers to program in simple English, it will be discovered that programmers cannot speak English...
    Anon.
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

  3. #3
    Join Date
    Aug 2005
    Posts
    198

    Re: How java is better from c++ in term of quality and maintenance ?

    It's not deterministic, but ...

    pro Java:
    1. Getting it done quickly.
    2. Ending up with code that is far easier to understand.
    3. Not as much potential for memory leakage and memory-triggered crashes (due to the GC Java environment).

    pro C++:
    1. Ending up with a quicker performing app.

    So... quickly developed and easier to maintain in Java vs better, but riskier, performance in C++.

    From most of the code I've seen, there's absolutely no doubt in my mind that a C++ app will be much harder to maintain - unless you force certain rules such as no pointer arithmetic, multiple inheritance, and no #define macros.
    David Anton
    Convert between VB, C#, C++, & Java
    www.tangiblesoftwaresolutions.com
    Instant C# - VB to C# Converter
    Instant VB - C# to VB Converter

  4. #4
    Join Date
    Apr 2007
    Posts
    425

    Re: How java is better from c++ in term of quality and maintenance ?

    Quote Originally Posted by David Anton View Post
    It's not deterministic, but ...

    pro C++:
    1. Ending up with a quicker performing app.
    This was once the case, but it's very arguable. On low-level and numeric benchmarks Java is at par or sometimes ahead of c/c++. Consider pointer arithmetic for example when performed in c or c++. You cannot know where the memory location will be allocated from and as such cannot place a widely used value (in arithmetic for example) inside of a register, where with the java equivalent you would be able to. This would cause your C program to constantly be swapping this value in and out of cache while evaluating.

    The other big thing has to do with memory allocation, where new/malloc's will look for the first contiguous size of memory that you requested from the system, and the lookup has to be done. under the jvm, you have access to a pool that is predefined, and since every reference variable will pull the next chunk from this pool (and it is known ahead of time where to pull this from as well), it is highly more likely that this memory location is already in the cache.

    I think the measure of speed between the two comes down to the choice of frameworks and libraries used in projects.

    big pros for java:
    maven, IOC containers, annotation support, simplicity of integrating with AOP.

    Take a look at java ee6, which has brought in dependency injection of some sort into the stack as well:
    http://java.sun.com/developer/techni...6Overview.html
    ------
    If you are satisfied with the responses, add to the user's rep!

  5. #5
    Join Date
    Aug 2005
    Posts
    198

    Re: How java is better from c++ in term of quality and maintenance ?

    Yeah - I haven't done any recent research on the performance issue.
    It would be interesting to see what's used for life-and-death critical apps where every millisecond counts (medical, military, aerospace, ... ).

    (Something tells me it's not Java or any other GC language like VB.NET).
    David Anton
    Convert between VB, C#, C++, & Java
    www.tangiblesoftwaresolutions.com
    Instant C# - VB to C# Converter
    Instant VB - C# to VB Converter

  6. #6
    Join Date
    Apr 2007
    Posts
    425

    Re: How java is better from c++ in term of quality and maintenance ?

    Quote Originally Posted by David Anton View Post
    Yeah - I haven't done any recent research on the performance issue.
    It would be interesting to see what's used for life-and-death critical apps where every millisecond counts (medical, military, aerospace, ... ).

    (Something tells me it's not Java or any other GC language like VB.NET).
    like dlorde said, tools for the job.

    I have a few friends who work for the RCMP and they entered a proof of concept contest to use blue tooth over RF that was automatically activated based on noise frequency. They chose to use a small IC with some FPGA development using Verilog I believe, before doing the actual pressing.

    medical industry, it depends what you care about. If you need an online billing system or something that will be stateless, transactional, backed by database, Java, ASP, etc. can work great.

    As for the aerospace industry, it depends on their hardware, but they are still running very dated systems if I am not mistaken. Not sure what they are implementing in. I don't know anyone who works for NASA / country equivalent.
    ------
    If you are satisfied with the responses, add to the user's rep!

  7. #7
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    Re: How java is better from c++ in term of quality and maintenance ?

    I believe the US military standard recommends ADA, but I wouldn't be surprised if all kinds of languages are still being used. A lot of hardware companies use their own proprietary languages.

    There are only two kinds of programming languages: those people always ***** about and those nobody uses...
    Bjarne Stroustrup
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

  8. #8
    Join Date
    May 2009
    Posts
    2,413

    Re: How java is better from c++ in term of quality and maintenance ?

    Quote Originally Posted by daniel.yatush View Post
    I have a presentation in few days where I need to point why to choose JAVA over C++ in order to make a better quality product which is also better to maintain.
    It's much easier to claim that language X is much better than language Y than it is to actually demonstrate it. Such claims often come from people who don't know both languages sufficiently well to compare them objectively. It usually boils down to the familiarity factor. I prefer X because I know it very well and so it must be much better than Y which looks strange and quirky. In fact I've invested so much time and effort in X so it better be better than Y.

    Please feel free to try your luck. Post your best arguments in favour of Java and I'll show you how the same can be done in C++.

  9. #9
    Join Date
    May 2009
    Posts
    2,413

    Re: How java is better from c++ in term of quality and maintenance ?

    Quote Originally Posted by Deliverance View Post
    As for the aerospace industry, it depends on their hardware, but they are still running very dated systems if I am not mistaken. Not sure what they are implementing in. I don't know anyone who works for NASA / country equivalent.
    Because C++ is such a vast and complex language a common strategy is to only allow a subset in projects. If you still want to use some quirky esoteric feature you need to ask permission from the project manager. To make this work there must be an official coding standard in place and regular code reviews must be held to make sure everybody abides with it. Nobody likes to get their code scrutinized and criticized but in the end the gain in code quality is substantial. This is a good practice regardless of language.

    Here's an example. It's Lockheed Martin's C++ coding standard for the Joint Strike Fighter airplane,

    http://www2.research.att.com/~bs/JSF-AV-rules.pdf

    Of course only large corporations can afford to develop a document like this, but nothing prevents anyone from using it as a starting point for their own standard.

    I feel this "engineering" approach to software development is largely lacking in the Java community. Everybody seems to consider Java so "safe" that you can put it in the hands of just about anybody and let them hack away to their hearts desire and what comes out will be high quality. I don't buy that. I've seen more bad Java code than I've seen bad C++ code. I think one reason may be that in C++ projects nobody expects high quality to just emerge out of nowhere, whereas in Java projects everybody seems to think the language itself more or less guarantees high quality without effort.

    So good project organization is paramount for good code, probably more important than the choise of language.
    Last edited by nuzzle; January 19th, 2010 at 04:37 PM.

Tags for this Thread

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured