my dog learned polymorphism*
The moose likes C / C++ and the fly likes Is it worth to learn C++ if you use Java? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » C / C++
Bookmark "Is it worth to learn C++ if you use Java?" Watch "Is it worth to learn C++ if you use Java?" New topic
Author

Is it worth to learn C++ if you use Java?

Joey Sanchez
Ranch Hand

Joined: Jun 23, 2011
Posts: 86

It is not enough to learn one language if that programming language supports all you need to do. I mean, if you are focused in web developement, for instance, when are you going to need C++?
nishan satharasinghe
Greenhorn

Joined: Aug 27, 2008
Posts: 14
Can you please give us an idea. I have the same question
Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477

I think C++,gives you access to memory level operations using pointers etc.Which are handled inherently by the JVM in java.


Learning and Learning!-- Java all the way!
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39800
    
  28
If you go back a few years on this website, there was a lot of discussion about whether Java™ was easy enough to learn programming with, or too easy. I see a similar question came up recently: try here.
There are problems migrating between the two languages; there are differences in meaning hidden behind similar syntax.
Many people think Java™ is too easy, not exposing people to enough difficulty.

You can have all sorts of long discussions about that sort of thing.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19760
    
  20

When you need to use JNI, you will need to use a lower-level language. C and C++ are often used for this, as 1) there are plenty of good (and free) compilers available, and 2) most operating systems and libraries have support for using C / C++ for accessing them directly.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Luis Espinal
Greenhorn

Joined: Mar 06, 2009
Posts: 9
Joey Sanchez wrote:It is not enough to learn one language if that programming language supports all you need to do. I mean, if you are focused in web developement, for instance, when are you going to need C++?


I'd start by saying that no single programming language supports all we need to do for app development (in particular for web development.) Then, I'd add the following:

- "The act of trying to learn a new language will make you a better developer." ---- StackOverflow Podcast, episode #42


The path to a successful career in software, or in anything for that matter, is to always, always, always differentiate between your job and your career. Obviously, time constrains will dictate how much leeway one can have in learning stuff that is not directly applicable to one's current job tasks. However, it is important to be acquainted to the intricacies of both systems-level and application-level developer.

Now, this is just my opinion, and as objective as I think it is, it cannot escape the subjectivity of my own pre-conceptions. Ergo, please take this with a grain of salt.

Plus, you never know if web development is all you are going to do for a living. If we limits our knowledge to application development (or systems-level development for those sitting on the other side of that fence), how can we make informed decisions about our career paths.

Putting that aside, just for the sake of constant improvement in one's programming skills, learning a new language (in particular one very different from our bread and butter) is a must that should be done every once in a while. We are not talking about excellency or proficiency (that only comes from doing actual work.) A simple acquaintance suffices.

And IMO, knowing the basics of C or C++ sufficiently to write, compile and debug a not-too trivial toy program (even with the help of google), that should be a desirable trait.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61612
    
  67

In my opinion, it's always useful to learn a new language.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Angus Comber
Ranch Hand

Joined: Jul 16, 2011
Posts: 90
C++ is a good choice for writing high performance servers. Or software where performance is a big issue. You will have to deal with platform differences however which will be different from Java.

C++ is also a good choice for writing native programs for specific platforms. Eg a spreadsheet or word processor would be written in C++ (or C). Software houses writing platform specific software very frequently use C++. With C++ you can compile everything into a single executable and that is all you need to run the application.

Of course, if you need to write web applications then C++ is not so suitable.
Fei Ng
Ranch Hand

Joined: Aug 26, 2000
Posts: 1242
If you have time (rarely i know), love programming and curious why not? It would look good on your resume. Is it enough t learn one language that supports all? There is no such thing. Look at web development for example, C# , Java, Ruby.. You get the idea. They all have their advantages and weakness. Someday you might ended up in a game company working on C++ but then again they might have a web position that you could go to. So having more options is a good thing.
Raja Pal
Ranch Hand

Joined: Jul 12, 2004
Posts: 92
I think the dicussion is about whether it would be necessary to learn another lanugauge, if the existing one supports everything you need to do. Well, my answer would be "Yes, you will still need to learn!". Consider Mr.X who is great at assembly for a h/w platform that has transcended a time of 4 decades. He has done such a great deal of programming in Assembly, that pretty much anything the platform offers, he can do it, in his program. He can even emulate and simulate virtual env. of other systems. But still he will have to grow up, learn a new set of abstractions, sometimes simply to improve productivity, sometiimes simply to improve clarity of code, sometimes to build a feature in a more maintainable and flexible way. More often than not, it is not ability but usability that determines which langauge-tech environment givens quicer ROI/TTM that really matter. Yeah, with web-deveploment you may be fooled into believing Java is/will be sufficient...but truth shows otherwise. Why else do we have groovy-grails, ruby-rails and huge number of scripted platforms today?


Java Pal - Your friend in technology and innovation...India.
Brian Overland
author
Ranch Hand

Joined: Sep 09, 2011
Posts: 36
Hi. Elsewhere I have stated that learning C#, Java, C++ etc. are like learning Spanish, Latin, Italian, and French... once you understand one, the rest of the languages in the same family are a lot easier.

But it is also true, as someone stated, that similar languages can be tricky because although there are just a few differences here and there, those differences are aboslutely critical and losing sight of them will cause you headaches.

So as you go from one C-family lang to another, keep those vital differences in mind.

One huge thing to keep in mind about C++ vs. Java... Java is much more restrictive in its use of objects. If I'm not mistaken, objects in Java are only created by using "new", and you never have an object variable as such -- only references to objects.

C++ is far more flexible and gives you far more choices. One really nice advantage is that you can treat classes and objects not just as reference types, but as user-defined primitives. That is, I can define a "Fraction" data type, for example, in this case making a equal one half and b equal one third:

Fraction a(1, 2), b(1, 3);

Now I can define operator functions that work on these variables just as I would with primitive integers or floating point:

Fraction c = a + b;

Now I can print c, and the answer is what I'd like to see...

cout << c; // This statement will print "5/6" as expected.

Maybe you don't need this ability to define new data types, but it is one of the exceptional features of C++. But in going back to Java, you have to keep in mind that nothing like this is possible, you treat all "object variables" as references to objects only.

Hope this helps,

Brian Overland
 
jQuery in Action, 2nd edition
 
subject: Is it worth to learn C++ if you use Java?