Question about learning to program

Discussion in 'Mac Programming' started by MacBook-Gal, Aug 5, 2009.

  1. MacBook-Gal macrumors regular

    Feb 10, 2008
    LOA&C (The land of art and computers)
    Sorry if this question has already been asked, but I searched the threads and couldn't find it.

    I am planning on taking some programming classes, but I have a couple of newbie programmer questions. One question I have is about which language is the best one to start out with. Between C++ and Java, which one is the best and most useful for a beginner to learn first? Is one of the two a lot more difficult to master than the other? Also, how much mathematical knowledge is required for them? Thanks in advance for any answers!
  2. Joined:
    Jun 30, 2009
    I think most of the people would recommend you starting out with Python. There's this free book, How to think like a Computer Scientist, which uses Python in order to teach you all the basic concepts there are to be known.

    I can't tell the difference between C++ and Java, as I've got no experience with the latter. But you will have to end up knowing more than one language, and it will take a lot of time and dedication in order to master, as this article points out.

    Regarding the mathematical skills, this is very subjective, as the algorithms you are going to have to come up with will require you more or less mathematical skills. The first programs you will write are going to require very basic mathematical knowledge (you can check to see: Fibonacci, Greatest Common Factor, stuff like that), but as you go deeper, you will use more advanced mathematical skills.

    It's also a matter of path choice. An online designer, or applications developer will not need the skills a researcher will (if web developing requires any mathematical knowledge at all). Anyway, you get the point.
  3. boast macrumors 65816


    Nov 12, 2007
    Phoenix, USA
    Probably java. It has a garbage collector, no worries about using smart pointers or watching after yourself. It holds your hand along the way. :)

    And the math you need to know depends on what you're programming. But as long as you know basic math, you should be fine.
  4. lee1210 macrumors 68040


    Jan 10, 2005
    Dallas, TX
    ...lulling you gently in to a false sense of security, then you'll start doing something somewhat complex, perhaps registering objects with some sort of notification center or some such. Then you begin leaking references, which in turn leaks memory. Java still requires resource management, but certainly for a beginner I think it's much better than C++ (though scope based destruction is nice for objects on the stack).

    I have been involved in courses that use/teach these languages, and I am a major proponent of Java over C++ for a beginner. I'm confident that in the hands of the proper teacher C++ can be taught to beginners in a rigorous manner that will avoid a lot of the possible pitfalls. The way I was taught, however, was more of a C wth streams and objects. I think C is great, but the approach that was taken was poor. I think that if you want to dive into OO Java doesn't just offer it, it requires it.

    I think it's really going to boil down to the skill of the person teaching you. You can get a sound footing starting with either language. If I had to have my mind wiped of all programming knowledge, but got to advise me after the wipe, I'd advise starting with Java over C++.

  5. Cinder6 macrumors 6502


    Jul 9, 2009
    Personally, I wouldn't recommend Python. I can see why some would, and it's certainly a forgiving language, and fun to use, but I feel like it teaches you practices that simply don't apply in more traditional languages. Better to give you a solid foundation, I say, and check out Python and the like afterwards.

    That said, if the choice is only between Java and C++, I have to agree Java would be the better choice. C++ is a language that demands a little more experience, and Java's library and documentation are more expansive (or at least easier to get at).

    But if I could offer a third choice, I'd recommend C. It's a small language, so you don't have to memorize a ton of stuff. You don't need to worry about object-oriented design, either. It will give you good familiarization with programming concepts, and since C had a big influence on many newer languages were created, you won't have as big a learning curve with other languages. C will also let you see more of what's going on under the hood than Java does, without many of the pitfalls that C++ has.

    Plus, C is still an important language in many areas (most notably systems design), and it's good to get it out of the way before you get spoiled by object-oriented programming. :)
  6. GorillaPaws macrumors 6502a


    Oct 26, 2003
    Richmond, VA
    I think people recommend Python because it lets the programmer focus on the logic of programming instead of worrying as much about the nuances of the language syntax (at least that's my understanding). It makes sense for people just starting out who are having to learn both the logic of how to solve problems with conditionals, loops, etc. and the syntactic rules that govern whatever particular language they're working with.

    I think it's a bit like learning to drive a car with an automatic transmission first, before moving on to the manual transmission car. Sure you can learn to drive on a car with a stick shifter, but you're worrying about more things going on simultaneously. I can totally understand/respect why people also recommend the C approach as well. I think it really depends on what the programmer's ultimate goals are, how they learn best, and a host of additional factors. Good luck MacBook-Gal, it's great to see women interested in programming.
  7. Cromulent macrumors 603


    Oct 2, 2006
    The Land of Hope and Glory
    I'd recommend PHP over C++.

    I'm not sure if that says more about PHP or C++.

    C++ has all the disadvantages of C such as manual memory management and unsafe pointers with the added (dis)advantage of longer compile times, abiguous syntax, vastly expanded number of keywords, excessive binary size (even when you set the maximum optimisation level), overly complex template system, poorly enforced object orientated principles, excessive inclusion of so called programming paradigms, incomprehensible compiler error and warning messages and numerous other disadvantages.
  8. lazydog macrumors 6502a

    Sep 3, 2005
    Cramlington, UK
    I would imagine Java would be quicker and easier to learn the basics

    If you decide on Java you might want to take a look at this site Processing and download an IDE which is based on Java. It's orientated heavily towards computer art but if you like that sort of thing then you can have a lot of fun while learning the basics.

    ß e n
  9. lazydog macrumors 6502a

    Sep 3, 2005
    Cramlington, UK
    That's a bit like test driving a tank and writing up a review of it as a family runabout :)

    b e n
  10. pikester macrumors newbie


    Feb 27, 2009
    I agree with most of the people here, Java is a great language for beginners to learn. With Java, you'll be able to focus more on the actual programming right away than you would with C++.
  11. Sander macrumors 6502

    Apr 24, 2008
    Hmm. I don't want to turn this into a "my language is better than your language" diatribe, but you might as well say "C++ has all the advantages of C such as direct memory access and pointers, with the added advantages of RAII and a powerful template system; it doesn't enforce a specific paradigm (so you are free to use procedural-style programming when OO would be overkill), and produces highly efficient code."

    I find myself returning to C++ whenever I have to do anything performance-related, and I dearly love the structure of the STL. Even my Mac projects usually end up in Objective-C++.

    Anyway, I think programming language discussions are similar to musical instrument discussions. If you're a violinist, there's no use in trying to convince you that a piano is a much better instrument because it has better polyphony, or vice versa that the violin is a much better instrument because it allows for microtonal intonation.

    I think you can safely ignore advice from anyone who says "X is a bad programming language" without adding "... for doing Y." For instance, C# is definitely not my favorite programming language but I would still have to reccommend it for doing GUI work on the Windows platform.
  12. MacBook-Gal thread starter macrumors regular

    Feb 10, 2008
    LOA&C (The land of art and computers)
    Thanks so much for the input everyone! I'm kind of leaning toward learning Java first, but I know that I will eventually want to learn a number of languages.

    Processing looks really cool. I'm going to download it today. I'm really into computer art, so I think that I will have a lot of fun with it. :D :apple:
  13. Joined:
    Jun 30, 2009
    Well... you're writing this from the point of view of an experienced programmer who has long passed the learning of the basic programming concepts.

    I can give you an example:

    I learn HTML from W3Schools. There, they don't say anything about standards in their HTML 4.01 tutorial, so everything starts with <html><head><body>. After going through the tutorial, I decided to write a tutorial of my own, in Romanian, and post it on the local boards. I was bullied right away, all of the posters making web sites for a living, telling me how I write 10-year-old code, and so on.

    But they were all missing an important point: if you throw stuff like DOCTYPEs, <html xmlns="">, and other advanced topics at an absolute beginner (because I highly doubt that someone learning HTML has an advanced computer usage background), you will annoy him, having him not understand a thing from what you write there.

    That's the way I learnt. I was writing <html><head><body> pages, and this didn't stop me, in a couple of weeks or so, to get to master most of the things there were to be known about standard (X)HTML.

    The bottom line is, when you get your foot wet with it, it's better to just get the whole picture first, and then look into the more advanced things. So instead of analyzing every line in the iostream header and learning compiler theory before writing the first "Hello, World!", I'd say to just get familiar with the language's syntax. They will all come together in time.
  14. chrono1081 macrumors 604


    Jan 26, 2008
    Isla Nublar
    +1 for Python.

    You will see lots of bad information out there saying things like "C++ is for real programmers blah blah" but the most important thing is to understand the concepts.

    Once you get the concepts down you can switch from language to language fairly easy. The concepts remain the same for the most part, its only the syntax that changes.

    Python is also great for being able to make something useful very quickly. Other languages, such as C++ take a long time not only to learn and master but to make something useful.

    If you are still deciding only between Java and C++ I'd recommend start with Java.

Share This Page