Learning to Program

Hi all

Now that I have moved to a Mac from Windows, I want to learn a bit about programming.

Is Cocoa good as a first and probably only programming language or does it make sense to learn HTML? (Unless HTML is for windows only for which if that is the case, I have no interest.)

Any help would be appreciated!

Howard

Hi Howard,
I haven’t learned Cocoa yet (I intended to, but then i discovered Scrivener, so what was the point?), but I have done a lot of programming for windows and unix (part of my job).

Firstly, HTML is a markup language, not a programming language. HTML is used to write static webpages, which is not in any way programming (but it does work on Windows, Mac, Unix, etc - so long as someone has programmed a browser to interpret it, which they have for every operating system around).

Secondly, I have heard that Cocoa is a reasonably easy programming language to learn, but none are particularly easy to self-teach, and even harder to self-teach well.

Matt

Hi Howard,

I’ll never quite understand just why so often the first logical step after switching to a Mac is ‘wow I’ve got to start developing software’. Not complaining mind you - it’s kind of cool. Just boggles me. All the free tools are there for Windows as well (like it or no, you can do similarly powerful applications with Visual Studio .NET express in Windows), maybe it’s just that they’re not quite as…sexy. (also, Microsoft documentation stinks. There’s lots of it, it’s just all awful. Nothing on Apple technotes)

Okay, you’re new to this. There’s a lot to learn. I mean, a LOT. Try not to get daunted. If you decide to get into writing software seriously, you’re talking about giving up a LOT of your spare time that could otherwise be spent writing or hanging out with friends…just…debugging…that…freaking…input loop. (or some such).

It can be very frustrating, but it can be amazingly rewarding as well (case in point - Keith, just one guy, written up in the NYT for his outstanding work. Freaking awesome: we’re all Keith fanboys here).

As mentioned, HTML is a markup language, not a programming language. It’s semantic, it’s simply a way of saying ‘this should be structured like this’ (and CSS, which is ‘this should look like this’). It doesn’t so much DO anything as present material.

Cocoa, on the other hand, does a lot. But it’s not a programming language either. Rather, it’s a collective name for a large collection of programming frameworks (or ‘kits’ in the old NextStep terminology). You can write Cocoa apps with quite a few scripting and compiled languages (Python, Ruby, Java, and C++, just to name a few), but the most commonly used one is Objective-C.

None of these languages are really ideal for just picking up and learning in isolation. Rather, you should learn a language alongside the sound basics (what is a computer, why does a CPU act as a CPU does, how does semantic programming language relate to machine code, what’s a compiler do, etc etc) and practises (object oriented, interactivity design, logic, mathematics, etc etc).

If you would really like to try and dive in head first, two books mentioned in previous threads - Programming in Objective-C by Stephen G Kochan, and Cocoa Programming for Mac OSX by Aaron Hilgaas - are possibly the best introduction to OSX development anyone could hope for. The best part is that Kochan doesn’t give the old standard ‘now I am going to assume you have a reasonable background in C’ in the first nitty-gritty chapter (always used to annoy me before I went to uni and learned the joys of C and programming microprocessors to send Furbies into epileptic fits).

Lastly, languages TEND to be operating system agnostic - you can write C or C++ on Windows, Linux, Solaris, OSX, BSD, etc. This doesn’t mean a program written on one works on another (rarely the case), since it’s the framework and the supporting libraries that make a difference. Notable exceptions here are C#, which is basically Windows/.NET specific. Objective-C/Cocoa (at least up to Foundation Kit level) has some minor support in the *NIX community (OpenSTEP, etc), but by far it’s mostly an OSX thing.

Cocoa is much harder than I imagined. I’ve read Kochan’s book which was easy and Hillegass which was hard (not because Hillegass is not a good teacher, he’s an excellent teacher, but because he covers lot of difficult stuff). I’ve written a program which I call Typing Tournament, which is a game for learning to touch type. I haven’t published it, but I myself use it a lot. If you want to learn Cocoa as eagerly as a a guy who’s hair is on fire is looking for a pond, then go ahead and learn Cocoa, otherwise stay away from it. It’s only a personal reflection, you don’t have to believe me.

Take care
Bob

Hi Bob:

Love the “hair on fire” metaphor.

I get the feeling that, not just from you but from others I have spoken with, programming is NOT all that easy. I am hoping to get a glimpse into what it is all about.

By the way, did you ever hear of “Ruby on Rails”?

Best,

Howard

Howard,
Programming is easy; debugging is difficult. As can be demonstrated by the very long beta testing phases of most software, where the program is feature complete but new bugs keep popping up, and fixing old bugs creates new bugs, etc.

Part of the trouble is adapting to a very different way of thinking. If you have a fairly logical mind and are good at problem solving through a variety of methods, then you can learn how to do it reasonably well in a short space of time. There are other people, though, who will simply never be able to pick it up.

I spent four years tutoring Computer Science at university, where I taught everything from first years to final years to masters students (post-grad from other disciplines). There are certainly some people I come across that just are not capable of sitting down and analysing a problem logically, consistently, thoroughly etc. until a problem is found.

It is not linked to intelligence as such (some of the Masters students were at least as bad as the undergrads, if not worse); I think it just depends on how your brain is wired.

Anyway, as for what to try… if you were learning programming with the aim to get good, I would suggest starting with Java or C. But then you don’t get to make cool looking GUIs etc. first but instead deal in command lines and stuff, and it all looks boring because it is a long time before you are actually making something worth making.

Which is why Visual Basic (Windows) and Cocoa (Mac) are so popular: it lets you drag things around a GUI and make pretty interfaces etc. straight away. In that sense it is easier to get started, because it does a lot of stuff for you. How that helps with your overall understanding of programming is a little more open to debate, and probably also depended on how well you pick things up, and in which way (i.e. do you pick it up through understanding or merely repetition).

Ruby on rails - I have heard of it, I think it is the “online programming” version of the above, but I have never used it. I got out of web programming just as it was becoming the next “must know”, so as a result, I don’t know it.

Matt

Bob,

Howard mentions JAVA, I agree and loved taking this course:

www-lehre.inf.uos.de/~ainf/2006/ … index.html

If you understand German, try it, it is fun and very instructive,

best,
Maria

God Lord Maria:

I barely understand english!

But, thanks for tkaing the time to respond!

Howard

Thank you for all of your help on this topic of programming.

I have an appointment with a Mac Guru at the Apple Store next Thursday to spend 60 minutes, one on one, discussing programmin as he does that for a living.

It should be interesting.

Howard