PDA

View Full Version : how to start programming in mac....well programming in general




fcamilleri
Jun 9, 2009, 04:48 PM
I would like to start to learn how to actually write programs.
I just finished a term of a high school computer science course, and honestly loved it.
We worked with some useless languages (netlogo, scheme) and I feel like I have the aptitude necessary to learn this.
Where should I begin?



lee1210
Jun 9, 2009, 04:52 PM
Scheme is not useless. It is a dialect of Lisp. Lisp is great.

With that said...
How do I get started programming on the Mac (or iPhone)? (http://guides.macrumors.com/Cocoa_FAQ)
should appear on the top of this forum. It's a good place to start reading.

There is an endless debate here on whether or not one should learn C first before diving into objective-C. I think you should, many think you shouldn't. One of them is Steve Kochan, the other of Programming In Objective-C 2.0 (http://www.amazon.com/Programming-Objective-C-2-0-Developers-Library/dp/0321566157). His book is very popular, and if you're wanting to get started with Objective-C and Cocoa, his book is probably a good place to begin.

-Lee

Muncher
Jun 9, 2009, 06:53 PM
Personally, I started with C. It's a fairly useful language to know, and it lets you comprehend lots of other languages, but I've had a hard time wrapping my head around Obj-C for some reason. I'd say you should learn Objective C first because of that.

cqexbesd
Jun 10, 2009, 01:35 PM
Personally, I started with C. It's a fairly useful language to know, and it lets you comprehend lots of other languages

That's quite true. Learning C well gives you the foundations to really understand what is going on in other languages - esp those that have been built on the C heritage (e.g. Java, C++, Objective-C). C is also useful if you need to do system programming or embedded stuff. Learning C therefore is a worthwhile activity.

I work for a large company and the work my team does is largely C and Java. People who join the team with good C skills and no Java pick things up pretty quickly, people who have only Java tend to struggle a lot. When interviewing it is C knowledge that I really concentrate on because they will generally be able to pick up anything else.

Despite my praise (and love) for C you should bare in mind that C isn't always the right tool for a job. Something else that is important to learn at this early stage. For example "Perl may feel unclean but it solves problems".

Andrew

SRossi
Jun 10, 2009, 01:48 PM
I personally started with Visual Basic then progressed onto C then C++ and now onto Objective - C.

Personally I'd start with C because after you learn that everything else is really easy, just slight changes in each languages tbh.

Stephen

Muncher
Jun 10, 2009, 05:37 PM
...Despite my praise (and love) for C you should bare in mind that C isn't always the right tool for a job. Something else that is important to learn at this early stage. For example "Perl may feel unclean but it solves problems".

Very true. And to illustrate the point: http://xkcd.com/224/ :p.

centralscrutiny
Jun 10, 2009, 06:44 PM
There is a lot of value in learning C top to bottom, but if your goal is to create Cocoa/Cocoa Touch apps, you can learn the bare essentials of C/Objective-C (data types, control structures, object usage) then jump into learning Cocoa/Cocoa Touch. You will use a very small subset of the core language as you learn the frameworks and can backfill your C/Obj-C knowledge as you go along/need more of the base language. Also some parts of C you'll probably never use in Obj-C.

Obviously having total command of the language is a huge plus, but not needed to start making Mac/iPhone apps. If that's your goal, consider mixing the learning between the two. I would also suggest Kochan's book as he teaches C and Objective-C concurrently. Get through about the first 200 pages of that and you are probably good to move into Cocoa.

iBadger
Jun 11, 2009, 02:27 PM
I started reading this free pdf BecomeAnXcoder

http://www.cocoalab.com/BecomeAnXcoder.pdf

I haven't finished it but it touches on fundamentals and gets into some GUI

mpemburn
Jun 12, 2009, 08:27 AM
Another vote for learning C first -- especially the concept of pointers -- before delving into Objective-C. You'll also need to understand the concepts of object oriented programing (OOP) -- encapsulation, inheritance, etc. Of course, every OOP language uses different terminology and methods to describe and implement the common and well agreed-upon concepts (something I find irksome) but once you understand the basics, it's not too difficult to get the information you need to apply it to a specific language (Google is a god-send!).

-- Mark

mward333
Jun 12, 2009, 09:02 AM
I'll also put in a vote for C or C++. Learning C will give you an excellent understanding of how to write algorithms efficiently..... this will build a base for you, so that you can go on to learn many other languages afterward.

Of course, Python is becoming a very popular first language at the universities, but this is a different point of view. Either way, if you get a good understanding of structured programming and algorithms, this is a good way to begin.

isharan
Jun 12, 2009, 09:24 PM
+1 for C. Some Cocoa functions are in C. Also, if you need to do some advanced stuff, it's all in C.

NRose8989
Jun 15, 2009, 03:02 AM
Though I'm still in the middle of reading Cocoa Programming for mac by Aaron Hillegass, I've noticed that some of the code used in the book is C, and the syntax of obj-c compared to C is pretty different, Now for someone not coming from a C background, I would think that it would be really hard to distinguish what is going on in the code.

My school uses Java to teach all of the theory, manly because it's easier to understand the task at hand instead of memory leaks etc. but we also get our fair share of C because it's just one of those languages your just kinda need to know and it's in everything.

So far while reading this book, the only problem I've had is trying to remember the syntax. The concepts are still the same but the declaration is just so different to me, but then again I'm only been reading the book for the past couple days.

So all in all I vote learning C first because 1) learning obj-c will be easier 2) your eventually going to have to learn it anyway.

Muncher
Jun 15, 2009, 09:00 PM
My school uses Java to teach all of the theory, manly because it's easier to understand the task at hand instead of memory leaks etc. but we also get our fair share of C because it's just one of those languages your just kinda need to know and it's in everything.

So far while reading this book, the only problem I've had is trying to remember the syntax. The concepts are still the same but the declaration is just so different to me, but then again I'm only been reading the book for the past couple days.

So all in all I vote learning C first because 1) learning obj-c will be easier 2) your eventually going to have to learn it anyway.

I feel like learning Java first is kind of lazy; they should start with assembly and work their way up :p:rolleyes:. It sure would make people much more efficient programmers if they did.

I have had the same problem learning Obj-C as you have. The syntax is quite odd. Also, I don't know what I think about OOP. Procedural programming flows so much easier for me.

I definitely agree with the last comment. :p

John.B
Jun 15, 2009, 11:08 PM
I gotta say that chasing down self-inflicted memory leaks in C is where I actually felt like I started to become a programmer. I got really organized and really detail oriented and started commenting code in ways that would actually be useful later (to me or someone else).* Not saying it has to be like that for everyone but that's how it worked out for me. Also, a great debugger/IDE is worth its weight in gold for this stuff.

* For new programmers: Don't add a comment that says you are doing a for loop 10 times; instead, tell the poor sot who has to maintain your code later why 10 was the magic number! For C coding, constants and #define's are your friend, they make your code easier to read ("self documenting"). Anything you had to think hard about is what gets commented. Remember that the guy reading through your code a year from now might be you. :)

NRose8989
Jun 15, 2009, 11:31 PM
I feel like learning Java first is kind of lazy; they should start with assembly and work their way up :p:rolleyes:. It sure would make people much more efficient programmers if they did.

I have had the same problem learning Obj-C as you have. The syntax is quite odd. Also, I don't know what I think about OOP. Procedural programming flows so much easier for me.

I definitely agree with the last comment. :p

I feel the same way too. I was taught Java first, then once I moved on to learn C, I felt like the rug was pulled out from under me. I had a really hard time coping with C at first.