cool - gear girl

Andrew Robinson EMAIL HIDDEN
Wed Dec 3 17:36:38 CET 2008


2008/12/2 Peter Korsten <peter at severity-one.com>:
> Andrew Robinson schreef:
>
>> I would love an Objective C primer that assumes you know Basic, rather
>> than all these ones that assume you either know nothing, or some other
>> brand of recent language.
>
> To be honest, a book that presumes you know nothing would be the better
> choice, because object-oriented programming requires a rather different
> approach than what you're used to.

Thanks for taking the time to write such a thorough reply, Peter, it's
much appreciated.

Actually, the whole object oriented thing makes perfect sense to me,
just before I got out of programming first time round it was being
touted as 'the next big thing', so I was quite prepared for that bit.

> Wow, you have quite a history there, but not anything used in the
> last... 15 to 20 years?

Unless you count actionscript, (and to be honest, you probably
shouldn't), I'm afraid not. What's really weird is coming back to
programming after so long and discovering that not much has changed,
and the predicted move to much higher level languages didn't happen.
Reading things like 'objective C is great because it has string
support and C doesn't' is reassuring and at the same time
disappointing, have we really not moved on from 'BASIC is great
because it has string support and Assembler doesn't'?

> So you see, you have the same elements: simple variables, arrays, and
> subroutines that are now called 'functions' or 'methods', depending on
> whether you're in an procedural or object-oriented language.
>
> The difference with what you're used to is also structured programming.
> This means, no jumps (goto, gosub, jmp, jnz, etc.), and stuffing
> everything in 'if', 'for' and 'while' constructs.

Luckily, AMPLE prepared me well for this, it had no jumps, you could
define your own 'words', which were conceptually the same as Functions
in objective-c. It had no variables either (totally stack based) so
things have got a bit better in the intervening years!

> Pointers, ah, well, they're a difficult subject to get your head around.
> You might decide to ignore them completely and go full-out
> object-oriented, but there's no real getting around them in C and C++.
> (I don't know Objective C, but I doubt it's much different.)

I'm fine with the concept (PEEK and POKE in BASIC are similar), but
after years of having it drummed into me that portable code shouldn't
case where something is in memory, it's a bit odd to find out that
'knowing where something is in memory' is something that beginner
tutorials introduce in the beginner chapters. I'm tempted to do
without for now, since I'm used to BASIC not having this ability at
all, and only using Assember (which does of course) when speed is
essential.

> Another important aspect is exception processing. This is quite
> primitive in C++, as far as I'm concerned, and a lot more useful in
> Java. (Again, I don't know how it works in Objective C.)

I'm not seeing it covered in tutorials, as I guess it's not that
important in Objective C, I could be wrong though!

> Then there's the bit about public and private variables and functions.
> This will also be an unfamiliar subject

Again, I'm lucky here - one dialect of Basic I used had private
variables for GOSUB routines, and I loved it. As far as I know so far,
there are no public variables in Objective C, you have to pass
everything through function results. Annoying, but with obvious
benefits for code re-use.

I think I've finally found a really good resource to learn from,
"Become an Xcoder" (a free download from www.cocoalab.com ) is has
helped nicely with the last few steps of my BASIC/Assembler to C to
C++ to Objective-C route with I hadn't mentioned... the full list is
actually BASIC/Assembler to C to C++ to Objective C to Xcode's
implementation of Objective C to  Xcode's implementation of Objective
C and the Cocoa API to Xcode's implementation of Objective C and the
iphone subset (and superset) of the Cocoa API. Now I'm learning Xcode
and a bit of Cocoa, and just having to hop sideways to the iPhone API.
I'm through Apple's dev hoops, and have my own written from scratch
'hello world' app actually runnig on my Phone so progress is
happening, albeit not very fluidly yet!

- Andy_R



More information about the music-bar mailing list