Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,168,992 members, 7,873,198 topics. Date: Thursday, 27 June 2024 at 09:47 AM

Java Or C++ - Programming (2) - Nairaland

Nairaland Forum / Science/Technology / Programming / Java Or C++ (3562 Views)

Should It Be Java Or Python For Game Development? / Programming Career In Either JAVA Or .NET / Web Service Using Java Or C# (2) (3) (4)

(1) (2) (Reply) (Go Down)

Re: Java Or C++ by logica(m): 11:16am On May 29, 2008
@sbucareer

i'm sure that was a rhetorical question.
Re: Java Or C++ by sbucareer(f): 12:24pm On May 29, 2008

No logica, I just want to be clear
Re: Java Or C++ by logica(m): 12:39pm On May 30, 2008
OK. I thought u are a programmer.

ps: c++ = c + 1 => a level higher than c. i don't think i need say more than that.
Re: Java Or C++ by ebot: 7:56pm On May 31, 2008

OK. I thought u are a programmer.

ps: c++ = c + 1 => a level higher than c. i don't think i need say more than that.


@logica
thumbs up grin
Re: Java Or C++ by Ghenghis(m): 7:41am On Jun 02, 2008
ebot:



@logica
thumbs up grin

I'm sure its more than a level.

Many people just use them interchangeably, thats wrong.

Did you know that a lot of the solaris OS was written in Object C ,

How many levels ahead of C would that be grin
If you've written C++ and C , you'd know the difference ,
Re: Java Or C++ by logica(m): 4:36pm On Jun 02, 2008
i was simply pointing out that the suffix "++" which happens to be the "increment" operator in the C language is there to show that C++ is an "increment" (advance 1 level) to C.
Re: Java Or C++ by Ghenghis(m): 5:15pm On Jun 02, 2008
logica:

i was simply pointing out that the suffix "++" which happens to be the "increment" operator in the C language is there to show that C++ is an "increment" (advance 1 level) to C.
Yeah, the pun is clear ,but in retrospect both languages are quite different. : wink
Bjarne used C as the vehicle for his new language because he wanted it to be adopted quickly by At & t people. So he tried to make everything that was valid in C valid in C++, but i doubt that is true anymore , C99 brought many new things on board.
Re: Java Or C++ by logica(m): 7:36pm On Jun 02, 2008
well, how different are they when c++ is a superset of c (meaning c became a subset of c++)? same cannot be said of c/c++ and java for instance as they are quite different.
Re: Java Or C++ by Nobody: 12:07am On Jun 04, 2008
The major difference between C and C++ is that C++ has object oriented features like, classes, inheritance, polymorphism etc.

Java is OO based too, but includes garbage collection and does not have those stupid pointers u see in C/C++.
Re: Java Or C++ by Ghenghis(m): 7:27pm On Jun 04, 2008
Another thing going for C++ is multiple inheritance , while Java has singly rooted hierarchy

for differences between C and C++ http://david.tribble.com/text/cdiffs.htm

Apart from the pointer thingy and large library java is also very much like C shocked
Re: Java Or C++ by javarules(m): 8:17pm On Jun 04, 2008
The most powerful programming language I have ever come across is c/c++.

Does that tell you something? yes I see no disparity between both.

You have doubts? MySQL c-based, Oracle c-based, Firefox c-based, Java c-based, Linux c-based, i can go on and on.

But dont mis-understand me, when I say c-based I mean c/c++ because you can't actually compile any of these from source(where source are available) without having both the gcc and g++ compilers(i mean c and c++ compilers).

The question I keep asking myself is this, where was Java when all these things are being developed using C.

I am not slighting Java because its actually my language of choice
Re: Java Or C++ by tomX1(m): 10:36pm On Jun 04, 2008
Well Java is great. I am in favour of C++ however.
Java users point out the strenght in Java and the weaknesses in C++ but Java has its Achiles heels too. I'll point out some of the weaknesses of java i.e. areas where C++ is known to out perform Java:

1. Speed - Because java is an "Interpreted code" it requires Java Virtual machine to interprete the programmes compilled byte code. This makes Java slower than equivalent native code produced by an optimised C++ compiler.

2. Poor low level access - Java has no pointers (while this is touted as one of it's strenght since it makes it simpler and easier to use) it is virtualy incapable of accessing a computer system on low level. This makes Java unsuitable for system software that perform such operations as calling BIOS and DOS subroutines and responding to interrupts. Java is not a good choice for writing operating systems, device drivers, and other low level code.

3. No Multiple inheritance - Java classes supports only single inheritance. In C++ a class may be derived from several base classes, while in Java a class may only be derived from one superclass. [a[b] limited [/b] form of multiple inheritance is possible using Java interface clases but it does not compare to the more sophisticated form of multiple in C++]

4. No bBackward compability with C - Any legacy code written in C will have to be totally re-written if it's desired in Java. C++ compilers are however able to tranlate C.

5. No support for in-line functions - Java does not support in-line function but C++ does. The use of inline functions provide programmers with optimisation techniques which have a great impact on program runtime speed. Java does not support source-level optimisations, and the code optimisations supported by Java compilers are not language specific.

This are just a few I picked out of a Book by one of my favourite Java Authors. (Tom Swan).
There are many advantage/ disadvantages to both languages and there are many shared points too. it wouldn't hurt to learn both languages. I've learned close to 8 programming languages (not counting scripting languages) but my favourite is C++. Learn as much as you can. Both languages are great.
Re: Java Or C++ by Ghenghis(m): 12:24pm On Jun 05, 2008
@tomX:

1. Speed - Because java is an "Interpreted code" it requires Java Virtual machine to interprete the programmes compilled byte code. This makes Java slower than equivalent native code produced by an optimised C++ compiler.
You are not necessarily correct, Java is compiled to bytecode then interpreted , thats the user friendly explanation. These days Java uses JIT (Just in Time Compilation),the run-time knows about the running environment and as such can take advantage of certain features/optimizations

Java programs can also be optimized by compilers

@tomX:

2. Poor low level access - Java has no pointers (while this is touted as one of it's strenght since it makes it simpler and easier to use) it is virtualy incapable of accessing a computer system on low level. This makes Java unsuitable for system software that perform such operations as calling BIOS and DOS subroutines and responding to interrupts. Java is not a good choice for writing operating systems, device drivers, and other low level code.
Yeah thats not necessarily a bad thing, what % of written code needs the kind of access you're talking about ?
Besides, there's JNI

@tomX:

3. No Multiple inheritance - Java classes supports only single inheritance. In C++ a class may be derived from several base classes, while in Java a class may only be derived from one superclass. [a limited form of multiple inheritance is possible using Java interface clases but it does not compare to the more sophisticated form of multiple in C++]
cheesy Have you used multiple inheritance before ?
In C++ there's something called object slicing , now imagine a class that thats up cast to say i grandparent like say object, if you make a polymorphic call which parent should be called ? If thats confusing, then so is multiple inheritance ,
Besides inheritance is not the best form of reuse, HAS - A is better than IS-A blah blah blah
Kids please stay away from multiple inheritance ,


@tomX:

4. No bBackward compability with C - Any legacy code written in C will have to be totally re-written if it's desired in Java. C++ compilers are however able to tranlate C.

hmmm, http://david.tribble.com/text/cdiffs.htm tongue

@tomX:

5. No support for in-line functions - Java does not support in-line function but C++ does. The use of inline functions provide programmers with optimisation techniques which have a great impact on program runtime speed. Java does not support source-level optimisations, and the code optimisations supported by Java compilers are not language specific.

Absolutely wrong!!!!
Have you heard of final methods, constant folding etc.

@tomX:

This are just a few I picked out of a Book by one of my favourite Java Authors. (Tom Swan).
There are many advantage/ disadvantages to both languages and there are many shared points too. it wouldn't hurt to learn both languages. I've learned close to 8 programming languages (not counting scripting languages) but my favourite is C++. Learn as much as you can. Both languages are great.
I agree with your summary though ,


Guys java has really matured, 13years in the making ,
people are getting to know more and do more,
java is not VB
hype time is over and the buzz is here
Say HURRAY if you're a java programmer grin
Re: Java Or C++ by javarules(m): 1:23pm On Jun 05, 2008
C++ or Java, Its just a question of what is it you want to do.I am yet to see a very functional OS written from ground up with Java, there is one OS on SourceForge some Jokers claim can compete with the likes of Unix and Linux, tried it and puff its blam.

So as I av said its a matter of what is it you want to do. If you want to write drivers, OSes and d likes i will definitely advise even the KIDS to stay with C++, but if you what you want is a compelling user interface across multiple screens of your live, write once run anywhere, intuitive technology backed by a Fortune 500 company and a community as large as you can have, with all the necessary hypes and buzz, then what you need is Java

Now I ask myself, will I rather write an OS or a Driver or a very good software that is actually usable? Its a matter of choice. I believe if C++ has the kind of backing Java has, it will also make sense for writing client side programs, even with IDE's it's still a little pain designing GUI's with C++.

What can't I give for Netbeans.

I beg leave story for market women java indeed rules.
Re: Java Or C++ by lucianoefe(m): 2:06pm On Jun 05, 2008
hey my lovely niaja pple,  rily missed u guys even though no one bothered to notice my absence,  love the topic here!!! i think i'll stick with c++ cos i've seen some real life applications of the lang. Though, i'm yet to understand java well, 
cheers pple.

kiss
Re: Java Or C++ by candylips(m): 1:50pm On Nov 12, 2009
^^^ Try to master that language. C++. and you will be a rockstar wink

(1) (2) (Reply)

Jave Script Or PHP / Complete COMPUTER SCIENCE Tutorial Course / Are There Any C# Developers In Nigeria?

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 35
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.