# new programmer for Mac OS X?



## Untitled (Apr 23, 2001)

Hello,
When I was about 11 my dad purchased HyperCard 2.4 for me. I know that he used this at his old job and really thought it was an excellent beginners language. Up to this day I still feel the same way as he does about HyperCard. However, about 4 months later of using the program intensely, I began to run into boundaries and began to search for a new language which was more powerful. After searching the Internet for a few day (Yes I did run into Apples ADC) I found I could not find which language to learn next. I learned that many languages existed such as C, C++, Java, Cocoa, Assembaly, and many more.
The problem I began to run into was yea, there were enough languages, however I did not know where to turn to find which language would be best to learn next.
Discouraged because I could not find any information about this, I turned towards the web and began learning the languages available there because there was so much material available. While this did satisfy my programming for a while, I began to miss programming with HyperCard and the Macintosh Platform especially since Mac OS X is out.
After all of this I have arrived at my question to anyone who has programmed on the Mac before, what should I learn now?
I would appreciate your reply.
Jeff N.
P.S. I do have CodeWarrior IDE 4.1 and I have played around with SillyBalls if that helps at all


----------



## AdmiralAK (Apr 23, 2001)

Hypercard as far as I know is dead by apple's volition (although there is a petition circulating to get it back).

I would suggest learning a language first that is universal and widely accepted as having been established (if you dont have much programming experience that is).  I would start off with C and java (whichever you take first if your preference, I did java first).  Then if you want to do mac only programming youu can graduate to learning cocoa.

Of course this is all a matter of personal philosophy 


Admiral


----------



## Tom Kroening (Apr 24, 2001)

I'll have to agree that you should start with something small (preferably cross platform) first and work your way up. I started off after Hypercard, applescript, and HTML with ANSI C++ and then slowly taught myself C toolbox. I really am not a big java fan so  i've never spent much time on it. Cocoa is excellent! I can't get over how easy it is to write a program. The only problem is that i don't know if making the jump past the toolbox is necessarily the best thing just yet. I feel that if you want to be a good mac developer you should know how to write a complete program with your own event loop so that you know how a program operates. From the toolbox i started teaching myself powerplant. I loved powerplant from the start. Its the closest thing to cocoa that i've seen, although it required a good understanding of the C++ language.  Whichever route you go just be confident and dont give up!


----------



## rharder (Apr 24, 2001)

I didn't know HyperCard was even still around. I guess it isn't now, though.

Java is a widely accepted language on nearly all computing platforms, and you can write Cocoa apps with it too. Bonus! That might be a good place to start.

Objective-C is the language you'd use if you wanted to do Cocoa programming with a C-style language, but Objective-C is not very well-known, and you'll have trouble finding choices in books about it. Hopefully this will change soon.

Does anyone know why Apple chose Objective-C over the popular and object-oriented-capable C++?

-Rob


----------



## monty (Apr 24, 2001)

Well first, it was Next that picked (invented?) objC. The reason they didn't pick C++ was that it didn't have a lot of the features needed like runtime linking and stuff like that. Also C++ is very difficult to learn whereas, if you know C, objC can be learnt in days. Cocoa relies on the fact that you can have a situation where an object doesn't know the class of the object it is messaging. In c++ all this is determined at compile time. Basically cocoa wouldn't really work if Next had used C++ and even if Next really tried you couldn't write a working app in five minutes like you can now!

peter


----------



## rharder (Apr 24, 2001)

Oh.

C++ can't handle "late binding?" Even with casting, like Java?

-Rob


----------



## monty (Apr 24, 2001)

I don't have a clue. I was just reciting from the Dev docs! I think that late binding isn't the same as runtime binding though. late binding is put off until the link stage whereas runtime binding is put off until you actually go to send that object a message. You can't get much later than that!

peter


----------



## endian (Apr 24, 2001)

NeXT picked, not invented, Obj-C. It was invented by Brad Cox.

see http://www.dekorte.com/Objective-C/Documentation/3_History/History.html

and also http://dmoz.org/Computers/Programming/Languages/Objective-C/


----------



## strobe (Apr 25, 2001)

Screw Java, learn C and Objective-C. It's a *LOT* easier than Java or C++


----------



## rharder (Apr 25, 2001)

I <em>am</em> interested in learning Objective C, but I can't see how you can make an argument that it's easier than Java. 

They're both object-oriented, but in Objective C you have to worry about having all objects have the appropriate root object (NSObject). 

Also Objective C's syntax is strewn with extra bracket characters and junk. I've never seen such a low character-to-instruction ratio in my life. Well, maybe AppleScript.

My guess is that Objective C probably runs faster than Java code, but if you're only using Java to piece together various events, that hardly matters.

-Rob


----------



## strobe (Apr 25, 2001)

WTF?!?!?!

Worry about all objects being NSObjects?! That's not a worry, that's SALVATION!

Objecitve-C's syntax is very CLEAN because it uses brackets! This is opposed to Java which borrows the C++ class syntax which is extremely CONFUSING because it's the same syntax as a struct!

And OO has nothing to do with it's ease of use. OO is what a lgnauge supports, how it implements it defines how easy it is to use. Java is far more restrictive. It's hardly different than C++!

This means in Java you have to twist yourself into knots of subclasses which only adds to the total number of classes you have to keep in mind of in a project. Meanwhile Objective-C allows you to use general protocols which can be used with a wide vereity of classes. It's totally different.

Java is ANAL


----------



## monty (Apr 26, 2001)

I'll have to agree with strobe.

I haven't used java but if it's anything like c++ I shudder to think!
And I don't see the point of using java for cocoa unless you allready know that language. One of java's biggest strong points is its portability and if you use the cocoa API you basically throw that out the window. Java is slower and the cocoa API for it is less mature. So I wouldn't set out to learn java if you want to make cocoa programs but if you allready know it (like Rob) then by all means use it.

Peter


----------



## AdmiralAK (Apr 26, 2001)

Me personal oponion on this matter is as follows:
I have not ever in my while life wroton an obj-c program.
I ave seen code though.  I know java and have writen a few things in it.
It would be stupid both for me, and other who only know one side of the
story to have a very strong opinion.  I do not know C++, but if the structure
is like java's then it makes sense to ME.  I have seen obj-c code.  Some of
the conventions an bracketing/bracing doent make sense.  

It's just what one is apt to and what others are not, and it is what you get
used to.  I think that most people should try before they express their sentiments.
Try writing, compiling, runnning, and then comparing speeds and ease.


Admiral


----------



## Brian Somers (Apr 26, 2001)

You might as well learn both. There are a lot more people who know Java and that is a HUGE reason why Apple is pushing that language now. WebObjects 5 is going to be entirely in Java. However, given a choice, I still prefer to code in Objective-C.  Here's a sample of {} and [ ] usage:

#import "dir/filename.h"
#import "Foundation/List.h"

@interface Class (Category)
id listOfStuff;
-setValue:aList;
-getValue;
@end

@implementation Class (Category)
 -setValue:aList
{
  List *listOfStuff;

  [[listOfStuff  alloc] init];
  listOfStuff = aList;
  [listOfStuff autorelease];
  return self;
}

-getValue
{
 return listOfStuff;
}
@end

The above example is very basic - but I hope it shows exactly how {} and [ ] are used. I threw in @ and () for good measure ;-)

Regards,
Brian Somers


----------



## Tom Kroening (Apr 26, 2001)

C++ might be easier to understand when implimenting the classes at first, but its much much harder to use. Don't let those brackets scare you away! Here's what they mean

c++ class called testObject with a function called returnValue of type int. 

int a = testObject.returnValue(); 

Pretty easy to understand. Here's how objective C would do it.

int a = [testObject returnValue]; 
Was that so hard? Okay lets dive a little deaper and used nested brackets...

NSMutableString stringOne = [NSMutableString stringWithCapacity:10]; // create an editable string an give it an idea of how big it will be. 


NSString stringTwo = @"abcdefg"; // create a static string, with me so far??

// Next we set the string of stringOne to the substring starting at location 0 with a length of 3 of stringTwo. The colon at the end of a function means you are sending that function a value. 



[stringOne setString:[stringTwo substringWithRange:NSMakeRange(0,3)]];

//stringOne will now be = to @"abc"


There, that wasn't so hard was it? I'll admit it seems a little weird at first, but just stare at it for a while, it will pop out at you like one of those hidden pictures. One shortcoming of objective C is that there is no operator overloading, but that is far outweighed by the benifites.


----------

