Beginning for Beginning Beginners

Beginning for Beginning Beginners

Post by jones » Tue, 20 Jul 2004 02:02:25

I occasionally become motivated to dabble in programming, just to the point of
getting a particular task done, and am wondering where I should start. I am
generally more interested in the ends rather than the means.

I want to work with what is available with Panther on the XCode CD, and am
intrigued by Tigers Automator. I wouldn't mind putting a minimal GUI framework
on some old UNIX code.

My programming history as a non-programmer.......

I did take a pascal course way back when, and remember getting an assignment or
two done well... the toughest part at that time was sending the code over POTS
to the university computer, from an Apple II.

I also played with Logo a bit on the Apple II as well.

I typed a text adventure in BASIC into a VAX from copies of BYTE, and played
around with the DEC help system enough to learn a few things. Made DOS line
commands a bit easier later, but I never got much beyond a directory listing,
apple DOS or MS DOS, save for copying files.

I played with Hypercard a bit, only useful to me when someone tagges some lower
level code into it... remember some calls to MIDI.

I played with recordable macro scripting programs in classic mac os.
I have read or adapted an existing applescript or two, but never built one from
scratch. What irks me the most about applescript, beyond its speed, and its
applicability to scriptable apps, is that I have seen few that let me clearly
know when a task is finished.

I built a few regular expressions to search and sort in BBEdit. Never really
moved to PERL from that point. Did get the O'Reilly Camel books and CDs.

Excel Macros? Never dealt with them. =SUM(), *C9, thats about my level.

Oh and I suppose HTML counts to some degree as well. Nothing server side, all
rollover javascripts and the like, borrowed from others.

Better at overall broad logic problems compared to catching syntax errors.

The following Developer Getting Started URLS look interesting, but given my
history above, which path should I take? Java? I am interested in text
processing, but not via line command necessarily.

I would prefer something to work fast and look nice, staying in Cocoa, building
high level, compiling for speed.

Tell me where to go.

Beginning for Beginning Beginners

Post by David Coo » Tue, 20 Jul 2004 03:36:40

Give Python a try. It's already on your system.

You can write Cocoa programs in Python:

The BitTorrent client for Mac OS X is written completely in Python.

Dave Cook


Beginning for Beginning Beginners

Post by Christophe » Tue, 20 Jul 2004 08:46:54

In article < XXXX@XXXXX.COM >, JonesR

For getting acquainted with the Xcode development tools, I recommend
_Cocoa Programming for the Moc IS X Second Edition_ by Aaron Hillegass.
If it's at all like the first edition, it will be a very friendly
introduction to Xcode.

It uses Objective-C.

Chris Henrich
God just doesn't fit inside a single religion.

Beginning for Beginning Beginners

Post by Bert Sierr » Tue, 20 Jul 2004 22:53:50

n article < XXXX@XXXXX.COM >,
XXXX@XXXXX.COM (JonesR) wrote:

I'd start by picking a language. Objective-C comes to mind if you're
mostly interested in working with Cocoa. That'll only work on MacOS X
boxes, though. If you want to develop more platform-independent code,
then I can recommand Java with Swing (Swing is the GUI system for Java,
and supercedes an older GUI system called AWT). C and C++, although
executing significantly faster than both Objective-C and Java, can be
more difficult for a beginner to become comfortable with, especially
when you try and port your Mac-based code to other platforms.

David Cook also mentioned Python. Python is a terrific, very powerful
language for working with complex objects, but it suffers from one
significant drawback: it's extremely slow when you're doing anything
CPU-intensive. In one numerical test I performed, in which a million
random numbers were calculated using a special algorithm, a C
implementation ran in 1.48 seconds, a Java implementation ran in 2.62
seconds, and the same code written in Python ran in 338.86 seconds. If
you're building a GUI, though, you typically don't need to make a
million calculations, but if your application is a game or something
scientific this could be an issue.


If you're interested in building Cocoa apps with Objective-C, I can
highly recommend two books by O'Reilly & Associates as a starting point.
They are:

"Building Cocoa Applications: A Step-by-Step Guide" $44.95

"Learning Cocoa with Objective-C" $54.95

The first book is a primer, and the latter goes into more advanced
stuff. I found these texts essential when I was starting out with
Cocoa. All of the examples can be built and tested with Xcode or
Project Builder and Interface Builder.


Java is my favorite language at the moment, for a number of reasons that
I won't go fully into. MacOS X Panther comes with Java 1.4.2 built-in,
and it's an extremely fast implementation, as my earlier benchmarks
should attest. I find the language itself to be extremely clean and fun
to play around with. You can do some very advanced stuff with not too
much work.

Not too many people know that Java can also be used to develop Cocoa
applications, and has a faster message-passing scheme than Objective-C.

If you're interested in Java at all, there's a couple of O'Reilly books
I can recommend:

"Learning Java, 2nd edition" $44.95

"Java in a Nutshell, 4th Edition" $61.95

The first book is a primer, and the second is a reference text I find
essential when I forget how to talk to the built-in classes. Xcode (or
the older Project Builder) are both excellent development/debugging
environments for Java code.


I like this language a great deal, with the caveat that my primary work
is calculation-intensive, so I can't use it except in limited ways. I
got started with a couple of O'Reilly books on the subject:

"Learning Python, 2nd edition" $50.95

"Programming Python, 2nd edition" $54.95

Once again, the first book is a primer, the

Beginning for Beginning Beginners

Post by Alan Gaul » Wed, 21 Jul 2004 02:53:41

On Mon, 19 Jul 2004 06:53:50 -0700, Bert Sierra

Caveat: I am Python biased, but...

While it is interpreted it is not normally as slow as your
figures suggest and optimisers like Psycho and Pyrex are normally
very good at speeding up CPU intensive jobs like number
crunching. Also there are several math specific libraries
written in C.

From my experience I find, with C as a base, that
performance ranges like this:

C - 1
C++ - 2-5 (assuming using OOP features)
Java native code - 3-5
Java Bytecode - 5-10
Python bytecode - 10-20
Python optimised - 3-15 (depends heavily on app)

For Python to be 100 times slower than Java I suspect some
major inefficiency in the Python implementation of the algorithm!

But the general point is valid that Python is interpreted and
should probably be compared to Applescript rather than
Objective C in a Mac programming context.

And Python has the wonderful PyGame application kit that provides
most of the CPU hitting bits in C wrappers...

But I admit I'm biased :-)

Alan G.

Author of the Learn to Program website

Beginning for Beginning Beginners

Post by jones » Wed, 21 Jul 2004 06:42:04

<< > David Cook also mentioned Python. Python is a terrific, very powerful

Until you mentioned that slowness,
reminded me why I had probably been recommended to try python before, given my

What about something like Ruby?

But you know, a lot of what I wish to accomplish may very well not be CPU
intensive anyway. There are already Applescripts for some of what I would like
to do, it is just that running them does not provide enough feedback to me, or
running script editor seems a bit kludgey in comparison to something that might
have a window interface (which is easier to pop on an applescript these days it

Portability to other platforms is not really an issue for me. I prefer the look
and feel of cocoa apps.

Beginning for Beginning Beginners

Post by David Coo » Wed, 21 Jul 2004 08:26:56

Usually if you were going to do anything like that with Python you would use
a wrapper around some C code like numarray for numerical work or pygame for
games. A Python application written in pyobjc or pygtk will generally feel
more responsive than a Swing application and will certainly use much less

Dave Cook

Beginning for Beginning Beginners

Post by jones » Wed, 21 Jul 2004 10:07:11

Lastly, I should mention that I don't work for O'Reilly, I just have a
lot of their books and have rarely been disappointed by their content.
I also received about forty of their books or free, which helps.... ;->

Oh they are worth buying. I agree with you wholeheartedly about O'Reilly books.

Beginning for Beginning Beginners

Post by Bert Sierr » Wed, 21 Jul 2004 11:00:21

In article < XXXX@XXXXX.COM >,

The code is simply a straight port of the C / Java code base. There's
pretty much a one-to-one correspondence of the lines of code.
Admittedly, my benchmark is not a fair thumbnail of Python's overall
performance, and there are wrappers like PyObjC and PyGame that can get
it much closer to the speed of plain C.

Still -- I was scared away from using Python in my application.

-- Bert Sierra

Beginning for Beginning Beginners

Post by Bert Sierr » Wed, 21 Jul 2004 11:09:09

In article < XXXX@XXXXX.COM >,

Plus, Interface Builder simplifies how you connect the various GUI
elements and associated classes and methods. That's a BIG plus.

One more thing to consider when choosing the language: Xcode only
supports graphic debugging of C / C++ / Objective-C / Java code. As far
as I know, there's no way of stepping through a Python or Perl program a
line at a time and viewing variables. Maybe the experts will know of a
tool out there that does this.

-- Bert Sierra (again)

Beginning for Beginning Beginners

Post by David Coo » Wed, 21 Jul 2004 14:33:42

The Python de *** is called pdb. I'm sure Perl has a de *** . In 8
years of using Python I've never used a de *** , relying mostly on print
statements and tracebacks.

Dave Cook

Beginning for Beginning Beginners

Post by Joe Daviso » Fri, 23 Jul 2004 00:34:24

If you're running, ddd is a graphical interface to a variety of
de *** s.
< ;

Beginning for Beginning Beginners

Post by Joe Daviso » Fri, 23 Jul 2004 00:54:36

It's a great book, I agree. Given the OP's experience however, I'm not
sure Objective-C is the road to go -- he has no experience in C, and an
ages ago Pascal course is probably only going to make it harder to

I suspect Python may be a reasonable answer, though I must admit I'm
more familiar with Perl.

One must realize there are several things one needs to learn to do this
kind of programming. They're all munged together in practice, but you
may want to look at those tutorials to see what they focus on. I'm sure
others will have a different list, but here's my initial list:

a) how to program / think about programming -- this is a skill usually
learned in conjunction with a programming language, but is actually a
different skill than knowing the language. OP's done some of this already.

b) a programming language -- the syntax / semantics of the language --
usually easier than a).

c) the libraries associated with the language -- these are the things
that save tons of coding -- instead of inventing everything yourself,
you use other people's work. In learning Cocoa, this is probably the
hardest part, after a).

d) the development tools. Xcode, for instance

e) the pattern set / pattern languages that fit it all together. This
really comes with experience -- but, particularly with Cocoa, they're
embedded in the Cocoa frameworks -- Model View Controller, for instance.


Beginning for Beginning Beginners

Post by Glenn Andr » Fri, 23 Jul 2004 02:36:07

In article < XXXX@XXXXX.COM >,

One can also use PyOXIDE -

It includes a graphic de *** which steps through code, sets
breakpoints, views local & global variables (as well as provides all the
various editor functions including syntax hilighting, popup function
menus, etc...)

It's also open-sourced.