Good way to learn how to program?

Discussion in 'Mac Programming' started by TSE, Oct 1, 2007.

  1. TSE macrumors 68030

    Joined:
    Jun 25, 2007
    Location:
    St. Paul, Minnesota
    #1
    Hi, I am 14 and am looking into programming for a hobby, I really want to program simple-browser based games through Java, but absolutely know nothing about it. I heard Java is similar to C+/+. At my programming club after school they all use windows computers and aren't much help besides telling me that I should sell my MacBook and get a Windows computer for real programming. I heard Java can run through both Windows and Mac OS X, and is what most people use for browser-based applications. I know this is a very vague question, but, what is the best way to learn? Right now I am trying to find a website that shows me everything I need to know, but can't find one. I just got XCode 2.4.1 so so far it's a start!
     
  2. jakeguy99 macrumors regular

    jakeguy99

    Joined:
    Jan 21, 2007
    #2
    first of all you dont need a winblows computer to do programming, java is programmed to work with any platform. And i would also begin to learn programming by actually going through java and learning the basic commands to create small programs, then going bigger. Always start small since programming is mostly based on experience and how long you have done it for. Start with a intro to programming book using java. search google for some keywords like that. Also programming for dummies always works.
     
  3. toddburch macrumors 6502a

    Joined:
    Dec 4, 2006
    Location:
    Katy, Texas
    #3
    TSE, I have 30 years on you, and I am still "learning to program".

    Not because I'm stupid or slow, but because you don't just "learn to program" and then you're done.

    There are many languages, each with their own syntax. There are hardware platforms that each have their own architecture. There are algorithms that you learn, There are language contructs to learn how to leverage. There are compiler features you learn how to leverage. There are IDE's (inegrated development environments, although some aren't so "integrated") to learn, editors to choose from. There are programming models to learm - interrupt driven, time slice driven, message driven, etc. There are frameworks to learn. yada yada yada.

    So, start your journey with an open mind. Take a piece, learn it, understand it, and then iterate.

    Java is an excellent choice of languages to start with. Sun provides good tutorials as well.

    Todd
     
  4. MrFusion macrumors 6502a

    Joined:
    Jun 8, 2005
    Location:
    West-Europe
    #4
    command line

    Mac OS X (and linux) are great systems to program in. You have a command line, an editor and a compiler all for free and that's all what you need to start learning.

    Start with simple programs that run on the command line (don't be afraid of it. It's a programmers best friend). Don't start with full blown graphical user interface programs. Learn the basics, which can be done on the command line.

    As to which language to use? It's more about principles and way of thinking. The syntax, which is dependant on the language, is quickly learned when you know how to program. That is to say, when you know what a loop is, and what potential pitfalls are. When you know what pointers are etc. After that you can quickly pick up any syntax. However it will require a long time to learn the ins and outs of the API, that is all the libraries that are out there, such as cocoa.

    Once you know how to program, in some language on the command line, you can try some GUI programs.

    If you want to program for the mac, why don't you start with objective-c? Should you later need to use java, you can always switch. Objective-c together with xCode is a nice combination.

    You could also try to learn programming with php or perl.

    Start simple and easy and be prepared to get frustrated, but stick with it. It's a nice thing to know.
     
  5. psingh01 macrumors 65816

    Joined:
    Apr 19, 2004
    #5
    Lots of people will tell you different things, like which languages to learn first. To learn the concepts first then a specific language etc etc. To be honest these sound like good ideas only after you have learned it, but may not necessarily work for a beginner. My advice is choose a language (a popular one...more advice on this later) then get a book and start read through it and just start with the sample programs in the book and progressively make more complex programs.

    Then once you have a handle on the language, give yourself an assignment. To create some type of program that you can use to make your life easier. Don't make it too complex like the next Halo or MS Office cause that is unrealistic. Think of shareware/freeware type apps. Then once you've figured out what "features" this program should have dig into your book and google to figure out how to implement those things. This way you have incentive to learn different things and you aren't just making dumb little programs that are really useless on their own.

    As an example, I once wanted to learn VB.net so I decided I wanted a program where I could edit the artist/album/genre information of many mp3 files at once. I wanted the interface to be very simple so it needed drag&drop. I was dealing with files so I needed to know how to do file I/O. I also had to read the specification for ID3 tags so I know where in the file to look for the artist/album/etc and update it. So my little program involved a lot but wasn't all that complicated that I couldn't finish in 2 weeks. This was easy for me because I already know a few languages and the concepts translate pretty well across. But once you get the hang of it you can do it to.

    Now for the language. What type of programs do you want to do? Let's narrow it down to two types: webapps and desktop apps. I will only talk about "desktop" apps because I'm not at all experienced with webapps. The main languages are C, C++ and Java. They are all pretty similar but I recommend Java for one main reason: the Java framework. Part of program is knowing how to write code with proper syntax and using some design concepts of the language. The other part is using libraries of pre-existing code. No one writes anything from scratch and ultimately you have to use someone else's code to help make your program. That is what the Java framework is. It has everything you could ever want (IO, UI, networking, data structures) all in one place. Languages like C & C++ have some standard libraries, but none as robust as Java. So with Java you can start simple and progressively go more and more complex without having to go looking for new tools, you have them all from the start.

    As far as books, I'll recommend two based on what I've heard and what I've read: Thinking in Java, Java How to Program. Pick one and go with it. Your other friend is google.
     

Share This Page