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 > Java or Objective C ?

Java or Objective C ?
Thread Tools
Fresh-Faced Recruit
Join Date: Jun 2003
Location: Charlottesville, VA
Status: Offline
Reply With Quote
Jun 29, 2003, 04:50 PM
 
I read some comments on this topic in this forum from a few years ago, but I was hoping to get some fresh input about it.

I feel comfortable with Java (school focused on it, but we did a bit of C++ as well) and so I'm leaning toward using Java. I was wondering what advantages Obj C, as the native langauge, have over java.

Are there significant preformance gains? Are there more libraries available?

Matt

PS - is Obj C easy to learn as a Java programmer, if so, what's the best way to do so?
     
Fresh-Faced Recruit
Join Date: May 2003
Status: Offline
Reply With Quote
Jun 29, 2003, 05:09 PM
 
The main differences between the 2 are syntax and memory management. Obj-C uses a more descriptive way to call methods were the passed variable is "label" directly before the varialbe name. In java the method name is smooshed all together at the beginning of the call. Java uses garbage collection, an automatic way to handle memory, a dereferenced pointer is recycled. In Obj-C the memory management is manual and the program must handle giving up unused space.

For java and MacOSX you have 2 options one is the native Cocoa libraries and the other is swing, which is not platform dependent. I believe that not all of the Cocoa interfaces are available to java. If you choose Obj-C you have to use Cocoa, but can also use carbon and all of the unix libriaries in C.

That said you should rely less on the language and more on program design. If you engineer all the objects before progamming you can easily create the code in any language you like. I would suggest using the language you feel most comfortable with, I use English.
I am now going to tell the computer what he can do with a life-times supply of chocolate.
     
Registered User
Join Date: Feb 2003
Status: Offline
Reply With Quote
Jun 30, 2003, 12:05 AM
 
I was faced with the same question and I ended up choosing Java over Objective-C.

If you are looking to gain employment in IT then Java is by far the most popular language in comparison to Objective-C which is limited in most part to OS X desktop application development, a very small market. This is even more true for those living outside of the U.S. were we have smaller IT markets.

If you are only developing for fun, and only for Mac OS X then yes I would recommend Objective-C and Cocoa.

Java is also widely adopted, and can be employed for a vast range of needs. From Desktop Applications (J2SE), Web Development (JSP, JSTL, JavaBeans, and Servlets in J2EE), to Mobile phones, and PDA's in the form of Midlets (J2ME). Java also has excellent support for XML, SOAP. Thus you can learn the basic language syntax of Java that you are familiar with and be able to deploy solutions across a range of clients, and environments.

I would say that Java would be marginal harder language to learn, just because it is so vast in it implementations, rather then any innate language complexity.

Having said all that, if you have a sound understanding of Java and OOP then learning Objective-C will be no major task for you. You can have your cake and eat it to.
(Last edited by depolitic; Jun 30, 2003 at 06:50 AM. )
     
Junior Member
Join Date: Oct 2002
Location: Sydney, Australia
Status: Offline
Reply With Quote
Jun 30, 2003, 12:32 AM
 
Originally posted by Wafflestomper:
I feel comfortable with Java
Since you already are comfortable with Java then this would be my logical choice. In fact you have two options with java on the mac. 100% pure java and cocoa-java.

100% pure java will provide good cross platform support, but native-like feel on mac os X.

Cocoa-Java gives you the best of both worlds where you can use the best of Java and the best of cocoa. The downside of Cocoa-java is that it is the "poor cousin" and there are very few books on the subject and you will need to "translate" from Objective-C examples somewhat.

That said however, a well designed Cocoa-Java program should give great native look and feel and if you keep the Cocoa classes "sand boxed" you should still be able to port easily to another platform if required.

Oh yeah once you know java you will find learning C# on .net a snap ! as it is basically a Java clone.
     
Fresh-Faced Recruit
Join Date: Jun 2003
Location: Charlottesville, VA
Status: Offline
Reply With Quote
Jun 30, 2003, 12:36 PM
 
At this point I'm definitely leaning towards just using Java, because I know and like it. I wasn't aware of the difference between Java and Cocoa-Java. Is that basically the difference between using awt/swing or Cocoa classes? I'm pretty sure that's what you were talking about. I was trying to find some stuff online about the cocoa classes, but could find anything on them. There has to be a Javadocs site for the cocoa classes, does anyone know where it is?

Also, I've never really done programming that interacted with the system before, eg. changing the desktop picture, or putting up a menuling or something. Using java, are the Cocoa classes the things that I need to be looking for, or are there other classes that I should be dealing with?

thanks
     
Mac Elite
Join Date: Aug 2001
Status: Offline
Reply With Quote
Jun 30, 2003, 03:25 PM
 
Originally posted by Wafflestomper:
At this point I'm definitely leaning towards just using Java, because I know and like it. I wasn't aware of the difference between Java and Cocoa-Java. Is that basically the difference between using awt/swing or Cocoa classes? I'm pretty sure that's what you were talking about. I was trying to find some stuff online about the cocoa classes, but could find anything on them. There has to be a Javadocs site for the cocoa classes, does anyone know where it is?

Also, I've never really done programming that interacted with the system before, eg. changing the desktop picture, or putting up a menuling or something. Using java, are the Cocoa classes the things that I need to be looking for, or are there other classes that I should be dealing with?

thanks
Apple has extensive documentation of Cocoa on their website at developer.apple.com (and yes, Cocoa Java is just using Cocoa classes in Java, although the internal implementation is a bit hairy). Personally, I decided to learn Objective C instead (it took less than 2 weeks, possibly I'd already done a little beginning C++. Mostly Java though). It's a very nice language. The main things that would be a shock coming from Java are memory management and pointers. If you want to learn it there are several good O'Reilly books on it.
     
Senior User
Join Date: Oct 2000
Location: Lawrence, KS
Status: Offline
Reply With Quote
Jul 1, 2003, 11:11 AM
 
Java is currently better for earning a living. I say currently, becuase the Java jobs are becomming very commoditized and the trend seems to be to take the Java corporate apps oversees... Is IT going the way of the garment industry? Don't get me started on that...

Cocoa will broaden your perspective as a programmer. Seeing things from a different angle can only help. Yes it's not cross platform. But remember that a lot of what is Cocoa today used to run on Intel as NeXSTEP. So Apple can definitely play the cross platform game at some point in the future -just don't hold your breath.

So my advice is learn both. One will be as commoditized as picking strawberries the other one will at least provide some good fun and new ideas.
     
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status: Offline
Reply With Quote
Jul 1, 2003, 12:02 PM
 
The biggest problem with Java/Cocoa instead of Objective-C/Cocoa is a lack of examples and documentation. The docs for ObjC are just a lot more complete and full. Also, there are books out for ObjC/Cocoa, but none for Java/Cocoa.

I'm an accomplished java programmer, but have not really ventured into Java/Cocoa for this reason.
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
     
Mac Enthusiast
Join Date: Dec 2001
Status: Offline
Reply With Quote
Jul 1, 2003, 01:56 PM
 
The biggest problem with Java/Cocoa instead of Objective-C/Cocoa is a lack of examples and documentation. The docs for ObjC are just a lot more complete and full. Also, there are books out for ObjC/Cocoa, but none for Java/Cocoa.
I found it quite easy to read one of the short intros to ObjC syntax and then just use the ObjC documentation, books, and so forth. Most of the concepts in ObjC have parallels in Java.

Yes, there are some differences, especially Categories and ObjC's loose typing. Still, I find them fairly straightforward to resolve and in doing so I learn about both ObjC and Java.
     
Forum Regular
Join Date: May 2001
Location: Oviedo, Floriduh USA
Status: Offline
Reply With Quote
Jul 1, 2003, 04:15 PM
 
I've done both Objective-C/Cocoa and pure Java and I would suggest keeping it that way.

While you can do Java/Cocoa, it's not an optimal way to get to do Mac OS X programming. It's similar to MS tying their Visual J++ to Windows. The BlastApp example is a great example of how well it works though.

Swing has enough meat to it that you can do most anything you need and Apple is working to make certain Mac OS X things can be reached through Java without calling Cocoa.
folding@home is good for you.
     
Registered User
Join Date: Feb 2003
Status: Offline
Reply With Quote
Jul 1, 2003, 09:42 PM
 
DaGuy not aiming to get you started, but is it worth it then still learning Java. I do not live in the U.S. just in a colony of the U.S. (do not get me started). If Java applications are moving to places like India and China, will developers in more developed IT economies have much value. Would it be wiser to learn a more specialized language, and go for the more boutique job.

I have heard that to gain employment you will need more then programming skills. You will need to be a Java developer with a love of stock market, or weapons systems or something else. Just so that you can be seen separate from the hordes of other developers.

The problem I face is will my Java studies come to zero. Having studied another language that went no were employment wise.

Also I am no longer so hopeful for the future of Java. As Microsoft now has .NET and will surely convert all Windows developers to .NET in time. Developers that have traditionally used Java. Also the fact that SUN as a company seems to not know where their ass is let alone having a vision for Java outside of more and more API's.

Even universities are starting to bump Java in favor of .NET because of MS marketing pressure.

Case in point an article title "Recruiters, employers provide IT job outlook" states:

There had been a large take-up of Microsoft .NET technologies.
This is from a major employment web-site http://www.careerone.com.au

I however will not be making the switch, I will rather take up gardening then .NET and if gardening fails a brain hemorrhage will do.
(Last edited by depolitic; Jul 1, 2003 at 09:48 PM. )
     
Senior User
Join Date: Oct 2000
Location: Lawrence, KS
Status: Offline
Reply With Quote
Jul 1, 2003, 10:36 PM
 
Originally posted by depolitic:
DaGuy not aiming to get you started, but is it worth it then still learning Java. I do not live in the U.S. just in a colony of the U.S. (do not get me started). If Java applications are moving to places like India and China, will developers in more developed IT economies have much value. Would it be wiser to learn a more specialized language, and go for the more boutique job.

I have heard that to gain employment you will need more then programming skills. You will need to be a Java developer with a love of stock market, or weapons systems or something else. Just so that you can be seen separate from the hordes of other developers.

The problem I face is will my Java studies come to zero. Having studied another language that went no were employment wise.

Also I am no longer so hopeful for the future of Java. As Microsoft now has .NET and will surely convert all Windows developers to .NET in time. Developers that have traditionally used Java. Also the fact that SUN as a company seems to not know where their ass is let alone having a vision for Java outside of more and more API's.

Even universities are starting to bump Java in favor of .NET because of MS marketing pressure.

Case in point an article title "Recruiters, employers provide IT job outlook" states:



This is from a major employment web-site http://www.careerone.com.au

I however will not be making the switch, I will rather take up gardening then .NET and if gardening fails a brain hemorrhage will do.
Java will be a good asset on your resume for a long time to come. I don't want to discourage anyone from it specifically. Be that as it may, the realities of IT globalization should be factored into every IT career decision.

With that said, I don't believe that Java development (by itself) is a good trade. Being a well-rounded Developer that understands a good amount of Java is a better career track.

In regards to the .NET stuff. Microsoft will make some noise and exercise pressure were in can influence adoptions. Nevertheless, I see no real enthusiasm for .NET. There's a lot invested in Java and that along with a weak economy has prompted a bit more care in new technology adoptions by IT Managers.

Before .NET makes it big, MS needs to provide a secure platform... and there you go, Java is safe for a very long time.



(Last edited by DaGuy; Jul 3, 2003 at 09:09 AM. )
     
Senior User
Join Date: Oct 2000
Location: Lawrence, KS
Status: Offline
Reply With Quote
Jul 1, 2003, 10:39 PM
 
I screwed up editing my post. Sorry. See above for my reply.
     
Registered User
Join Date: Feb 2003
Status: Offline
Reply With Quote
Jul 2, 2003, 08:46 AM
 
-WARNING- A negative, and depressing rant, by a disillusioned, individual. You may poke fun at me, and call me a fool, but my feelings are valid as are my conclusions. Just because they are mien and mien alone. And yes I have been taking my medication. And no I am not joking.

I got into web design, and then then into web development when their was a bright future in IT. Shortly after the bottom fell out of the computer industry here in OZ and after three years of self directed study and learning. And desperately trying to find work. Living on the edge of poverty, making a living as a freelancer. I have decided to give up on the whole computer revolution.

I was going to enroll in a Grad Dip in IT, but will now reject the offer for a place in the course. I see no point in me working in IT and computers. A man must love his work, or his work will be is jailer.

I love my Mac's I love UNIX, and I used to love coding. I however see no future in any of these solutions beyond marginal players in a field that is ever becoming more pro MS. I used to have hope that Linux and Open Source would form a momentum of change however, in three years open source is still only the forte of the geek. IT departments, governments, and the media are all in the pocket of MS. It is a happy world, a world that has only made me bitter.

I am sure that many will say that my analysis is far to pessimistic, I will admit that it is pessimistic but I am giving away my computer books, I will be selling my Macintosh, and I have no plans to replace my computer in the future.

As soon as the economy return's to better margins, MS will come out fighting with its huge budgets, and will surly kill of the last remnants of what is now seeming to be nothing but pathetic resistance.

Microsoft may not have the best solutions, .NET may not have a powerful platform to work from. However such things do not matter, as we all know that mediocrity is aim of most people and organizations, makes them feel better being mediocre, mediocrity is what people want excellence, and perfection, these are not worthy goals. If you can say one thing about Microsoft and all that it brings to the world is that it always abides by the motto of mediocrity.

I have in short no hope, I will tend to my garden, at least it feeds me, and brings me peace of mind and purpose. But then I realize that I have no garden. Only an empty wall.

-- End Rant --
     
Senior User
Join Date: Oct 2000
Location: Lawrence, KS
Status: Offline
Reply With Quote
Jul 2, 2003, 10:18 AM
 
Dang...

Dude, you can sure use a few (perhaps a bunch of) beers. Too bad you are somewhere in down under, otherwise I would gladly contribute a few.

Much of today's great software comes from Opensource i.e., Apache, Tomcat, MySQL, STRUTS and it goes on and on. Were was MS when these apps got a stronghold on their respective areas? They all work REALLY WELL. Why go from those to paying fees to MS? MS really feels threatend by Opensource -and it should. No secrets there.

In any event, the IT industry is far from dead. It's just not as lucrative as it was a few years ago. Sadly, It has grown to know too much... For example: to outsource overseas and to reuse code better. For years the goal was to achieve high productiviy with very low costs. No one paid much attention until these things finally materialized... but the writing was on the wall for quite some time.

So how do we survive the new realities? That's a tough call and I personally play it by ear. I've been getting the dust of my mechanical engineering books and will try to make IT a secondary profession. In any event, I'm not getting rid of my Java collection and certainly not my Mac -heck can't wait 'till Panther shows up!

Hang in there.
(Last edited by DaGuy; Jul 2, 2003 at 10:59 AM. )
     
   
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 03:45 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