Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Programming for newbies...

Programming for newbies...
Thread Tools
jem
Junior Member
Join Date: Sep 2000
Location: Sydney
Status: Offline
Reply With Quote
Apr 3, 2001, 02:25 AM
 
Hi everyone,

I was wondering what people's views on which language/environment to start programming on in MacOS X? (Yep. I've read the Programming FAQ thread, but it seemed that no consensus was reached on what was the best for newbies...)

I have done an eeency-weeency bit of Perl, and some Bash scripting, and I would like to see if I like programming in MacOS X. I've heard Cocoa is easier to programme for than Carbon, but Cocoa uses either Obj-C or Java, of which I know neither.

So... would it be in my best interests to learn C first, and if so, using what resources? Or, should I find some books or tutorials on Cocoa and start from there?

and, of course, could anyone point me to some useful sites/tutorials on C or Obj-C programming, or suggest some books, please?

Thanks a lot!
     
Forum Regular
Join Date: Dec 2000
Location: Rehoboth Beach,DE USA
Status: Offline
Reply With Quote
Apr 3, 2001, 03:13 AM
 
C is essential for Objective C.Objective C is a set of OO extensions of C.Cocoa is not easy to learn,it is a very abstract enviroment to work in,but once learned powerful applications can be built quickly.But Cocoa requires a commitment,and if you are serious about programming go with it.The most natural way to go about this would be to master C first,then learn Objective C,but since Cocoa programs are structured using Objective C's OO paradigm,and C is used mostly in function implementation,or the inside of function,and because if you learn C alone you will waste time learning a lot of interface programming which is useless in Cocoa,which has a very easy to use app called Interface Builder,where the GUI can be built using drag and drop,I would recommend learning both side by side,but I warn you this is a major undertaking.

The best book on C is written by the authors of the language,Kernighan and Ritchie,called The C Programming Language.
The best way to begin with Objective C is the PDF Object Oriented Programming and the Objective C Language whis is available along with some other documentation,at: http://developer.apple.com/techpubs/...coaTopics.html

[This message has been edited by Rick1138 (edited 04-03-2001).]
     
Admin Emeritus
Join Date: Oct 2000
Location: Boston, MA
Status: Offline
Reply With Quote
Apr 3, 2001, 08:55 AM
 
Alright. Here's what I say.

If you know how to program already, and your mind is set in "programming mode," where you can think through a problem and find a pseudo-code solution (and you know simple things like conditionals, repeats, &c.) you might as well learn C.

How to approach learning C is a topic with a wide range of answers in itself. http://www.codewarrioru.com is Metrowerks's free tutorial site. I've heard it's good from many people, so you might start there.

After learning C fully, look through some sample Cocoa code (there's some out there, it's just hard to find). After you get a sense for Objective-C by looking at code, print out the ObjC pdf from Apple and skim through it. After that you should have a fairly good idea of what to do next.
"Against stupidity, the gods themselves contend in vain" (Schiller)
     
Senior User
Join Date: Jan 2001
Location: Beverly Hills, CA, USA
Status: Offline
Reply With Quote
Apr 3, 2001, 12:10 PM
 
no one thinks he should learn java? being that objc is good and all, but what about if he were to write for other platforms? java is the one
     
Junior Member
Join Date: Dec 2000
Location: Houston, TX, USA
Status: Offline
Reply With Quote
Apr 3, 2001, 01:22 PM
 
No matter what language he decides to learn, you still have to learn how the cocoa classes work, and they're pretty much the same between Java and Objective-C. As far as the syntax of C and Java, they are very similar aside from the OO stuff. As far as the OO stuff go, the syntax is easy to learn, but the concepts of object-oriented programming are the tricky part. My feeling is that Obective-C is the language Cocoa was built in, so why not build your Cocoa apps with Obj-C.
     
Mac Elite
Join Date: Sep 2000
Location: Eagan, MN
Status: Offline
Reply With Quote
Apr 3, 2001, 02:18 PM
 
Here' how I'd do it:

Read the book "Practical C Programming: 3rd Edition" (from O'Reilly) and practice making console apps. I used Borland Turbo C++ to do so. Get comfortable with the all the language structures (if, while, functions, for, structs). Especially important is how to make and use structures, and how to use them as function arguments.

You may then want to read "Practical C++ Programming" and learn how to use classes and objects in console apps. You don't have to, but it will help ease you into a full-on API (like Cocoa).

Read the book "Inside Cocoa: Object-Oriented Programming and the Objective-C language" (from Apple). Then, read it again. It's *very* important to understand how different classes, class objects, instance objects, the methods and data in those objects are all related. Sub-classing is also important because all classes are connected in an inheritance tree.

Then read Apple's tutorials and look at their examples to start building small apps with Project Builder.

Also, when it comes out (May-ish), you probably want to read the book "Learning Cocoa" (also from O'Reilly). It's written by Apple employees, so it should be worthwhile.

------------------
     
Forum Regular
Join Date: Dec 2000
Location: Rehoboth Beach,DE USA
Status: Offline
Reply With Quote
Apr 3, 2001, 04:05 PM
 
Actually I found a good tutorial on learning C in Project Builder,which is the main app on the OSX Developer CD,here: http://www.cocoadevcentral.com/tutor...w=00000005.php Objective C is a lot different than C++,it is more like Smalltalk,which it is based on.
     
Mac Elite
Join Date: Sep 2000
Location: Eagan, MN
Status: Offline
Reply With Quote
Apr 3, 2001, 04:23 PM
 
Originally posted by Rick1138:
Objective C is a lot different than C++,it is more like Smalltalk,which it is based on.
Only the syntax is vastly different. The concepts in both (classes, class objects, instance objects, methods, properties, etc.) are typically the same. I already knew C++ and I read the book "Inside Cocoa: Object-Oriented Programming and the Objective-C Language" simply for the syntax.

------------------
     
Admin Emeritus
Join Date: Oct 2000
Location: Boston, MA
Status: Offline
Reply With Quote
Apr 3, 2001, 05:47 PM
 
C++ and Objective-C are only similar in that they're object-oriented. They're at the opposite ends of OO implementation (e.g. ObjC uses dynamic typing/binding, class objects are different)
"Against stupidity, the gods themselves contend in vain" (Schiller)
     
Mac Elite
Join Date: Sep 2000
Location: Eagan, MN
Status: Offline
Reply With Quote
Apr 3, 2001, 10:01 PM
 
Originally posted by parallax:
C++ and Objective-C are only similar in that they're object-oriented. They're at the opposite ends of OO implementation (e.g. ObjC uses dynamic typing/binding, class objects are different)
Yea, so? They both use classes. They both use objects. And in both cases, it's what sets them apart from C. Just because one wasn't looking over the other's shoulder while designing the language doesn't mean they weren't attempting the same thing. Objective-C's runtime system just allows for a better implementation.

But that's beside the point. What I originally meant was that learning how to effectively use objects is the difficult part of learning you first OO language. Learning your second is a snap.

EDIT: Fixed some stuff that didn't make sense

------------------


[This message has been edited by mr_sonicblue (edited 04-03-2001).]
     
jem  (op)
Junior Member
Join Date: Sep 2000
Location: Sydney
Status: Offline
Reply With Quote
Apr 4, 2001, 01:32 AM
 
OK, thanks everyone.

I found a book lying around called "Learn C on the Macintosh", by Dave Mark... it's a couple of years old (it comes with Codewarrior Lite...), but it has lots of examples and seems OK. I'm going to read through that, and if I'm still troubled, I'll have a look at some of the books suggested!
     
Forum Regular
Join Date: Dec 2000
Location: Rehoboth Beach,DE USA
Status: Offline
Reply With Quote
Apr 4, 2001, 04:38 PM
 
That book is OK,but it is outdated,all the interface programming is for Classic,which is dying fast,and Code Warrior Lite is a poor IDE,it doesn't complile native PPC code.Project Builder and Interface Builder,which come free with OSX,are far superior.Look at the books suggested here first.
     
Dedicated MacNNer
Join Date: Jan 2001
Location: Computer Error: Unknown
Status: Offline
Reply With Quote
Apr 4, 2001, 05:30 PM
 
What about REALbasic? It is easy to learn, and it compiles for Mac OS, Mac OS X, and Windows.

I started with this, and it has given me a good insight into Mac programming.
"...Because the people who are crazy enough to think they can change the world,
are the ones who do."
-To the Crazy Ones

     
jem  (op)
Junior Member
Join Date: Sep 2000
Location: Sydney
Status: Offline
Reply With Quote
Apr 4, 2001, 06:10 PM
 
Originally posted by Rick1138:
That book is OK,but it is outdated,all the interface programming is for Classic,which is dying fast,and Code Warrior Lite is a poor IDE,it doesn't complile native PPC code.Project Builder and Interface Builder,which come free with OSX,are far superior.Look at the books suggested here first.
OK, Thanks. I'm not actually using the version of CodeWarrior Lite included with the book... I'm using ProjectBuilder.

     
Mac Elite
Join Date: Sep 2000
Location: Eagan, MN
Status: Offline
Reply With Quote
Apr 4, 2001, 07:11 PM
 
Originally posted by graphiteman:
What about REALbasic? It is easy to learn, and it compiles for Mac OS, Mac OS X, and Windows.

I started with this, and it has given me a good insight into Mac programming.
If you're an absolute beginner to programming, I agree with you. Learning a simple top-down language like BASIC is the way to start. Unfortunately some people are in too much of a hurry to do that.



------------------
     
Junior Member
Join Date: Mar 2001
Location: .no
Status: Offline
Reply With Quote
Apr 5, 2001, 07:36 AM
 
I'd like to recommend Practical C in the O'Reilly series as well. The thing about C is that it (for better or worse) is a language pretty "close" to hardware. C code is everywhere, and it's useful to understand it well. This book has many small but useful code examples and exercises.

I'd also mention Expert C Programming by Peter van der Linden. It's pretty short and not hard to follow at all. I learnt a lot of useful things from it, such as the development of Unix and C, pointers vs. arrays, bug-tracking and much more. The writer works at Sun and has included interesting stories of (costly) bugs, and lots of funny anecdotes.

------------------
main(){printf("Hello MacNN Forums!\n");}
main(){printf("Hello MacNN Forums!\n");}
     
Junior Member
Join Date: Apr 2001
Location: Sunnyvale, CA
Status: Offline
Reply With Quote
Apr 5, 2001, 10:41 AM
 
Originally posted by Rick1138:
That book is OK,but it is outdated,all the interface programming is for Classic,which is dying fast,
I would disagree with that. If you already have Classic code at hand, Carbonizing it really isn't that difficult (at least it wasn't for me), and should be easier than writing from scratch using Cocoa.

On the other hand, if you're just getting started, you'd probably be better off starting with something OS X native. Personally, I'd recommend C and Carbon. Having a good book helps, but the best thing to do is to read code. Apple has loads of good sample code for that.
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Apr 5, 2001, 03:21 PM
 
Carbon is waaay too overcomplex for newbies, IMHO. I've looked into learning ToolBox before, and by the time I got around to it I decided it wasn't worth it and I'd just learn Cocoa instead.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 02:53 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2