Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Should I learn Java or C++?
Index -> General Programming
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
storm2713687




PostPosted: Tue Mar 05, 2013 11:52 am   Post subject: Should I learn Java or C++?

I've read the sticky'd thread already, but I'm just wondering if I should learn java or c++.
I know some turing, and later on when I get better using turing, I'm going to switch to either Java or C++ (which I'm thinking of java since it's more commonly used)
Sponsor
Sponsor
Sponsor
sponsor
DemonWasp




PostPosted: Tue Mar 05, 2013 12:23 pm   Post subject: RE:Should I learn Java or C++?

The question of whether C++ or Java is more commonly used is misleading, because overall statistics are less important than those about the specific kind of programming you want to do. If you want to program on web servers and for web service providers, then Java is way more common, but if you want to develop games at EA Games or Valve, then it's almost exclusively C++. There are dozens of other fields where you may find more of a mix.

Java is simpler, better documented, easier, and more portable.

C++ is faster, older, and more widely supported (very nearly every system [including most gaming consoles] has a compiler for C++, whereas Java "only" operates on Windows, OSX, Linux, BSD, Solaris, AIX, Android, feature phones and other J2ME devices, directly on some ARM chips, etc).

Eventually, it would be good to know both languages. No point in constraining yourself to just one or the other. You will find that both languages are simultaneously "larger" and clearer than Turing. Compared to either, Turing is not a well-designed language, and Turing has relatively little to learn: perhaps a dozen built-in types and a half-assed standard library, whereas both C++ and Java have massive standard libraries (Java moreso than C++).

You might want to try learning a simpler language first; I suggest Python. Python is simpler, easier, involves less boilerplate code than either C++ or Java, and presents easier error messages to the user. Plus, it has a friendly user-base that can answer questions with a reasonable degree of accuracy.
storm2713687




PostPosted: Tue Mar 05, 2013 12:41 pm   Post subject: Re: RE:Should I learn Java or C++?

DemonWasp @ Tue Mar 05, 2013 12:23 pm wrote:
The question of whether C++ or Java is more commonly used is misleading, because overall statistics are less important than those about the specific kind of programming you want to do. If you want to program on web servers and for web service providers, then Java is way more common, but if you want to develop games at EA Games or Valve, then it's almost exclusively C++. There are dozens of other fields where you may find more of a mix.

Java is simpler, better documented, easier, and more portable.

C++ is faster, older, and more widely supported (very nearly every system [including most gaming consoles] has a compiler for C++, whereas Java "only" operates on Windows, OSX, Linux, BSD, Solaris, AIX, Android, feature phones and other J2ME devices, directly on some ARM chips, etc).

Eventually, it would be good to know both languages. No point in constraining yourself to just one or the other. You will find that both languages are simultaneously "larger" and clearer than Turing. Compared to either, Turing is not a well-designed language, and Turing has relatively little to learn: perhaps a dozen built-in types and a half-assed standard library, whereas both C++ and Java have massive standard libraries (Java moreso than C++).

You might want to try learning a simpler language first; I suggest Python. Python is simpler, easier, involves less boilerplate code than either C++ or Java, and presents easier error messages to the user. Plus, it has a friendly user-base that can answer questions with a reasonable degree of accuracy.


Thanks Smile
I'm probably going to try out c++.
Is Python an easier version of C++?
Btw, I'm only using turing so I can ace compsci next year when I can finally take the course Razz
DemonWasp




PostPosted: Tue Mar 05, 2013 1:35 pm   Post subject: RE:Should I learn Java or C++?

There are no easier versions of C++. In fact, each successive version of C++ adds more features, which may make it easier to write good code, but means there is more to learn.

Python is a totally different language. It is more similar to Turing in syntax (how it "looks"), and its tools make it easier to try things (code snippets, ideas, etc) faster than a language like C++ or Java. It has simpler and easier string handling, objects, collections (lists, maps, sets), execution, etc. At the same time, it is every bit as "real" a tool as Java or C++: in fact, a lot of applications in GNU/Linux-based desktops are written mostly in Python.

If you are going to learn C++ fresh out of Turing then you need to find a really good book to help you learn the language. In the last 40-ish years there has been a lot of "history" built in to C++. This is not true of more recent languages like Java and Python (among many others), which can make them easier to learn if you don't have a good grasp on the history of programming. C++ both has the historical roughness as well as pretty well every feature you could conceivably put into the language, and you have to know most of them to understand typical code.
wtd




PostPosted: Fri Mar 15, 2013 2:33 am   Post subject: RE:Should I learn Java or C++?

Neither. Learn something completely different. Learn a functional programming language. It'll make you a better programmer.
Tony




PostPosted: Fri Mar 15, 2013 11:52 am   Post subject: RE:Should I learn Java or C++?

Going into C++ or Java to learn the basics of CS is bad news -- they are both way too heavy-weight. Java's main benefits are in enterprise software, while C++ typically sells on mission-critical-speed (so next gen games).

All of that will only get in the way of learning what you'll be trying to do.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
crossley7




PostPosted: Fri Mar 15, 2013 2:35 pm   Post subject: RE:Should I learn Java or C++?

I went straight into C++ from Turing after 1 year for contest purposes and while it has helped a bit, other options are much better.

My recommendation would be either Haskell or Racket (A dialect of scheme used at Waterloo) to get a fundamental knowledge of functional programming and then move from there into imperative programming. If you want to do imperative immediately, then Python is probably your best bet sine it is easy enough to learn, understand and does get some use in a real world setting.

Also, in case you don't know the difference between imperative and functional, imperative has variables that can change while functional is a series of function definitions and then statements that simplify to a value. The functional one forces you to develop better habits as there are more shortcuts and more ways to develop bad habits with imperative code
hamid1455




PostPosted: Fri Mar 22, 2013 5:20 pm   Post subject: RE:Should I learn Java or C++?

A lot of people say c++ isn't beginner friendly, because it has a lot of features in it that beginners won't understand how to use or what their purpose is.

From what I've read in a lot different books, c++ is more beneficial because it can also help you learn some problem solving techniques through its powerful features
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Fri Mar 22, 2013 5:49 pm   Post subject: RE:Should I learn Java or C++?

It's not just beginners... C++ is not friendly, period.

http://en.wikipedia.org/wiki/C%2B%2B11#Rvalue_references_and_move_constructors
Quote:

C++11 adds a new non-const reference type called an rvalue reference, identified by T&&. This refers to temporaries that are permitted to be modified after they are initialized, for the purpose of allowing "move semantics".


Yes, this might shave off some operations in edge-cases where you claim to be smarter than the compiler and have to be, for RTOS applications... but that is an application detail that will not help anyone learn their algorithms easier.

Basically C++ is full of powerful features that let you tie yourself to specific hardware; but ultimately the performance gain of implementing C++ bubble-sorts will not catch up to Ruby/Python's merge sort.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Insectoid




PostPosted: Fri Mar 22, 2013 9:57 pm   Post subject: RE:Should I learn Java or C++?

I can write reasonable C++ code. But I can't read other peoples' C++ code. Unless you've commented it very well, nobody but you is going to be able to read it without significant effort.

If you look at Ruby or Turing, the code pretty much tells you what it's doing. Not so with C++.
wtd




PostPosted: Fri Mar 22, 2013 10:53 pm   Post subject: RE:Should I learn Java or C++?

You can write confusing code in Ruby or Python, but part of the advantage is how much code you don't have to write. Code that's not there can't confuse the reader.
wtd




PostPosted: Fri Mar 22, 2013 11:39 pm   Post subject: RE:Should I learn Java or C++?

Part of the appeal of many languages being suggested is the presence of what some call an "interactive interpreter". These tools are a huge boon for learners.

Consider the process for exploring what a particular piece of code does. (instructions assume Windows, but only require minor modifications for other OSes)

C++:

  • Open a text editor.
  • Write the following program.
    code:
    #include <iostream>

    using namespace std;

    int main()
    {
        int result = 45 + 23 / 2;

        cout << result << endl;

        return 0;
    }

  • Save this as "test.cpp".
  • Open a command-line window.
  • Type "g++ test.cpp -o test.exe" and hit return.
  • Hope you didn't have any errors.
  • Type "test" and hit return.
  • Observe result


Ruby:

  • Open a command-line window.
  • Type "irb" and hit enter.
  • Type "45 + 23 / 2" and hit enter.
  • Observe results


Python:

  • Open a command-line window.
  • Type "python" and hit enter.
  • Type "45 + 23 / 2" and hit enter.
  • Observe results


OCaml:

  • Open a command-line window.
  • Type "ocaml" and hit enter.
  • Type "45 + 23 / 2 ;;" and hit enter.
  • Observe results


Maybe this doesn't seem so bad. Now imagine that you'll repeat this many many times as you learn the basics.
DemonWasp




PostPosted: Sat Mar 23, 2013 12:07 am   Post subject: RE:Should I learn Java or C++?

There are REPL tools for C++ (see http://root.cern.ch/drupal/content/cling ) but admittedly they're still not as nice as many other languages. Also, it looks like cling assumes you already know C++ really well.

The other thing that helps learning is that it's almost invariably way way easier to install all the necessary tools for (languages which are not C++) than it is for (languages which are C++), regardless of what operating system you are on.
kame10




PostPosted: Tue Feb 12, 2019 4:59 am   Post subject: Re: Should I learn Java or C++?

storm2713687 @ Tue Mar 05, 2013 11:52 am wrote:
I've read the sticky'd thread already, but I'm just wondering if I should learn java or c++.
I know some turing, and later on when I get better using turing, I'm going to switch to either Java or C++ (which I'm thinking of java since it's more commonly used)


Hi,
I'd love to start writing Android apps. That's apparently all in Java. Programming jobs on Craigslist are at least 100 Java to 1 C++. I want to learn Java.

Unfortunately, the CS program I'm considering teaches C++ rather than Java, so C++ is what I'm learning. (I'm sure learning C++ will teach me to code well, but so would Java, and then I could get a job. It's frustrating that CS programs stick with languages they've used for 20 years instead of teaching languages that will help their students succeed.)

My question is whether it's a good idea to crack open the Java books on my shelf after I finish my C++ homework. Will I just end up confused, or will I end up better at both? Has anyone learned both C++ and Java simultaneously?

Edit: Thanks for all the quick answers! I've done some programming and I pick up languages easily, I think. Comparing side by side does appeal to me. But I also tend to bite off more than I can chew, and learning C++ and Java both seems like the kind of big meal that could get me in trouble.
Insectoid




PostPosted: Tue Feb 12, 2019 10:01 am   Post subject: RE:Should I learn Java or C++?

Lol, what quick answers?

By the time I finished high school I'd dabbled in c, java, ruby, python, perl, and probably a few others. I was only taught Turing during that time.

Don't worry about languages too much. If you're good at C++ then you'll be good at Java. If you're so early in your education that you're asking about languages, you're also too early to know what type of programming you want to do.

Finally, what the school teaches you is the bare minimum. By the time you graduate you should have a decent portfolio of completed projects that are not assignments. Make yourself an expert in something. Give yourself something to show off in job interviews.
Display posts from previous:   
   Index -> General Programming
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 15 Posts ]
Jump to:   


Style:  
Search: