image
image

Go Back   macosx.com > Design, Media, Programming & Scripting > Software Programming & Web Scripting

Reply
 
LinkBack Thread Tools
  #1  
Old March 29th, 2001, 08:21 PM
Registered User
 
Join Date: Mar 2001
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Oliver is on a distinguished road
Hi, I'm kinda new to programming (know a lil HTML, JavaScript, basic Java) and I'm looking for a language to learn to develop applications for Mac OS X. So far, I've narrowed my choices down to Java and Objective C. There are pros and cons for each. I want to learn Objective C primarily because that's what Cocoa is written in -- I'm planning to develop using Cocoa rather than Carbon. However, Objective C seems to be such an obscure language. Does anyone else even make an Objective C compiler besides Apple? This leads me to lean towards Java. It is supported by many vendors, it's portable, plus I already have some experience with it. The thing with Java is that it's very slow. I know it runs on top of a Java Virtual Machine so it won't be as fast as native code, but the performance hit is very noticeable. Does anyone know if this will improve? Also, I read about Apple's Java Bridge that lets you access the Cocoa API with Java, but is this a viable approach? Are there any advantages/disadvantages in doing this? Hopefully, someone with more programming experience can enlighten me. Thanks.
Reply With Quote
  #2  
Old March 29th, 2001, 10:09 PM
Registered User
 
Join Date: Mar 2001
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
JSR COUT is on a distinguished road
Talking

Actually Apple doesn't make the Obj C compiler that comes with OSX. They use the GNU gcc compiler. If you want to be a hardcore Mac programmer, go with Obj C or for that matter use assembly lanauge...
Reply With Quote
  #3  
Old March 30th, 2001, 07:07 AM
Registered User
 
Join Date: Mar 2001
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
gidds is on a distinguished road
Java, definitely!

(First, I'm biased: I'm a professional Java developer, so you just know what I'm gonna say :)
<br>
I'd seriously look at Java. It's a lovely language to write for - it's clean and well-designed, and just <i>feels</i> right. There's a huge amount of useful stuff in the standard class libraries, and that's mostly well-designed too. There are loads of IDEs and other development tools out there, along with tutorials, books, libraries, even a blend of coffee...
<br>
Speed isn't the issue it was a couple of years ago. The first JVMs were just interpreters, and crawled; later ones had Just-In-Time (JIT) compilers which sped up the code but added a lot of overhead. But the latest one (the HotSpot VM that comes with the JDK1.3 in Mac OS X) is a <i>dynamic</i> compiler: it monitors the code <i>as it runs</i>, compiling code where it's worth it, and making optimisations based on what the code is actually doing - which is more than static C/C++/etc. compilers can usually do. HotSpot flies on Mac OS X - try it and see!
<br>
If you want Cocoa just for the Aqua UI, then you don't need it - the Swing GUI toolkit in the standard library has a pluggable look-and-feel (which means that the look-and-feel can be changed without changing a single line of code, even at runtime), and the default one on OS X (final) is Aqua! I was amazed when I fired up an app of mine and it appeared in glorious Aqua. (I don't know much about the Java Cocoa APIs. Even if they're good, you still lose portability, whereas with Swing you get Aqua <i>and</i> 100% portability!) (Admittedly, the initial Aqua L&F isn't perfect - I noticed a couple of redraw problems - but I'm sure it won't take long for them to get ironed out.)
<br>
And don't underestimate the benefits of portability. No porting worries, no recompiling, apps just <i>work</i>. I sent an app of mine to my mum's PC, and all she had to do was dobule-click on it and it ran. Perfectly. At work, we run stuff on NT or Unix interchangeably. Even my Psion's got Java! If you're sure that you're happy locking yourself into one platform, then fine. But if you ever want your software to get a wider audience, or might one day get a different platform yourself, Java is the obvious choice.
Reply With Quote
  #4  
Old March 30th, 2001, 11:16 AM
strobe's Avatar
Puny Member
 
Join Date: Dec 2000
Posts: 795
Thanks: 0
Thanked 0 Times in 0 Posts
strobe is on a distinguished road
I have to disagree 100% with "gidds"

1) Java is a very inflexible language compared to Objective-C. It has no forward invocation, no class extensions, no generic object types. I could never call it 'lovely'

2) bytecode execution is DOG SLOW! HotSpot 2.0 changes nothing. Java bytecode is still slow and always will be. You can think of HotSpot has a compiler which caches a lot, the initial penalty is still high. Try it and weep

3) Swing is NOT an API for the OS X platform. It's a Java platform API, like AWT. Swing apps do not behave like mac apps, they merely look like them. It's a facade and nothing more.

Swing is also a crummy API in it's own right. There is no interface abstraction. Cocoa is a lot easier to develop for.

If you want to write applications for OS X you'll want to use Cocoa, not Swing.

If you know C or Java it takes virtually no time to learn Objective-C. I learned it in one day.
__________________
---
>80 column hard wrapped e-mail is not a sign of intelligent
>life
Reply With Quote
  #5  
Old April 2nd, 2001, 04:56 AM
Registered User
 
Join Date: Mar 2001
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Tom Kroening is on a distinguished road
I will have to agree that you should use Objective C. It might be a bit tricky to learn right off the bat, especially if you havn't ever used our good old friend the toolbox before - dont give up. There should be some good books coming out for it soon. It truely has the best interface builder i've ever seen. It does everything for you! Although java is supported, you'll be much happier with objective C. It basically works on the principle of [dog fetch:stick]; It is a VERY good idea to learn some C... although objective C different from C, you can still fall back on C for many things. If you have a few minutes go through the currency converter tutorial thats included in your developer folder... you dont need to know anything about programming to do it, and if you understand somethings while in the process, you'll be one step closer. Good luck!
Reply With Quote
  #6  
Old April 2nd, 2001, 04:30 PM
Registered User
 
Join Date: Mar 2001
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Brian Somers is on a distinguished road
Java or Objective-C

Both languages were designed with different goals in mind and both have different strengths and weaknesses. I have worked with both, and my preference is with Objective-C. The basic syntax is easy to pick up, but learning the libraries will be what takes the most time, which is true for both languages. The way I look at it, desktop apps should be done in Cocoa/Objective-C for the power and speed. Java is more suited to web-based apps and that is where WebObjects comes in. Apple is marketing WebObjects with Java, fyi. Also, if you talk to any NeXT/OPENSTEP oldtimers, you will find them for the most part to be rabidly pro-Objective-C (if you experiment, you will soon see why). I guess the best advice I have to offer is just try both languages and learn their strengths and weaknesses and see for yourselves where you can best use each one.
Reply With Quote
  #7  
Old April 9th, 2001, 04:25 AM
Registered User
 
Join Date: Dec 2000
Location: PA or MD, USA
Posts: 722
Thanks: 0
Thanked 0 Times in 0 Posts
theed is on a distinguished road
contraversial fib(40) benchmark

I'm saying contraversial, because this is bound to inflame some people.

I wrote a basic fibinacci recursive program in C to run on 9(in classic) in X, and I wrote a java version, and here's how long each of them took to run:

C on 9 : 12.3 seconds
C on X : 25.0 seconds
java on X : 16.4 seconds

I wrote 9 code in CodeWarrior 5, X code for the command line in Project Builder, and the java in Project Builder.

There's a lot of weirdness going on here, but the final point to be made is that logical and mathematical operations in java are plenty fast. In some cases (backed up by theory as well as this benchmark) it's actually faster than C.

Machine dual 450 (although only 1 processor ever got used in these tests as the apps were single processes) with 512M RAM.

Can anyone come up with a reason for C on X to be so much slower than C on 9?
Reply With Quote
  #8  
Old April 9th, 2001, 04:57 AM
strobe's Avatar
Puny Member
 
Join Date: Dec 2000
Posts: 795
Thanks: 0
Thanked 0 Times in 0 Posts
strobe is on a distinguished road
I hope you realize there are two math libraries for Java. A fast, inaccurate one and a slow accurate one.

Nearly everybody uses the slow one, the fast one (which used tobe the only one) continues to be a huge embarassment to Sun.
__________________
---
>80 column hard wrapped e-mail is not a sign of intelligent
>life
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting 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 Off
Pingbacks are Off
Refbacks are Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
java or objective c? Dogcow Software Programming & Web Scripting 8 May 26th, 2002 06:16 PM
RE: 2 MacWorld Java Contradictions... TommyWillB Software Programming & Web Scripting 2 January 12th, 2002 05:55 PM
I need to learn Java Nachohat Apple News, Rumors & Discussion 42 October 8th, 2001 10:05 PM
The Java Bridge iconara Software Programming & Web Scripting 0 April 30th, 2001 05:00 AM


All times are GMT -5. The time now is 04:51 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
Copyright 2000-2010 DigitalCrowd, Inc.