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 > Cocoa and java

Cocoa and java
Thread Tools
Fresh-Faced Recruit
Join Date: May 2002
Status: Offline
Reply With Quote
Sep 22, 2003, 07:26 PM
 
Hi i am currently learning java. When i am done i want to learn Cocoa. Can I use cocoa with java, or should i learn obj-c? Also what is the difference between them when using cocoa.
     
Mac Elite
Join Date: May 2002
Status: Offline
Reply With Quote
Sep 22, 2003, 09:01 PM
 
You can use Cocoa with Java. It's a bit slower and there is the occasional mysterious problem, but for the most part it works fine.
[vash:~] banana% killall killall
Terminated
     
Mac Elite
Join Date: Aug 2001
Status: Offline
Reply With Quote
Sep 22, 2003, 09:02 PM
 
You can use Java with Cocoa, but Objective-C is what it Cocoa is designed for. The great advantage of Java is platform independence, and tying it to a platform specific API (Cocoa) sacrifices that advantage. Objective-C is pretty easy to learn (I knew a little C++, and a moderate amount of Java, and I picked it up very quickly). The primary things you'd have to get used to is doing your own memory management and slightly different syntax, like this:
Code:
class MyClass { //variables //methods }
is equivalent to

Code:
@interface MyClass { //variables } //methods @end
and this:

Code:
myObject.myMethod(anObject, anotherObject);
is roughly equivalent to

Code:
[myObject myMethodWithObject:anObject object:anotherObject];
Once you get past the different appearance and having to pay attention to memory management, Objective-C will be very easy. Cocoa will take much longer to learn than Objective-C will.
     
Professional Poster
Join Date: Dec 2000
Location: Chicago, Illinois
Status: Offline
Reply With Quote
Sep 22, 2003, 09:31 PM
 
If you're starting out with Java as your first language or something, I think Cocoa-Java is a good approach. It introduces you to most of the concepts of nib based development using Cocoa while allowing you to get your feet wet in Java. The transition from Java to Objective-C isn't too hard, took me about two weeks to start working fluently, and that was between classes and learning C++ at the same time.

Cocoa-Java has some mysterious problems, and because the Java-ObjectiveC bridge is sort of under documented, the mysteries aren't always resolved very quickly.

Matt Fahrenbacher
     
Fresh-Faced Recruit
Join Date: Nov 1999
Location: San Jose, CA, USA
Status: Offline
Reply With Quote
Sep 23, 2003, 02:00 PM
 
Cocoa-Java has some mysterious problems, and because the Java-ObjectiveC bridge is sort of under documented, the mysteries aren't always resolved very quickly.
I've got a bunch of back-end code in Java and want to build a useful MacOS X UI, and therefore a non-Swing version.

Is there some site with a comprehensive list of those problems involving the bridge and using ObjectiveC objects from Java? Or will I discover as I go?
     
   
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 07:11 PM.
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