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 > Mac OS X Programmin' Newbie FAQ

Mac OS X Programmin' Newbie FAQ
Thread Tools
Admin Emeritus
Join Date: Oct 2000
Location: Boston, MA
Status: Offline
Reply With Quote
Mar 16, 2001, 05:01 PM
 
Well, very soon Mac OS X will ship with some developer tools. I imagine that the OS X forums will be somewhat more crowded, and following the footsteps of gorgonzola and Scott_H's FAQ, I'd like to start a programming FAQ, focusing on starting programming for OS X.

Hopefully all of you can contribute something.

So ask and answer away!
"Against stupidity, the gods themselves contend in vain" (Schiller)
     
Fresh-Faced Recruit
Join Date: Feb 2001
Location: OR
Status: Offline
Reply With Quote
Mar 17, 2001, 01:53 AM
 
Great idea parallax! I thought I would start out with some very basic questions and answers. I hope this will be useful to some newbies.

What is Cocoa?
Cocoa is the true native language for OS X, and therefore, applications written in Cocoa will work only for OS X and not OS 9. Two well designed frameworks make up Cocoa: the Foundation and Application Kit. These frameworks end up doing much of the work for you, yet you still have the flexibility needed to program any type of application. You must use an object-oriented language to program in Cocoa; the only two supported are: Java and Objective-C. Please refer to the question below on deciding which language to write in.


What is Carbon?
Carbon is compatible with both OS 9 and OS X and therefore is appealing to many current developers. Carbon uses modified versions of earlier Mac OS APIs which make the migration from classic programming to Carbon fairly smooth. Some of the main differences from classic programming to carbon are: memory managment, hardware interfaces, resources, event management and printer managment. Carbon also supports many basic languages such as C and C++.


Should I choose Carbon or Cocoa?
Mac OS X is just beginning to be released and many people are still using OS 9. Currently, the most likely choice would be to program in Carbon, especially if you have experience in classic programming. For beginning programmers, however, Carbon might be confusing and frustrating to learn. If you are just starting to program for the Mac, I would suggest trying out Cocoa. Ask yourself these few questions:

1. Do I have some experience in classic Mac programming?
2. Do I have any classic apps to port over to OS X?
3. Do I have a need to support OS 9 in my development?

If you answered "yes" to any of these questions, Carbon is probably the choice for you. On the other hand, if you answered "no" on all of them, try Cocoa. Whatever your choice is, you should still get a good understanding for the other programming environment.


Which language should I choose for programming in Cocoa?
This completely depends on your personal preference and what your current knowledge about programming is. If you are completely new to computer programming and do not know a programming language, I would suggest learning C. It is a very basic language and extremely useful to learn. If you have experience in programming in C or C++, learning Objective-C usually takes less then a week for most programmers. Then again, if you have experience in Java, I would suggest using that. Whichever language you choose, the Cocoa framework for each is similar. If you have the time, try becoming familiar with both, this way you can decide which one is right for you.


What are some good web pages to get information about OS X Programming?

Apple OS X developer site:
http://developer.apple.com/macosx/

For Cocoa development:
http://developer.apple.com/techpubs/...coaTopics.html

For Carbon development:
http://developer.apple.com/techpubs/...on/carbon.html


Have any comments, corrections, or suggestions? Please email me: rbates@mac.com.

Ryan
     
Mac Elite
Join Date: Oct 2000
Location: Seattle
Status: Offline
Reply With Quote
Mar 17, 2001, 02:32 AM
 
I can start you off with a few basic questions that I had when I got started.

In general what are the differences between the APIs?

Where can I find sample source code? - I want lots of links.
My own project: http://miltonshole.thespacemonkey.co...hecontrol.html

http://www.epicware.com/

Links to tutorials.
http://www.stepwise.com/Articles/VermontRecipes/index.html/

Links to mailing list archives.
http://www.omnigroup.com/community/d...ts/macosx-dev/

What are some good books?

I hear cocoa is 'easy'. compared to what?

I installed the dev tools, now what?

Where can I find more documentation?

How do I do one of those cool outline lists like OnmiWeb's bookmarks?

Should I use Java or Objective C?

Where are the header files so I can see what a class can do by reading the comments?

/System/Library/Frameworks
/System/Library/Frameworks/AppKit.framework/Headers

Is there a better way to learn this stuff?

Do I need to know Unix now to program for a Mac?

I want to make a GUI for a Unix command line tool, how do I start?
http://miltonshole.thespacemonkey.co...hecontrol.html

How do I join a Mac open source project?
http://sourceforge.net/

That's just a few off the top of my head.


[This message has been edited by Gavin (edited 03-17-2001).]
You can take the dude out of So Cal, but you can't take the dude outta the dude, dude!
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Mar 17, 2001, 03:57 AM
 
I want to learn Cocoa, what should I do?

There are two languages you can use to write Cocoa code in at present: Objective C and Java. I will only cover Obj-C here, since that's the only one I've had any experience of.

First of all, you need to know C. There are plenty of ways of learning this. Find a decent book on Amazon or something. I learned mainly using Dave Mark's excellent Learn C on the Macintosh (which ships as a PDF on the CodeWarrior Documentation CD). You won't need to learn C++, however.

Cocoa uses Objective C, which is an extension of C. For learning the basics of Objective C, Apple provides an excellent PDF. If you have the Developer Tools installed, it'll be available in /Developer/Documentation somewhere (I forget the exact location), or it's available online at http://developer.apple.com/techpubs/...tiveC/ObjC.pdf
or http://developer.apple.com/techpubs/...veC/index.html
or you can order a print-on-demand copy at http://www1.fatbrain.com/asp/bookinf...sbn=DM10006296

Apple also provides the CurrencyConverter tutorial, which teaches you some basic principles of InterfaceBuilder and gets you writing some code. It is available as a PDF download from http://developer.apple.com/macos/tut...oaTutorial.pdf

Another useful reference is the old "Discovering OPENSTEP: A Developer's Tutorial" which focuses on Rhapsody and OS X Server. However, lots of the concepts still apply today, and with minor tweaking I was able to get the TravelAdvisor example to compile. I have not attempted any of the other ones yet. You will notice that the first example is CurrencyConverter.app, so I presume Apple is going to update all the rest of them at some point. You can get it from: http://developer.apple.com/techpubs/...cy/legacy.html

Finally, Stepwise has a series of tutorials called Vermont Recipes, available at http://www.stepwise.com/Articles/Ver...pes/index.html

Hope that helps :-)
     
Admin Emeritus
Join Date: Oct 2000
Location: Boston, MA
Status: Offline
Reply With Quote
Mar 17, 2001, 12:48 PM
 
This is excellent. I'll upload this to live with the Mac OS X Newbie FAQ (http://homepage.mac.com/macosxfaq/)

If you find any more common questions (I'm sure these will answer quite a few), just post 'em here.

Especially source code! Cocoa is such an easy environment to learn, but it takes a couple tries to finally apply it well.
"Against stupidity, the gods themselves contend in vain" (Schiller)
     
Moderator
Join Date: Sep 2000
Location: Irvine, CA
Status: Offline
Reply With Quote
Mar 19, 2001, 01:15 AM
 
I know a fair amount of C and a little C++. Is objective C easier to learn? I want to learn it but I cannot find any good things on it. I want like dummies guide or something where I can learn to make simple console apps first then move on to the UI> Any ideas? Thanks for this thread.
{{{ mindwaves }}}
     
Mac Enthusiast
Join Date: Feb 2000
Location: Storrs,Connecticut, USA
Status: Offline
Reply With Quote
Mar 19, 2001, 05:19 AM
 
Originally posted by mindwaves:
I know a fair amount of C and a little C++. Is objective C easier to learn? I want to learn it but I cannot find any good things on it. I want like dummies guide or something where I can learn to make simple console apps first then move on to the UI> Any ideas? Thanks for this thread.
If you know C then it'd probably be easiest if you go right into Objective C through GUI Apps, not console apps. The frameworks aren't really made with console based apps in mind, although you can still use everything in Foundation for fun with the console. Just check out Simple Cocoa App or Currency Converter by Apple and you should see that it's not so hard.... but first read "Programming and the Objective C Language", or al least browse through it. That's from Apple too. I think that it's really boring so it's a lot easier to learn Cocoa by just looking at sample code and referring to that when you need to do something special, like use IMPS or something like that.
     
Fresh-Faced Recruit
Join Date: Feb 2001
Location: OR
Status: Offline
Reply With Quote
Mar 19, 2001, 04:43 PM
 
There is an entire "SimpleCocoaApp" overview (which is somewhat hard to find) on apple's site. I thought I would post a link to it in case you need it:
http://developer.apple.com/technotes/tn/tn2005.html

I also agree with Dalgo that the "Programming and the Objective C Language" book is quite boring, but it is a good reference if you do not know Objective C. From what I've heard, most people who know C can catch on to Objective C fairly quickly. Learning all of the Cocoa methods is what takes a while.

Ryan
     
Senior User
Join Date: Feb 2001
Location: Rochester, uk
Status: Offline
Reply With Quote
Mar 20, 2001, 08:21 AM
 
I thought I'd add that learning Java is also easier if you know some C already, as is C++. In fact, so many languages are derived in part from C that it's almost always the way to go.

Whatever you're going to do, you're probably best off starting with C.

All words are lies. Including these ones.
     
Fresh-Faced Recruit
Join Date: Feb 2001
Location: London, UK
Status: Offline
Reply With Quote
Mar 20, 2001, 11:01 AM
 
Here is a question for the FAQ but i dont have the answer.

Can I use gnu compilers on OS X, and especially g77?


This question would be usefull to all Mathematicians or scientists that use fortran in Unix or Linux and want to use it in OS X
     
Dedicated MacNNer
Join Date: Oct 1999
Location: sleep deprivation is fun!
Status: Offline
Reply With Quote
Mar 20, 2001, 10:57 PM
 
Great thread so far. Thanks for all the links and such! Keep it coming!

-cotton
     
Dedicated MacNNer
Join Date: Oct 1999
Location: sleep deprivation is fun!
Status: Offline
Reply With Quote
Mar 20, 2001, 11:15 PM
 
i've made a small html editor (strict w3c standards based) in realbasic and am at least a month away from release, but i want to port it to cocoa before then. i'm planning on using obj-c w/ the dev tools. what's the quickest way to learn obj-c/PB??

i've gone through the apple tutorals and vermont recipies, but am still struggling with getting all the functionality that came so easy in REALbasic... digging through all the application kit calls and such. what's a good resource to learn about this stuff progressively? should i sit down for a few weeks and learn c well? thx for the input.

-cotton
     
Admin Emeritus
Join Date: Oct 2000
Location: Boston, MA
Status: Offline
Reply With Quote
Mar 21, 2001, 06:12 AM
 
If it takes you two million years to learn C well, it'll still be worthwhile. C is the foundation of ObjC, and so it wouldn't hurt at all to learn *all* of C thoroughly.

After you're comfortable with that, I suggest you then look at some sample code to get a feel for how Cocoa works. While you're doing that, skim through the ObjC manual (if you're familiar with Object Oriented Programming, you can skip chapter 2).

Another common question:

I'm learning C; what chapters in my C book can I skip? In a nutshell: none of them. Everything in C can be used in Cocoa, and really should be for greater speed. For example, some people think that classes of Objective-C make obsolete structures; however, this is untrue. structs, which are pretty rigid, are needed for speed. As a result, you'll need to learn memory allocation functions and pointers (malloc, &c.). And if you need a more convincing reason: you'll need all of this to use the UNIX core of Mac OS X (network programming springs to mind).
"Against stupidity, the gods themselves contend in vain" (Schiller)
     
Dedicated MacNNer
Join Date: Mar 2001
Location: Iowa City, IA
Status: Offline
Reply With Quote
Mar 21, 2001, 01:40 PM
 
As a longtime C programmer myself, I'm going to have to dissent. C is not the best language to start out with just because other languages have borrowed its curly braces and its superabundant suite of operators and precedence levels. C was designed to be easy for a simple recursive-descent parser to process, not to be easy to learn.

To use Cocoa and/or Objective-C and/or Java effectively, you have to learn the discipline of object-oriented programming. C is not the right place to start. There's no particular reason why someone learning to program should have to roll their own hash table before they can use one, especially if NSDictionary's already there. C's memory allocation is totally different from either Objective-C's or (certainly) Java's, and more difficult to manage than either. You can write any beginner-level application in either OO language - complete with a GUI - without having to know the guts of C's expression syntax, or how to dereference a pointer to a pointer to an array of pointers to structs containing pointers to functions.

In fact, the advantages of knowing C fluently don't kick in until the programmer is past the beginner stage. Once you've learned to organize applications into objects, and once you've learned which data structures and algorithms are intrinsically better solutions for which problems, then you can start worrying about low-level optimizations like moving from classes to structs and hand-rolling your own custom data structures and the more sophisticated uses for pointers. I've read some authors of C++ tutorials argue that you never should explore the depths of C's "everything is an expression" paradigm and stick to simple Pascal-style expression statements instead. I disagree (and in some cases I wonder whether the authors themselves understood C's expression syntax!), but the point is that you don't have to be able to compose complicated C expressions in order to solve most problems effectively.

My recommendation: Learn Java or Objective-C first. They'll do a lot of the dirty work for you and allow you to concentrate on important things like code organization and clarity, OO, algorithms, and which data structures to use when. Then, when you are comfortable with the tools they offer (and if you've decided to work in Objective-C, since Java only superficially resembles C), you can explore and use the more arcane and powerful aspects of C.

Remember the old NeXT proverb: Make it work, then make it fast.


------------------
James

"I grew up. Then I got better." - Sea Wasp
James

"I grew up. Then I got better." - Sea Wasp
     
Admin Emeritus
Join Date: Oct 2000
Location: Boston, MA
Status: Offline
Reply With Quote
Mar 21, 2001, 02:25 PM
 
Welcome to the forums Amorph!

I guess there's many sides to the issue of where to start.

There's also a bunch more resources to help beginners get started with C. I think beginners would get mightily confused where the line lays between C and ObjC. Perhaps Java, then, is good place to start. But I found C easy enough to start with by itself. As long as you have the right tutorial.

Also, I don't know about Java or Objective-C, but I find that people starting off with C++ tend to be the most confused of them all, even if they never learn about pointers. I couldn't tell you why, though.

But then again, if I had to recommend ANY environment to start programming in, it would definitely be HyperCard :-)
"Against stupidity, the gods themselves contend in vain" (Schiller)
     
Dedicated MacNNer
Join Date: Mar 2001
Location: Iowa City, IA
Status: Offline
Reply With Quote
Mar 21, 2001, 04:38 PM
 
Thanks.

C is deceptively easy if you have the wrong tutorial, unfortunately. I spent enough time contributing to comp.lang.c to witness that.

C++ is hard to learn because it's an obscene, bloated, inconsistent hack of a language designed by committee to include everything - including the kitchen sink.

I'll settle on Java as the best language to start with (among those shipping with OS X). Python is also an excellent choice, and it's free and cross-platform. Both shield the programmer from low-level arcana without compromising much in the way of power. For the record, I prefer Python over Java in terms of language design.

I keep hoping Apple will bring HyperCard back. That was truly the first environment to actually deliver on the promise of letting ordinary people write applications. There are a lot of Macs in the university hospital here running old HyperCard stacks written by researchers and physicians for their particular tasks. Alas.


------------------
James

"I grew up. Then I got better." - Sea Wasp
James

"I grew up. Then I got better." - Sea Wasp
     
Fresh-Faced Recruit
Join Date: Apr 2000
Location: seattle, wa usa
Status: Offline
Reply With Quote
Mar 22, 2001, 11:38 AM
 
Thank you for this excellent forum topic.

I'm just getting started in programming, and I would like to share what I've found so far.

First, I'm going to concentrate on Obj C and Cocoa. Apple has a ton of PDFs and the Hello World and Currency Converter tutorial on the ADC site. I'll be starting there. I've printed literally a ream of documentation on ObjC, OO, OSX, and Project Builder so far, and I didn't even come close to exhausting Apple's resources.

Second, CodeWarrior is $49 for beginners who don't need to license their code, and CodeWarrior U offers free online C programming courses that look promising as a good way to bootstrap into Mac programming.

Finally, I will eventually wade into the StepWise site and see if I can do the tutorials in the Vermont Recipe series.

This is going to be fun. Apple has made it very easy for newbies to get started in Mac programming with OSX and Cocoa.

Ross Cottrell
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Mar 22, 2001, 04:35 PM
 
A few more Q&As, mostly relating to porting un*x/linux software.

Where's gcc?!
The compiler is called cc and is included on the Developer Tools CD.

What about g77?
There are currently no FORTRAN compilers for OS X. People have attempted to port g77, but haven't had much luck. I think that it's being worked on as part of the effort to bring gcc 3.0 to OS X. gcc 3.0 has successfully been bootstrapped, but it's still in early stages.

How do I compile UN*X/Linux/BSD applications?
This is not an easy question to answer. In general, it depends on what you're trying to compile. Some things compile right out of the box, others need heavy hacking. Here is the general set of commands to compile things though (they must be executed from a terminal from within the directory where the source is, after it has been ungzipped and untarred):
./configure
make

And then if you are on PB it's:
su
make install
Or if you're on final it should be:
sudo make install

If you get a complaint about an unrecognised system type, you should replace the package's config.sub and config.guess files with those located in /usr/libexec.

If things still aren't working right, you should try looking to see if someone else has already ported it. There is a ports collection at Darwinfo, GNU-Darwin, Fink and Stepwise (under their Softrak section).

For applications that use a GUI, you will probably also need X Windows. You can get this from http://mcrla.com/XonX/ (a page by the maintainer of the OS X port, often containing more recent releases - they currently have a version of X windows that runs side-by-side with Aqua and Quartz) or http://www.XFree86.org (the official XFree86 distribution site, which is often lagging behind the XonX page).
     
Fresh-Faced Recruit
Join Date: Oct 2000
Location: Arlington, VA
Status: Offline
Reply With Quote
Mar 24, 2001, 05:11 AM
 
Originally posted by Amorph:
I keep hoping Apple will bring HyperCard back. That was truly the first environment to actually deliver on the promise of letting ordinary people write applications. There are a lot of Macs in the university hospital here running old HyperCard stacks written by researchers and physicians for their particular tasks. Alas.
[/B]
I agree :-) I miss HC terribly. My first major Macintosh app was actually a HyperCard stack. I wrote it in about a month, and let HyperCard handle all the high-level logic and UI for me. I wrote a driver and some low-level hardware-interface code in C... my app was 1/10th the cost of the nearest competitor and to the best of my knowledge is still in use today on a Quadra. In my mind, no RAD environment has matched HyperCard, and I've written stuff using a couple of different AppleScript/GUI toolkits, C, C++, ObjC, Perl, VB and ASP. <Sigh>.



[This message has been edited by petard (edited 03-24-2001).]
     
Grizzled Veteran
Join Date: Sep 2000
Location: San Francisco
Status: Offline
Reply With Quote
Mar 25, 2001, 01:05 AM
 
For new programmers I would suggest several data-points:

(1) Java is the way to go because you aren't encumbered with evolution. C is great for some command-line things, but you don't get karma points for spending time screwing with pointers (or keeping from being screwed by them).

(2) You don't have to deal with the graphic user interface. Java can also be used to write command-line programs. Once you understand how to program in Java you can jump into standalone graphic apps or applets (in Java-saavy web browsers). Check out
http://developer.apple.com/macosx/pdf/macosx_java.pdf

for the former.

(3) Don't overlook Perl. It's very powerful, comes with OS X, does lots of things for you, and is damned useful. Nothing you learn from Perl is a waste. (Others say the same thing about Python, but I don't actually know that language.)

Bottom line: pick any language and start with it. I'd suggest Perl before any others; get the O'Reilly Perl books and two weeks later you're on your way. Then you can jump to Java when you have some hard-core programming needs. (You wouldn't believe the percentage of stuff I do for clients in Perl. It's fast. It's easy. It slices and dices.)
Since EBCDIC
Using Macs since they were Lisas.
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Mar 25, 2001, 03:35 AM
 
Perl is technically a scripting language... Yes, it rocks. It definitely has its place, and its text processing abilities are amongst the best out there.

But there is no way to use Perl to create a GUI application on OS X, at least not that I know of at the moment.

And for web development, a lot of people say that PHP is better. I did a bit of experimentation with Perl for web development a while ago, and it looked pretty good. I haven't looked at PHP yet, but that should change when I get my hands on OS X final
     
Mac Elite
Join Date: Sep 2000
Location: Eagan, MN
Status: Offline
Reply With Quote
Mar 26, 2001, 07:51 PM
 
As far as absolute beginners go, I'd have to echo the above post and say: Learn Perl! And even more specifically learn Perl with this book:

http://www.oreilly.com/catalog/pperl3/
(O'Reilly books are truly excellent. I wish the had some Mac books.)

Scripting languages have the advantage that you don't have to worry about large, scary, pre-made frameworks or compiling. And you can make a working script with only one line of code:

print "Hello World!";

------------------
     
Admin Emeritus
Join Date: Oct 2000
Location: Boston, MA
Status: Offline
Reply With Quote
Mar 26, 2001, 08:43 PM
 
I don't know anyone who's started with Perl, but I'd think it would mess with people's heads (How do I do a $moo =~ s/</\</g in C!?). Although it's really powerful and useful, and now supports OOP, the syntax makes it too odd.

I'd recommend to stay away as a first language, and if Apple brings HyperCard back, go for it :-)
"Against stupidity, the gods themselves contend in vain" (Schiller)
     
Mac Elite
Join Date: Sep 2000
Location: Eagan, MN
Status: Offline
Reply With Quote
Mar 26, 2001, 08:56 PM
 
Originally posted by parallax:
I'd recommend to stay away as a first language, and if Apple brings HyperCard back, go for it :-)
If you want something VERY easy to learn, get an 386 DOS PC and learn QBasic. It's practically a baby-step from flowcharts to QBasic.

They order they're teaching at my school is:
Programming Concept -> Flowcharts -> QBasic -> Visual Basic -> C with Turbo C++ -> C++ with Turbo C++ -> Visual C++ -> Visual J++ -> RPG/COBOL -> SQL -> Oracle

But that's, of course, all DOS/Windows stuff. Mac has it tough because There's no really good beginner languages. REALbasic is OK, but it's not nearly as powerful as Visual Basic.

------------------
     
Senior User
Join Date: Jan 2001
Location: Beverly Hills, CA, USA
Status: Offline
Reply With Quote
Mar 29, 2001, 12:55 PM
 
so, what's the bottom line...for a newbie...

what lang is best to learn and where are the good, free resources?

thanks
     
Admin Emeritus
Join Date: Oct 2000
Location: Boston, MA
Status: Offline
Reply With Quote
Mar 29, 2001, 02:36 PM
 
That's a really good question, tz3gm :-)

You could start anywhere, but either Java or C will be good, depending on your goals and experience. Are you new to the programming concept? In that case, Java would be better. Have you programmed before? Want a challenge? C's also good.

As for resources, I've never found any C books to be beginner-level. You should have no trouble finding a good course on the internet, however (Try codewarrioru.com, regardless of whether you're learning C or Java).
"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
Mar 29, 2001, 03:01 PM
 
Originally posted by parallax:
That's a really good question, tz3gm :-)

You could start anywhere, but either Java or C will be good, depending on your goals and experience. Are you new to the programming concept? In that case, Java would be better. Have you programmed before? Want a challenge? C's also good.

As for resources, I've never found any C books to be beginner-level. You should have no trouble finding a good course on the internet, however (Try codewarrioru.com, regardless of whether you're learning C or Java).
i just picked up learning programming on the macintosh...the metrowerks/codewarrior one...is that any good...is that a good place to start
     
Dedicated MacNNer
Join Date: Mar 2001
Location: Iowa City, IA
Status: Offline
Reply With Quote
Mar 29, 2001, 04:11 PM
 
For newbies, Python and Java are both good starting points: Clean, simple, and safe, but still quite powerful. O'Reilly publishes (at least) two excellent books on Python: Learning Python and Programming Python (those titles should look familiar to Perl programmers ). Modern BASICs aren't a bad bet either - the newer ones have answered most of the problems early BASICs had with structure and code organization.

As much as I dearly love Perl, I don't think it's an ideal place to start. It's not bad - I'd recommend it before C or C++ - but it's too easy to fall into bad habits like depending on $_, the OO support is, uh, distinctive. So are many of the operators and behaviors, which are unique enough to Perl that they'd be confusing to anyone who tried using them in another language.

On top of that, Programming Perl might be the only technical manual ever written that can make me laugh out loud, and it's a terrific reference for a seasoned programmer, but it assumes that the reader is conversant with UNIX conventions, C, LISP, OO, and computer science topics in general. If the reader isn't, than a lot of the explanations - and more importantly, all of the jokes - will go over their head.

On the other hand, once you're comfortable with a simpler, less idiosyncratic language, I highly recommend learning Perl. Not only is it highly expressive and powerful, it's great fun.

(As an aside, you can create GUIs in Perl. TK is available for Perl, and possibly some other libraries. Creating Aqua UIs is another matter until someone comes up with a native TK.).

------------------
James

"I grew up. Then I got better." - Sea Wasp

[This message has been edited by Amorph (edited 03-29-2001).]
James

"I grew up. Then I got better." - Sea Wasp
     
Fresh-Faced Recruit
Join Date: Feb 2001
Location: OR
Status: Offline
Reply With Quote
Mar 29, 2001, 04:26 PM
 
Originally posted by tz3gm:
i just picked up learning programming on the macintosh...the metrowerks/codewarrior one...is that any good...is that a good place to start
I am not familiar with that specific book, but many of the Mac Programming books are way out of date. Most of the books which are specific to Mac programming talk about the Mac Toolbox - something which will not be useful to you in OS X unless you are planning to program in Carbon. However if the book talks about the very basics of programming langauge it is probably worth reading it. I would suggest getting a book (or a website) specifically on C or Java basics. After you get that down, making the switch to Cocoa shouldn't be too hard.

You may want to find someone who knows the language you choose and is willing to give his time to help you learn the langauge better. You are bound to have a ton of questions on learning your first language.

BTW, I am also for the site parralax mentioned: www.codewarrioru.com . I've heard it has some nice courses for beginner programmers.

Ryan
     
Moderator
Join Date: Sep 2000
Location: Irvine, CA
Status: Offline
Reply With Quote
Apr 1, 2001, 09:06 PM
 
Hi,

I have the dev tools and have installed them and woth ProjectBuilder have compiled a simple "Hello world!" console app using C++. However, whenever I use "cin" in project builder like asking for an "int," it builds the project and it runs but it does not display any text. But when I just make a simple helloword console app using cout and not cin, it works perfectly. Why?
{{{ mindwaves }}}
     
Admin Emeritus
Join Date: Oct 2000
Location: Boston, MA
Status: Offline
Reply With Quote
Apr 2, 2001, 10:18 AM
 
That's still there, eh?

I'm not sure of any way to fix that. I'd just run it command-line.
"Against stupidity, the gods themselves contend in vain" (Schiller)
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Apr 2, 2001, 03:06 PM
 
It would appear to be a bug in the libraries. You can't get around it. You could always fix it in the Darwin source...

Running in hte command line will not make any difference.
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Apr 14, 2001, 03:02 PM
 
WHOA... this was miles away... Not been posted to within the last 10 days. AAh. Returing to the top. Please feel free to add some stuff to it, lots of common questions seem to be turning up again.
     
Forum Regular
Join Date: Jan 2001
Location: Oregon
Status: Offline
Reply With Quote
Apr 14, 2001, 09:58 PM
 
There doesn't seem to be much point in using cin in project builder. It seems better suited for making GUI apps with Interface Builder (at least to me). That said, Project Builder is not the place to start for newbies...

All of my C and C++ console apps that I have written over the years compiled easily in the terminal using cc and c++ respectively. It is very easy to make your first terminal app. Like:

#include<stdio.h>
int main(void)
{
printf("hello world\n");
return 0;
}

then cc <filename> it. To run your program type ./a.out

As for programming language learning I did QBasic -> Pascal -> ANSI C -> C++ -> x86 ASM -> Java -> gee I hope I can learn Obj. C it looks pretty tweaked from the Currency Converter tutorial from a function declaration perspective. Why the heck do they define passed variables in the function declarations like that? C is much simpler, C++ is simpler. Oh well, I'll figure it out...

I don't think it is worth your time to learn QBasic. It's stupid and then if you don't get taught by somebody who knows you will be trying to pull gotos and you will be tweaked about understanding how memory allocation and arrays actually work.

C is not terribly difficult to learn. I recommend the Waite Group's C primer plus. Don't let the name fool you, its pure ANSI C and it tells you everything you need to know in a platform unspecific way. I think maybe its out of print now but if you can find it I recommend it above all others.

Once you read that and master the topics in it I would go for a platform specific book. I'm betting that those O'Reilly books on Mac OS X programming will be good. I'm going to get them since I have like the other ones from that publisher (esp. the javascript one).
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
May 18, 2001, 04:18 PM
 
Moving this back to the top, it's gotten pretty lost far down in the archives, and people are still asking the same questions :/
     
Admin Emeritus
Join Date: Oct 2000
Location: Boston, MA
Status: Offline
Reply With Quote
May 18, 2001, 04:25 PM
 
Thanks Angus.

I'll probably post an announcement here about the FAQ. Hopefully that will help.
"Against stupidity, the gods themselves contend in vain" (Schiller)
     
Dedicated MacNNer
Join Date: Nov 2000
Status: Offline
Reply With Quote
May 18, 2001, 08:31 PM
 
I second "C Primer Plus". It's a very well written book. One book I can recommend that newbies stay away from is, "The C Programming Language" by Kernighan and Ritchie, the original C studs. K&R is simply too terse for beginners. Once you have a little time with C logged, it's an excellent book. I'd also like to recommend "Advanced Programming in the UNIX Environment" for those beginners interested in the BSD layer.
     
the rev
Guest
Status:
Reply With Quote
May 23, 2001, 06:36 PM
 
I've just started reading the book "Principles of Programming", and it basically doesn't focus on a certain language, but talks more about the ideas behind Algorithms, and the like. My question is, should I continue reading this book(not past the 2nd chapter), or is it a waste of time, and I'd be better off moving straight to learning Java?
     
Junior Member
Join Date: Apr 2001
Location: Sunnyvale, CA
Status: Offline
Reply With Quote
May 23, 2001, 07:00 PM
 
Originally posted by the rev:
I've just started reading the book "Principles of Programming", (...) should I continue reading this book(not past the 2nd chapter), or is it a waste of time, and I'd be better off moving straight to learning Java?
Reading a book on algorithms without doing any coding must be the most boring thing around, if not out right confusing. Is it making any sense to you? If it is, great, but for most people it probably has more of a hypnotic effect.

If I were you, I'd spend some time learning a language first, before learning about funky algorithms. On the other hand, coding some of the examples in your language of choice may be a good excercise.

IMHO, there's no such thing as "waste of time" in programming, as long as you're learning something. I've spent thousands of hours coding stuff that, when I look at now, are pretty useless. But I learned something out of it, and that made it all worth while.
     
the rev
Guest
Status:
Reply With Quote
May 24, 2001, 05:48 AM
 
Yeah, I think I'm getting something from it, but it is as boring as... something. I'm not sure what So, can anyone tell me what some good books for learning Java is, preferably free, but OK if they're not(I might have access to them already)?
     
the rev
Guest
Status:
Reply With Quote
May 28, 2001, 11:50 AM
 
Thought I'd bring this back up to the top, and see if I could get a response to my earlier question...
     
Junior Member
Join Date: May 2001
Location: Perth, Western Australia
Status: Offline
Reply With Quote
May 28, 2001, 09:13 PM
 
Thanks for a great forum, it's helped a lot
     
Professional Poster
Join Date: Sep 2000
Location: San Francisco
Status: Offline
Reply With Quote
May 28, 2001, 11:42 PM
 
Are there any books on learning ObjC or should I just go with the previously mentioned C Primer Plus? I just ordered Learning Cocoa. I'll give some feedback in a couple weeks on a total newbie's experience (although I was pretty swift at Fortran in college )

kman
     
Admin Emeritus
Join Date: Oct 2000
Location: Boston, MA
Status: Offline
Reply With Quote
May 29, 2001, 09:25 AM
 
As far as I know, there are no "Learn Objective-C from scratch" books online. Once you know C, you should check out Apple's Objective-C PDF (available at devworld.apple.com).
"Against stupidity, the gods themselves contend in vain" (Schiller)
     
   
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 09:42 AM.
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