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 > Learning Cocoa... Native apps?

Learning Cocoa... Native apps?
Thread Tools
Forum Regular
Join Date: Nov 2001
Location: New Jersey, USA
Status: Offline
Reply With Quote
Nov 9, 2001, 12:03 AM
 
I have a few questions.

I already know the basics of C++... object-oriented design concepts, pointers, inheritance, all of the basics. I'm interested in learning Cocoa.

I will be taking courses in Java come spring semester here at Rutgers University -- so I'm thinking about making the complete switch over to Java. I'm also thinking about learning Objective-C or C alongside of Java and quitting C++ all together.

Any suggestions? Java is the easiest, but supposedly is slow and is missing some major features that C and it's family has. C is the most widely used from what I've seen, but since I know C++ am I better off just trying to jump right into Objective-C?

And lastly, what exactly makes a program "native" to OS X? This seems to be a concept that I'm not understanding. I want to write programs for MacOS X and I've been told that I should learn Objective-C.

Sorry for all the questions, I'm just kinda confused. Thanks for any help.
     
Dedicated MacNNer
Join Date: Jan 2001
Location: Boulder, CO, USA
Status: Offline
Reply With Quote
Nov 9, 2001, 01:06 AM
 
Originally posted by Mike the Knife:
<STRONG>I have a few questions.

I already know the basics of C++... object-oriented design concepts, pointers, inheritance, all of the basics. I'm interested in learning Cocoa.

I will be taking courses in Java come spring semester here at Rutgers University -- so I'm thinking about making the complete switch over to Java. I'm also thinking about learning Objective-C or C alongside of Java and quitting C++ all together.

Any suggestions? Java is the easiest, but supposedly is slow and is missing some major features that C and it's family has. C is the most widely used from what I've seen, but since I know C++ am I better off just trying to jump right into Objective-C?

And lastly, what exactly makes a program "native" to OS X? This seems to be a concept that I'm not understanding. I want to write programs for MacOS X and I've been told that I should learn Objective-C.

Sorry for all the questions, I'm just kinda confused. Thanks for any help.</STRONG>

The only definition for "native" i can think of would be "it doesn't run in Classic." The language and API used means nothing as far as that goes. However, you'll only get the Apple-blessed UI through the Carbon or Cocoa APIs. Carbon is available from Obj-C and C/C++, Cocoa is available from Obj-C and Java. (um. i think there are Java AppKit classes, no?)

At some point Apple did a little marketing gimmick to try to push developers to write in Obj-C/Cocoa. They made it sound like Cocoa was the only way to achieve the golden seal of OS X native-ness. Entirely silly, but it seems to have stuck in some people's heads.

As for language ... I'd try them all and stick with what works. Or mix and match, if you have a design problem that requires it. I still haven't gotten around to digging into Cocoa, but it's supposedly a joy to use...

Also, there have been a number of threads in this forum about such things.
     
Grizzled Veteran
Join Date: Feb 2001
Location: Germany
Status: Offline
Reply With Quote
Nov 9, 2001, 05:16 AM
 
i think that this is a question of two things:
1. personal preference
2. whom do you want your apps to use?

1. i have done java for a couple of years and really liked it because things were quite easy. i think the apis really aren't bad and sun tried to make it easy for people to be able to write applications quite fast. java is nice and unfortunately often is only seen as something that you can use for disturbing applets nobody looks at.
then, a couple of months ago, i bought "learning cocoa" and started doing stuff -- and quite frankly, now i'd only touch java again if it really had to be. (i know i will have to)
apple did a fantastic job, i'd say the apis are even better than java's. it is extremely powerful and once you got used to the objective-c syntax, it is really easy.

2. i understand you're a student like me. so, do you plan to sell applications? if yes, your audience will most likely be bigger if you wrote your stuff in java. (there *are* some useful java applications out there)
but do you *want* everybody to use the things you wrote? or do you want to be as arrogant as me and write for a small elite audience?

to at least answer one of your questions: yes, java is the easiest. garbage collection, very restrictive compiler (e.g., in the c's, the compiler will warn you if you don't return something even though you declared a method as returning something but will go on building, javac will stop at that point -- this has both advantages and disadvantages),...
as far as speed is concerned, this is rather a question of what you want to do. computing fractals might not be a good thing to do in java, but if you look at applications like jext, their speed is not overwhelming but acceptable.

seriously, have a look at both and you'll very quickly see what you personally like better.
     
Clinically Insane
Join Date: Nov 1999
Status: Offline
Reply With Quote
Nov 9, 2001, 06:48 AM
 
As I understand it, Cocoa/Java actually does go through the JVM; it doesn't get compiled into native code. However, the JVM on OSX is fast enough that this will not be noticeable unless you are performing thousands of CPU-intensive operations. And be sure to note some of the better Java programs out there, like jEdit, CrishFTP, and the InstallAnywhere series of installers; these are fast enough that with the right widget sets, they feel just as fast as native-compiled code. So while I wouldn't write a first-person shooter or an RC5 client in Cocoa/Java, it should be more than suitable for most tasks. What is it that you want to write?

Now, as to what makes a program "native" to OSX? That's not an easy thing to define. If you have to use Classic to run it, it's definitely not native. Cocoa/Obj-C is definitely native. So is Carbon. Cocoa/Java might be considered a grey area (because of the JVM thing), but it is close enough that it should probably be considered native.

What's the big deal over what is "native" and what isn't, anyway?
You are in Soviet Russia. It is dark. Grue is likely to be eaten by YOU!
     
Forum Regular
Join Date: Oct 2001
Location: Sweden
Status: Offline
Reply With Quote
Nov 9, 2001, 07:07 AM
 
Originally posted by Millennium:
<STRONG>As I understand it, Cocoa/Java actually does go through the JVM</STRONG>
Yes, it does. The Java classes (like the Java string object) and runtime environment (like the garbage collector) is a part of the JVM, and all that is needed for Java programs to run.
     
Fresh-Faced Recruit
Join Date: Jan 2001
Location: Areas 51 thru 55 :P
Status: Offline
Reply With Quote
Nov 9, 2001, 10:43 AM
 
Note: The following is my opinion.

I believe that if you want to write Cocoa applications, use Obj-C. If you want to write Java applications, use Swing or AWT. The Java-Cocoa integration is an awesome effort, but it is slow and has bugs.

That said, I still cringe at some of the syntax in Obj-C (especially the time warp back to 1992 and declaring variables at the head of statement blocks), but the language has some awesome features to it. The more I learn Cocoa, the more I realize that Java-Cocoa integration is a very difficult nut to crack.

To quote something I read somewhere:
"Java is just object-oriented enough for Cocoa"
I believe that what the actual quotee was trying to say is that Java is just dynamic enough for Cocoa.

There is a decent write up by Aaron Hillegass at <A HREF="http://"http://www.bignerdranch.com/Resources/Java.html"" TARGET=_blank>Big Nerd Ranch</A> on why one should not write Cocoa apps in Java.
Well, let's just say, 'if your VCR is still blinking 12:00,you don't want Linux'
     
Forum Regular
Join Date: Nov 2001
Location: New Jersey, USA
Status: Offline
Reply With Quote
Nov 9, 2001, 12:33 PM
 
Well, it would seem the best choice for me so far is Objective-C along side of Java.

This question, however, will determine if I just choose one (Java) or go with both: If I know Objective-C, is it backwards compatible with C? Meaning if I know Objective-C, I basically know C, right?

Also, the common method to learning Objective-C would be to learn C first, right? And then learn the extensions and OOP design methods of Objective-C?

The way I see it, I'll be learning Java either way here at school, and I know it won't be a problem for me because of my C++ knowledge. But I also want to be able to write UNIX programs, maybe 3d engines in the future (?), and be a open to whatever as possible.
     
Grizzled Veteran
Join Date: Feb 2001
Location: Germany
Status: Offline
Reply With Quote
Nov 9, 2001, 01:48 PM
 
do one language at a time.

back in school, i took russian and spanish at the same time and always started speaking russian in my spanish class.
i don't think it's any different with computer languages.

to be honest: i think that pure c is not worth the effort. if you want to start the easy way, go for java. it's quite easy and powerful enough for most things. (don't do awt, though. it's butt ugly on everything but os x and has some serious cross platform problems.)
     
Fresh-Faced Recruit
Join Date: Jan 2001
Location: Areas 51 thru 55 :P
Status: Offline
Reply With Quote
Nov 9, 2001, 02:12 PM
 
Originally posted by Mike the Knife:
<STRONG>Well, it would seem the best choice for me so far is Objective-C along side of Java.

This question, however, will determine if I just choose one (Java) or go with both: If I know Objective-C, is it backwards compatible with C? Meaning if I know Objective-C, I basically know C, right?

Also, the common method to learning Objective-C would be to learn C first, right? And then learn the extensions and OOP design methods of Objective-C?

The way I see it, I'll be learning Java either way here at school, and I know it won't be a problem for me because of my C++ knowledge. But I also want to be able to write UNIX programs, maybe 3d engines in the future (?), and be a open to whatever as possible.</STRONG>
If you know C, you know 80% of Obj-C. Apple's Objective-C guide (which can be read right from Project Builder) is quite excellent. One of the great things about Obj-C is the fact that you can dump down to C if necessary, which means integrating with gobs of C libraries. Obj-C++, which is now available in PB since X.1, allows you intersperse C++ and Obj-C code (meaning all of your C++ libraries are still useful). Implementation file extension for Obj-C++ files is .mm.

I picked up Obj-C, after much resistance, in a couple of days. I had not done any straight C coding in over a decade and no C++ coding in about 4-5 years. Kind of like riding a bike, really.

Cocoa, OTOH, is giving me fits. Sun's JavaDocs for the core API is far better in quality and quantity (IMO). Apple's documentation is sparse (which, when you think about how long OpenStep has been around, is truly amazing) and the available books are OK for just starting out, but barely scratch the surface.
Well, let's just say, 'if your VCR is still blinking 12:00,you don't want Linux'
     
   
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:49 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