473,379 Members | 1,245 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Java better than C++

13,262 8TB
OK shoot me, but with the latest additions to java most of the claimed advantages of C++ over java have disappeared and I now wait to get one clear non-arguable advantage of C++ over Java for the software developer.
Oct 4 '06 #1
28 5499
ronverdonk
4,258 Expert 4TB
See also my entry in this forum's thread Best programming language.

This dicussion is the same as: why is Ford better then GM?
People tend to stick to what they have learned and have coming to like. And if you learned all in's and out's of C++, you usually stick with it until you need something that isn't posisble in C++, only then you will look for a better language. Or maybe curiosity. But usually not on objective, measureable, grounds.

So your statement may be true for you, it maybe not for someone else.

Ronald :cool:
Oct 5 '06 #2
r035198x
13,262 8TB
See also my entry in this forum's thread Best programming language.

This dicussion is the same as: why is Ford better then GM?
People tend to stick to what they have learned and have coming to like. And if you learned all in's and out's of C++, you usually stick with it until you need something that isn't posisble in C++, only then you will look for a better language. Or maybe curiosity. But usually not on objective, measureable, grounds.

So your statement may be true for you, it maybe not for someone else.

Ronald :cool:
While it is generally true that one prefers what one already knows, for true comparisons this should not be an issue. Just because I've spent more time coding in c than I have in Java should not be something I use to compare the two languages.
Instead we should look at
garbage collection effort, platform dependance, speed, areas of application, paradigm support etc.
It does not matter how many times I have written a destructor in c++, the Java gc is much better for me the programmer and similar arguments...
Oct 5 '06 #3
Although Java is more portable across environments, if I had to write some quick and dirty and small program to update something on someones system, it would be in C++.

The only thing that scares me about Java is the reliance on the RTE and library stuff. I also have more of a feeling of what is happening with C++ and what will be slow or fast.

Other than that, I think Java should be encouraged so that it can be ported strait to Linux or vise versa.

Hmm, I Suppose that I really should take another look at it.
Oct 17 '06 #4
r035198x
13,262 8TB
Although Java is more portable across environments, if I had to write some quick and dirty and small program to update something on someones system, it would be in C++.

The only thing that scares me about Java is the reliance on the RTE and library stuff. I also have more of a feeling of what is happening with C++ and what will be slow or fast.

Other than that, I think Java should be encouraged so that it can be ported strait to Linux or vise versa.

Hmm, I Suppose that I really should take another look at it.
Certainly when correct programming is done,
c++ will be faster than java and c++ will
get you closer to the memory.
My argument is these days speed of a programming laguage
is no longer an issue and getting better
control of memory is also not neccessary
owing to the increasing speed of processors
Oct 17 '06 #5
Banfa
9,065 Expert Mod 8TB
My argument is these days speed of a programming laguage
is no longer an issue and getting better
control of memory is also not neccessary
owing to the increasing speed of processors
Then that must be the platform you work on. When you have a ~200MHz processor and you are trying to stream several megabits/second of data through it then speed of your language and the efficiency with which the compiler converts it to efficent machine code are still big considerations.

And on GC in a embedded application when memory is normally an extremely tight resource then a GC just does not provide enough control of memory allocation/deallocation.

Don't get me wrong, Java is good at what it does and has lots of plus points. It just is not suited to all platforms and to be honest would really expect any 1 language to ever achieve that?
Oct 23 '06 #6
r035198x
13,262 8TB
Then that must be the platform you work on. When you have a ~200MHz processor and you are trying to stream several megabits/second of data through it then speed of your language and the efficiency with which the compiler converts it to efficent machine code are still big considerations.

And on GC in a embedded application when memory is normally an extremely tight resource then a GC just does not provide enough control of memory allocation/deallocation.

Don't get me wrong, Java is good at what it does and has lots of plus points. It just is not suited to all platforms and to be honest would really expect any 1 language to ever achieve that?
You are right. How we all wish there was just one platform where everything runs on! But to be more honest, which language do you think suits more platforms than other languages?
Oct 24 '06 #7
bartonc
6,596 Expert 4TB
You are right. How we all wish there was just one platform where everything runs on! But to be more honest, which language do you think suits more platforms than other languages?
Since wxWidgets got wrapped for Python, this language (often overlooked on this forum for some reason) now looks native on all platforms supported by wxWidgets. Has GC and is actually readable by a mere human.
Nov 17 '06 #8
drhowarddrfine
7,435 Expert 4TB
which language do you think suits more platforms than other languages?
Assembly. As portable as C and runs anywhere, at least on the same processor. Syntax is pretty much the same no matter what assembler you use and there are few abstractions or ambiguities.
Nov 17 '06 #9
bartonc
6,596 Expert 4TB
Assembly. As portable as C and runs anywhere, at least on the same processor. Syntax is pretty much the same no matter what assembler you use and there are few abstractions or ambiguities.
Yep. I began my illustrious (ha-ha) carrer writing in assembler (moto style) and still enjoy thinking like a compiler (as an intelectual challange). But seriously, abstaction is what good languages do well, is it not?
Nov 17 '06 #10
drhowarddrfine
7,435 Expert 4TB
That's right and it can be helpful but it adds to the confusion. I started out in hardware so assembly was the only thing. Actually, coding in hex. I do the same as you. I visualize pointers in C as the actual register pointing at a memory address. When code starts 'dereferencing objects' I get a little crazy.
Nov 17 '06 #11
sashi
1,754 Expert 1GB
OK shoot me, but with the latest additions to java most of the claimed advantages of C++ over java have disappeared and I now wait to get one clear non-arguable advantage of C++ over Java for the software developer.
Hi everyone,

Java? C++? which one? I prefer to use C++ as it enables pointers, pointers can be very handy. Some of my friends even claim that Java is the mother of C++? Any review on that? Good luck & Take care.
Nov 19 '06 #12
drhowarddrfine
7,435 Expert 4TB
Some of my friends even claim that Java is the mother of C++? Any review on that?
They may be talking about the OOP part of C++ but C is the mother of C++. Bjarne Stroustrup worked at Bell Labs with K&R and never worked at Sun.

In fact, Bjarne himself says Java inherited C++ features. Bjarne Stroustrup
Nov 19 '06 #13
ronverdonk
4,258 Expert 4TB
That's right and it can be helpful but it adds to the confusion. I started out in hardware so assembly was the only thing. Actually, coding in hex. I do the same as you. I visualize pointers in C as the actual register pointing at a memory address. When code starts 'dereferencing objects' I get a little crazy.
Those we the days! I think C and embedded assembler is still the way to do it, best of both worlds. At least you have some feeling for the computer and its inner workings. OOP and Windows spoiled all that, it's like assembling Lego bricks now.

Ronald :cool:
Nov 19 '06 #14
MMcCarthy
14,534 Expert Mod 8TB
Those we the days! I think C and embedded assembler is still the way to do it, best of both worlds. At least you have some feeling for the computer and its inner workings. OOP and Windows spoiled all that, it's like assembling Lego bricks now.

Ronald :cool:
Since I've never used either language commercially I won't comment on preformance of C++ vs. Java.

One point I would like to make is C is the first language I ever learned and I believe sometimes that all programmers should have to learn it as a rule. The basic understanding of C provides a progammer with an understanding of the rules of programming that is just not provided in my experience with instruction in C++ or Java.

I remember in college a student asked the Java lecturer if a method was like a function. To which she replied, there are no such things as functions in OO programming.

What do you think?

Mary
Nov 19 '06 #15
drhowarddrfine
7,435 Expert 4TB
I think C and embedded assembler is still the way to do it
Ronald :cool:
Great minds think alike. I have no use for anything else.
Nov 20 '06 #16
r035198x
13,262 8TB
In fact, Bjarne himself says Java inherited C++ features
That's the point. Not only did it inherit C++ features, but lots of features from other languages.
Nov 28 '06 #17
Ganon11
3,652 Expert 2GB
HTML beats all. O_o

Seriously, though, I think it's a matter of preference. I'm only a senior in High School, but I've already learned VB, Java, and C++. I've been learning C++ pretty extensively lately, so I'd say I'd be better at programming using C++. But I remember when learning Java that it seemed more user-friendly - closer to the english language, so concepts were easier to understand. But this is all a matter of preference. As someone already said, 'best' is a relative term. For example, if I were to try and tackle a project with several classes using inheritance, etc, I would use Java, since that makes a lot more sense to me (and I haven't run across unexplained problems in Java like I have in C++). If I were to try and tackle other types of problems, I might use C++, since it is generally faster on my computer and the material (syntax, etc) is still fresh in my head. But would I say any is better than another? No, I don't think I could say that.

But VB is lame. :P
Nov 28 '06 #18
Banfa
9,065 Expert Mod 8TB
C is the mother of C++
More like an older sibling I'd say.

The latest versions of C have borrowed features from C++, if you look at the development paths of C and C++ you will find that you can just about find a point where they both inherited from the same predecessor but that development is then along separate branches with exchange of ideas happening in both directions between the 2 branches.

On the occasions when I have used Java I have tended to find it irritating, most recently the most irritating feature was the IDE I was using assuming that it needed to compile everything in the source tree despite some of the files being C++ files, but when I tried to remove those files from it's compile source tree it deleted them from the disk too, where as I wanted them on the disk I just didn't want it to compile them. Sort of "If I can't compile them then no-one can".

I really really really hate programs that think they are somehow more inteligent then me.
Nov 28 '06 #19
drhowarddrfine
7,435 Expert 4TB
I really really really hate programs that think they are somehow more inteligent then me.
It's why I struggle so with high-level languages. This was years ago but I remember when three of us hardware engineers were told to start writing our code in C. You'd hear these yelps from the other rooms when guys would find pointers and data not winding up where they were supposed to and cries of "I don't have these problems when I write in assembly!"
Nov 28 '06 #20
r035198x
13,262 8TB
More like an older sibling I'd say.

The latest versions of C have borrowed features from C++, if you look at the development paths of C and C++ you will find that you can just about find a point where they both inherited from the same predecessor but that development is then along separate branches with exchange of ideas happening in both directions between the 2 branches.

On the occasions when I have used Java I have tended to find it irritating, most recently the most irritating feature was the IDE I was using assuming that it needed to compile everything in the source tree despite some of the files being C++ files, but when I tried to remove those files from it's compile source tree it deleted them from the disk too, where as I wanted them on the disk I just didn't want it to compile them. Sort of "If I can't compile them then no-one can".

I really really really hate programs that think they are somehow more inteligent then me.
One day I'll start a thread about these IDEs that have been thrust upon us.
Unfortunately many beginners are starting out on IDEs these days, practice I think is unhealthy for the programming community.
Nov 28 '06 #21
drhowarddrfine
7,435 Expert 4TB
Agree. Can anyone program in Windows without Visual Studio?
Nov 28 '06 #22
bartonc
6,596 Expert 4TB
Agree. Can anyone program in Windows without Visual Studio?
Yep! With native look and feel using wxPython extentions (wrapper of the C++ wxWidgets) We get free database without MS, too.
Nov 28 '06 #23
bartonc
6,596 Expert 4TB
Yep! With native look and feel using wxPython extentions (wrapper of the C++ wxWidgets) We get free database without MS, too.
Can anyone else program on Windows without Visual Studio?
Dec 2 '06 #24
Banfa
9,065 Expert Mod 8TB
Can anyone else program on Windows without Visual Studio?
Yep, I've been writing Windows programs in C since 1989 when it was Windows 2 and before Visual Studio existed.

I could very easily write a Windows program making direct API calls using any bog standard text editor if I chose.
Dec 2 '06 #25
drhowarddrfine
7,435 Expert 4TB
There's two. heh.

I've downloaded the console version of VisualC++, I think it's called Visual Toolkit, and played with that. It's the compiler with tools but no gui.

I've written a few small apps in assembly for Windows, too. But now I do everything in FreeBSD and have no use for any of that.
Dec 2 '06 #26
bartonc
6,596 Expert 4TB
Yep, I've been writing Windows programs in C since 1989 when it was Windows 2 and before Visual Studio existed.

I could very easily write a Windows program making direct API calls using any bog standard text editor if I chose.
Does "if I chose" mean that this is not really a practical solution, but merely possibility?
Dec 2 '06 #27
drhowarddrfine
7,435 Expert 4TB
You can, it's just that a lot of people nowadays seem lost unless they have VS. Partly because they have to manage all the files manually or set up another IDE to do so. It's just kind of funny when I see someone ask a question about how to do some code and they say, "Well, go to tools->options-> in VS...".

I'm exaggerating a little but it sure seems that way.
Dec 2 '06 #28
Banfa
9,065 Expert Mod 8TB
Does "if I chose" mean that this is not really a practical solution, but merely possibility?
No it's really not that hard it is just easier to use an IDE particularly for resource editing,

First write a Window Handler Procedure

Then in WinMain

Register a Window Class (this is a construct of Windows nothing to do with C++) with RegisterClass
Create a Window of that Class with CreateWindow
Enter a message loop.
Expand|Select|Wrap|Line Numbers
  1. BOOL bRet;
  2.  
  3. while( (bRet = GetMessage( &msg, NULL, 0, 0 )) != 0 ) 
  4. {
  5.    if (bRet == -1 )
  6.    {
  7.       // handle the error and possibly exit
  8.    }
  9.    else
  10.    {
  11.       TranslateMessage( &msg );
  12.       DispatchMessage( &msg );
  13.    }
  14. }
And that is all there is to it, of course if you want menus and other resources you will need a resource file too, those can be written by hand but even before Visual Studio existed there where GUI programs to do the resource editing.
Dec 2 '06 #29

Sign in to post your reply or Sign up for a free account.

Similar topics

73
by: RobertMaas | last post by:
After many years of using LISP, I'm taking a class in Java and finding the two roughly comparable in some ways and very different in other ways. Each has a decent size library of useful utilities...
16
by: Thomas G. Marshall | last post by:
This message is sent to these newsgroups because they are no longer valid: comp.lang.java comp.lang.java.api comp.lang.java.bugs comp.lang.java.misc comp.lang.java.setup comp.lang.java.tech
3
by: Sai Kit Tong | last post by:
I posted for help on legacy code interface 2 days ago. Probably I didn't make it clear in my original mail. I got a couple of answers but none of them address my issues directly (See attached...
9
by: babylon | last post by:
i just read this (http://java.sun.com/developer/technicalArticles/releases/j2se15/) am I correcting on these concepts? Java Metadata == C# Attribute (java learn from c#?) Java Generics == C#...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
458
by: wellstone9912 | last post by:
Java programmers seem to always be whining about how confusing and overly complex C++ appears to them. I would like to introduce an explanation for this. Is it possible that Java programmers...
12
by: firehead.satish | last post by:
Hello All, I have seen a lot of forums that are fight over these 2 languages. Disadvantages 1) When a complete java application has been written and it has to be packaged then entire JRE...
27
by: Generic Usenet Account | last post by:
Apologies if someone finds this OT I am looking for an open-source C++ implementation of Java API ---- something that does not require a Java run-time environment. So far the only thing that I...
66
by: flarosa | last post by:
Hi, I'm wondering if I can get a reasonably civil (without starting any huge wars) opinion on how server-side PHP compares to server-side Java. I've been strictly a Java developer for almost...
63
by: s0suk3 | last post by:
I've been programming Python for a couple of years now. Now I'm looking to move on to either C++ or Java, but I'm not sure which. Which one do you think will be a better transition for a Python...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.