Programming, where to start

homebrew

Registered
I am interested in learning programming for OSX. I have downloaded xTools and have looked at a couple of tutorials for C++. There is a lot of info out there. My question is, is it possible to learn C++ through books and tutorials or is it better to take a class? Is there any books or sites that would be recommended over others? I would be starting from the beginning with no prior programming knowledge. Any info would be appreciated.

If this is the wrong post for this, I apologize.
 

ElDiabloConCaca

U.S.D.A. Prime
I would highly recommend at least starting out with an introductory class to programming to "wrap your head around" the concept. If you've never seen or done any programming before, cracking open a book (even the Sam's "Teach yourself in 24 hours") can be a little overwhelming.

I learned programming starting with Java, then C, then a little C++. I found Java to be the most "lenient" in terms of what you can do -- there's not a whole lot to keep track of. C, on the other hand, is very strict in how you use memory, and you could write a program that would eat up every last bit of your system's memory in just a few lines.

You might wanna run down to the local bookstore and browse through one of the introductory books in a language you'd like to learn and see if the first few pages make sense. If you find them too hard to understand or just can't follow it, then it might be time to look into a class. Otherwise, you may be able to learn from a book.

Short answer, I would recommend a class first unless you pick up difficult concepts with relative ease.
 

Viro

Registered
Start with a simple language like Java or C. Both have their advantages. Java is clean and provides good error messages. This is a real boon especially if you're just learning to program and don't know why your program isn't working.

C is a very simple language and it's a lot closer to the hardware than Java. I started learning to program at 14 with C, so I'm going to be a little biased ;). It's a good language to learn as many languages these days are based on some form of C (at the very least, the syntax is C-like). Teach Yourself C in 24 hours by Tony Zhang is a very good book that I will highly recommend to learn C. Reason? The lessons are structured so that you can read the chapter *and* do the exercises in an hour!

Whatever book you choose, remember the best way to learn to program is to ... program! Programming is a very practical activity, no amout of reading is going to make you proficient. What you need is practice and make sure you get a lot of that.

@Ceroc Addict
I'm currently reading that book to learn Objective-C programming. I find it a little slow and it doesn't handle some topics in enough depth (such as autorelease in Chapter 4: Memory management). This book assumes you know how to program and are comfortable with C before beginning. Knowledge of OOP is going to be very helpful as well since the chapter on OOP is very ... liberal for lack of a better word. Objective-C has a very strange syntax, but I'm beginning to get used to it. YMMV of course :)
 

homebrew

Registered
Thanks for the information, I will try the Tony Zhang book.

What I want to be able to do is to eventually write a small program for OSX. What would be the best learning path for that? Is Java restricting in what you can do with it? Is it better to learn C first and then move on to C++? I've read in some posts that it is more or less a waste of time to learn C since you will have to learn C++ to program for OSX - their words no mine.

Thanks again for the book recommendation.
 

Viro

Registered
You can program in C for OS X. There's the Carbon API which is provided for developers to port existing apps written for other platforms (Windows Win32, Unix, etc) to OS X. It's an alright API but it's very similar to Win32 API programming on Windows, something you want to stay away from if you're just learning to program and want to remain sane. Look at my picture. I cut my hair off because I kept pulling it when I was programming on Windows ;).

Stick with C. Objective-C is the main language on OS X and it's very heavily dependent on C. If you don't know C, Objective-C will be completely alien to you and you'll have a very hard time.

C++ is a nice language, but unless you feel the need to prove your 'macho'ness, stay away from it. C++ is a complex beast of a language where most programmers only use a subset of features, and those who do make use of the advanced language features are notorious for writing code that is unreadable by the general programmer populace. While I've used C++ for nearly 6 years, I can't recommend this language unless there is an esoteric need that other languages like Java/C#/Objective-C can't meet.

One more thing before I forget, when starting out it's very tempting to do many languages/APIs at once. You might be able to cope, but you're more likely to burn out and give up in frustration. I suggest sticking to learning *one* language (in this case C), taking it easy and spending a few months (2 - 3 at least) getting to know the language, writing some simple text based apps before moving on. Doing this will allow you to become familiar with the language, the development tools, and programming in general. Once you're confident, you can move on to other languages or doing other things like GUI programming.
 

homebrew

Registered
Thanks, yeah I just want to stick with one thing and try and get proficeint with that. I'm not looking to be an expert. I'll take your advice and start with C. Than maybe Carbon?

You've been a great help. As far as pulling out my hair, mines almost gone already so it can't get much worse.
 
Top