User Name
Password
AppleNova Forums » Programmer's Nook »

Objective-C vs. Java


Register Members List Calendar Search FAQ Posting Guidelines
Objective-C vs. Java
Page 1 of 2 [1] 2  Next Thread Tools
ezkcdude
Veteran Member
 
Join Date: Jan 2005
 
2005-11-15, 18:19

What are the pros and cons of developing with either of these on the Mac? It seems to me that unless there is a huge performance hit, Java serves as the cross-platform lingua franca these days. I'm just wondering for those of us who don't work for Apple or write Mac OS X specific applications, especially with the looming Intel change, are there any reasons for Cocoa programming or learning Objective-C? Comments appreciated.
  quote
byzantium
Member
 
Join Date: Nov 2004
Location: Planet Earth
 
2005-11-15, 18:52

I think your question needs to be a bit more specific .. but here goes with an answer:

Well the first thing is that you can't develop Cocoa applications with Java - it's been officially dropped as a supported language.

Cocoa is a set of frameworks (and related tools such as Interface builder) that can let you build applications rapidly. Technologies like Core Data are based on advanced technologies like EOF; Java has similar equivalents like Hibernate; but it's not part of the J2SE specification.

Building native-appearance apps with Java isn't that easy. If you need to build desktop applications fast for the Mac; and you want a first-class citizen native interface as well as access to OS X technologies (Quicktime, Core Image, Core Data, Spotlight), then you really have little choice but to use Cocoa.

Java (IMO) is better suited for server side applications (like web application servers) then for desktop apps.

Yonah was the biblical prophet who got swallowed by a whale. Great name Intel!
  quote
chucker
 
Join Date: May 2004
Location: near Bremen, Germany
Send a message via ICQ to chucker Send a message via AIM to chucker Send a message via MSN to chucker Send a message via Yahoo to chucker Send a message via Skype™ to chucker 
2005-11-15, 20:21

The verdict is rather simple really, with over 2 million results for Java sucks and only about 32,000 for Objective-C sucks. IOW, the difference is: they both suck, but one less so.

SCNR.
  quote
Brad
Selfish Heathen
 
Join Date: May 2004
Location: Zone of Pain
 
2005-11-15, 20:27

SCNR?

Of course, the fact that practically no one outside of Mac OS X developers uses Objective-C would taint your results, chucker.

Quote:
Originally Posted by ezkcdude
the looming Intel change
...will have no effect on Objective-C. Unless you are writing low-level code that is dependent on byte order, you won't be in any way affected by this transition.

The biggest advantage for Java is it runs (generally) anywhere.
The second biggest advantage for Java is that is has a HUGE library of existing classes.
The biggest disadvantage for Java is that it's slow.
The second biggest disadvantage for Java is that it's more difficult to manipulate memory directly.

I don't have enough experience with Objective-C to make a judgement call there.

The quality of this board depends on the quality of the posts. The only way to guarantee thoughtful, informative discussion is to write thoughtful, informative posts. AppleNova is not a real-time chat forum. You have time to compose messages and edit them before and after posting.
  quote
Wyatt
Veteran Member
 
Join Date: Mar 2005
Location: Near Indianapolis
 
2005-11-15, 20:30

Quote:
Originally Posted by Brad
SCNR?
Come on, Brad! Google is your friend.

SCNR = Sorry, Could Not Resist
  quote
Brad
Selfish Heathen
 
Join Date: May 2004
Location: Zone of Pain
 
2005-11-15, 20:36

Yeah, I Googled it, but I was hoping someone would have some more witty response to it. Something like:

Stressed Crabs Never Rest
Strange Communists Nuked Russia
See? Can't Negotiate with a Republican
Stupid, Crazy, Nonsensical, and Ridiculous
Slap Children, Not Royalty
Something Cold Nudged my Rib

The quality of this board depends on the quality of the posts. The only way to guarantee thoughtful, informative discussion is to write thoughtful, informative posts. AppleNova is not a real-time chat forum. You have time to compose messages and edit them before and after posting.
  quote
chucker
 
Join Date: May 2004
Location: near Bremen, Germany
Send a message via ICQ to chucker Send a message via AIM to chucker Send a message via MSN to chucker Send a message via Yahoo to chucker Send a message via Skype™ to chucker 
2005-11-15, 20:39

Quote:
Originally Posted by Brad
Of course, the fact that practically no one outside of Mac OS X developers uses Objective-C would taint your results, chucker.
I was, as the "SCNR" and the wink smilie after that should suggest, not being serious at all. Obviously, both Objective-C and Java have their legitimations to exist.

Quote:
The biggest advantage for Java is it runs (generally) anywhere.
The second biggest advantage for Java is that is has a HUGE library of existing classes.
The biggest disadvantage for Java is that it's slow.
The second biggest disadvantage for Java is that it's more difficult to manipulate memory directly.
Yup. Although on the fourth one, it could be argued that it's an advantage. I.e., developers don't have to worry about memory as much as they do with C derivatives.
  quote
Kickaha
Veteran Member
 
Join Date: May 2004
 
2005-11-15, 20:52

Quote:
Originally Posted by chucker
The verdict is rather simple really, with over 2 million results for Java sucks and only about 32,000 for Objective-C sucks. IOW, the difference is: they both suck, but one less so.

SCNR.
And 514,000 for C++ sucks.

Obviously, Obj-C is teh w1n!

Huh, I really would have that it would be much higher for C++. *shrug*

The issue with Obj-C outside of the Mac isn't the language - gcc has native support for Obj-C by default in the normal distros. It's that *Cocoa* is what people use, Obj-C is just sort of a byproduct of that decision, and Cocoa isn't anywhere else. GNUStep is getting there, but it's still kind of primitive in many ways. Okay, a lot of ways. (But at only 15k hits for 'gnustep sucks', apparently it's better than even Obj-C. )

But, all that being said, Obj-C is up there with Smalltalk in my personal shrine to programming languages.
  quote
ezkcdude
Veteran Member
 
Join Date: Jan 2005
 
2005-11-15, 21:44

To sum up, it would seem that it's only useful to learn Objective-C if you're going to use Cocoa and write OS X-only applications. If anyone else has a different opinion, speak now or forever hold your piece (sic).
  quote
Kickaha
Veteran Member
 
Join Date: May 2004
 
2005-11-15, 21:46

Or unless you want to learn how to grok OO really well. Only Smalltalk is really better for that. C++? Pah. Bastard child. Java? Feh. Developmentally slow child. Go for the gold standard, learn Smalltalk... or, if you want to actually do something fun with it, learn Obj-C.

Remember, languages come and go, but the basic principles are forever.

Well, except FORTRAN. We're still dealing with that albatross.
  quote
chucker
 
Join Date: May 2004
Location: near Bremen, Germany
Send a message via ICQ to chucker Send a message via AIM to chucker Send a message via MSN to chucker Send a message via Yahoo to chucker Send a message via Skype™ to chucker 
2005-11-15, 22:22

Well, there's various bindings to write Cocoa code, such as RubyCocoa.
  quote
Kickaha
Veteran Member
 
Join Date: May 2004
 
2005-11-15, 22:35

Indeed, and the Python-Cocoa binding, PyCocoa, is *great*.

I <3 Python.
  quote
Wickers
is not a kind of basket
 
Join Date: May 2004
 
2005-11-15, 22:38

Quote:
Originally Posted by Dr. Kickaha

I <3 Python.


  quote
ShadowOfGed
Travels via TARDIS
 
Join Date: Aug 2005
Location: Earthsea
 
2005-11-15, 23:54

Quote:
Originally Posted by Brad
The second biggest advantage for Java is that is has a HUGE library of existing classes.
I really beg to differ here. The Java class library, if you want my opinion (I know you didn't ask ), is a huge mess. There is a lot of redundant functionality it seems, with ClassNamesThatAreAboutFifteenThousandMilesLong. Not to mention there's not always true "backwards compatibility" between major revisions of Java, which seems to defeat the purpose of Java having a stable class library anyway.

And a lot of the buzzword technologies that surround Java? Also seems like a huge mess. I test J2EE apps that run on WebSphere. It drives me absolutely nuts. Maybe I'm a tad biased, but still...

I like these other languages because they don't force an enormous set of libraries on anyone; a given user has only the libraries s/he needs. Particularly Python and Ruby I find interesting because they're two of the other truly Object-oriented languages (where everything is an Object, versus C++ where that's not always true).

Thus my anti-Java bias makes me vote for Objective-C.

Apparently I call the cops when I see people litter.
  quote
AsLan^
Not a tame lion...
 
Join Date: May 2004
Location: Narnia
 
2005-11-16, 00:31

I use java for writing programs and I enjoy it.

I like the wealth of help available for java and I like the java API after you learn to navigate the spec, it is ridiculously easy to find a class that does what you want it to and a sometimes tutorial to go with it.

I don't have any problem with the speed of java. Little slowdowns here and there can be sorted out by refining your code.

I havn't tried Objective C yet, but I will someday. It just seems like a waste to me, to write a program that can only work on one platform. If I write a program with C or java, it can at least be compiled on another OS or architechure, with possibly a little debugging. If I write a cocoa program, well it's mac only, and the code will not be reusable.

I can see using Objective C / Cocoa for apps that depend on a technology only present in OS X. But for an app that doesn't access any technologies integrated into the operating system, IMHO, java is a better choice.
  quote
Kickaha
Veteran Member
 
Join Date: May 2004
 
2005-11-16, 00:45

Quote:
Originally Posted by AsLan^
But for an app that doesn't access any technologies integrated into the operating system, IMHO, java is a better choice.

If your app doesn't access any technologies in the OS, then you're free to use ANY language, not just language du jour. In that case, why not use the language that is nicest?

Seriously, think about your argument... if you're writing for the Mac, then you're using the OS. If you're writing to Windows, then you're using the OS. If you're writing to KDE or Gnome, then you're using 'the OS'. The only time you *WON'T* be using technologies provided for you, is when you write everything from scratch yourself, in which case you have complete freedom to choose the language. In such cases, going with the herd is about the dumbest thing you could do.

Now what I *think* you meant to say was something along the lines of "If your app isn't using any SPECIFIC technologies that are wedded to THAT platform, then use a cross-platform set of libraries." The languages are all cross-platform - Obj-C compiles just spiffy on any machine gcc installs on, as does C, C++ or Java.
  quote
AsLan^
Not a tame lion...
 
Join Date: May 2004
Location: Narnia
 
2005-11-16, 00:56

Quote:
Originally Posted by Dr. Kickaha
Now what I *think* you meant to say was something along the lines of "If your app isn't using any SPECIFIC technologies that are wedded to THAT platform, then use a cross-platform set of libraries." The languages are all cross-platform - Obj-C compiles just spiffy on any machine gcc installs on, as does C, C++ or Java.
I guess that's something like what I meant to say...

As for Obj-C, isn't cocoa the only decent API? I saw the screenshots from Gnustep, and I dont think it's quite there yet.
  quote
Kickaha
Veteran Member
 
Join Date: May 2004
 
2005-11-16, 01:11

Pretty much, yeah. If you're going to use Obj-C, Cocoa is heads and shoulders above anything else... then again, I happen to think it's heads and shoulders above most other solutions for any language.

You have to consider though, that most custom apps are written in a very crude way, and that the cost effectiveness of buying more hardware to make the code development (and above all MAINTENANCE) more efficient is a no-brainer... but one that people seem to balk at.

Silly people.
  quote
ezkcdude
Veteran Member
 
Join Date: Jan 2005
 
2005-11-16, 01:11

Quote:
Originally Posted by Dr. Kickaha
The languages are all cross-platform - Obj-C compiles just spiffy on any machine gcc installs on, as does C, C++ or Java.

True, the gcc compiler could be used to create "cross-platform" programs, but it is not optimized for each platform. For example, if you want to make the fastest C program on an Intel processor, you wouldn't use the gcc compiler, you'd use Borland or Visual C++.


Quote:
Originally Posted by Dr. Kickaha
If your app doesn't access any technologies in the OS, then you're free to use ANY language, not just language du jour. In that case, why not use the language that is nicest?
This is not practical real-world advice. While it might be a nice academic exercise to use your preferred language, in most corporations, you write code in the language that is "du jour".
  quote
Kickaha
Veteran Member
 
Join Date: May 2004
 
2005-11-16, 01:12

Which is, I'm sorry, idiotic. You use the language that's best suited for the task, or you're just wasting your company's money.

It's not an academic exercise, it's how the real world works once you get past the Java=kewl level. Get some experience in industry, and you'll find that there are the most *bizarre* languages out there, finely tuned for particular needs.

Quick, what's the language that still has the most functioning and currently maintained lines of code?
  quote
ezkcdude
Veteran Member
 
Join Date: Jan 2005
 
2005-11-16, 01:23

Cobol?
  quote
AsLan^
Not a tame lion...
 
Join Date: May 2004
Location: Narnia
 
2005-11-16, 01:24

Quote:
Originally Posted by Dr. Kickaha
It's not an academic exercise, it's how the real world works once you get past the Java=kewl level.
This is my one problem with java, the attitude against java programmers !

It's like we are second class citizens of geekdom...
  quote
Kickaha
Veteran Member
 
Join Date: May 2004
 
2005-11-16, 01:31

Quote:
Originally Posted by AsLan^
This is my one problem with java, the attitude against java programmers !

It's like we are second class citizens of geekdom...
Sorry, wasn't meant as a slam against you or ezkcdude, what I meant to say was that once you get past a certain "C++ or Java" mentality, you realize that there are literally hundreds of languages out there, most of which have been designed to solve *specific* problems, where the general classes of languages simply don't work well. It's just something that takes exposure over time.

And yes, it's COBOL. Latest estimate I saw had over 70 *BILLION* lines of code. C is second, C++ or Java distantly behind. I think FORTRAN still has the edge over Java, actually.

The point is that there are a lot more languages out there that you need to consider to do your company and your project justice. Many times, C++, Java, C# etc, will be just fine - but you have to know when to break free of the herd.

Heck, want to know what company ruled the Fortune 100 custom-app roost from 1988-1996? NeXT. Companies bought closed proprietary hardware at several times the cost of x86 boxes for their own internal custom apps. Why? Because the development and maintenance costs were orders of magnitude lower. Custom apps, not commercial shrink-wrap apps, still comprise the vast majority of the software systems in existence.

Fun Fact: Guess how much of the total cost of the average software system's total cost, from idea to termination of the project, is spent getting 1.0 out the door? Think of all the blood, sweat and tears that go into getting a product shipped for the first time.

Try 15%.

85% of the total cost is just maintenance. Anything you can do to help alleviate that will *swamp* the cost buying new computers or even training folks on a new language or library, if those solutions are that much better. And at 85%, you don't have to be *vastly* better, just incrementally.

If you want to make yourself employable, learn programming language theory, not programming languages. You'll be able to jump from solution to solution effortlessly, and learn a new language in a few hours. My first Python app, after spending about a day learning the ropes, is now about 55,000 lines. Same design, same architecture, same basic algorithms.

Last edited by Kickaha : 2005-11-16 at 01:39.
  quote
chucker
 
Join Date: May 2004
Location: near Bremen, Germany
Send a message via ICQ to chucker Send a message via AIM to chucker Send a message via MSN to chucker Send a message via Yahoo to chucker Send a message via Skype™ to chucker 
2005-11-16, 01:55

Quote:
Originally Posted by ezkcdude
True, the gcc compiler could be used to create "cross-platform" programs, but it is not optimized for each platform. For example, if you want to make the fastest C program on an Intel processor, you wouldn't use the gcc compiler, you'd use Borland or Visual C++.
Or icc, for that matter.
  quote
AsLan^
Not a tame lion...
 
Join Date: May 2004
Location: Narnia
 
2005-11-16, 01:56

You are of course correct, programming theory will get you a lot further than knowledge of a specific language.

But the thread is "Objective-C vs. Java" so I was arguing my case for java.

Although I took offense to your comment, don't worry about it, I'm over it that being said, I often see derogatory comments online about java programmers, perhaps it's because many "java programmers" are new to the fold and their code is poorly written (from a lack of experience no doubt) which is further exacerbated by the JVM which historically has had poor performance.

I'm not sure if you've read this article or not but it was on slashdot a few weeks ago, it's about the industry wide dumbing down of programmers. I enjoyed the article.

Does Visual Studio rot the mind ?
  quote
Kickaha
Veteran Member
 
Join Date: May 2004
 
2005-11-16, 02:11

*twitch* Oh dear god, I'm with the author, IntelliSense is evil incarnate.

Unit testing? Forget it. You can't write the test before the code.

He's absolutely right, it enforces a particular way of coding, and worse, of *thinking*... in the small. Tiny little details instead of the larger issues and concepts, the *abstractions* you *should* be thinking about. Maybe Windows will finally collapse under its own stupidity now.

To be honest, I think the smackdowns against Java programmers you see are mostly because new programmers run across Java and think it's the KEWLEST TH!NG EVAH and the proceed to try and convert everyone else... when the rest of us have been there, done that, and moved on already. (You have no idea how tired I got of pointing out to zealots of the bytecode system that they were just UCSD P-codes resurrected. Those were in, um, 1974? Not. New.)

Java is a good little language. I like the language, for the most part, even though I think they made some bad decisions here and there. Or, at least, questionable ones. I'm not overly fond of the libraries, since they were modeled after NeXTstep, but didn't have the advantage of a richly dynamic underlying language, so some *ahem* compromises were made. Overall though, the libraries are livable. The *BYTECODES* however... Gosling & Co should be strung up, shot, drawn and quartered, buggered fatally by camels, and boiled in greasy geek hair oil for those. They should have stuck with the original vision for those: toasters. (No, I'm not kidding. Look up Project Oak sometime.)
  quote
Unch
Member
 
Join Date: Jun 2005
Location: United Chavdom of Little Britain
 
2005-11-16, 05:20

I found Obj-C's syntax to be rather confusing compared to Java's. But that might be because I went from C -> a little C++ -> Java.

Dr. Kickaha, please could you pass on your views about Unit testing to my Lecturers? I'm fed up of this stupid buzzword filled eXtreme Programming crap :-(

And before I forget...

10 PRINT "BASIC is teh r00lz!!!"
20 GOTO 10

"It's like a new pair of underwear. At first it's constrictive, but after a while it becomes a part of you."
  quote
ezkcdude
Veteran Member
 
Join Date: Jan 2005
 
2005-11-16, 09:25

One question nobody has really answered is how do Obj-C and Java compare in performance on the Mac? On PC's Java used to be much slower than C, for example, but now the performance difference is not that great (~5-10% I have heard). Is it more than that on OS X?
  quote
Kickaha
Veteran Member
 
Join Date: May 2004
 
2005-11-16, 09:54

Quote:
Originally Posted by Unch
I found Obj-C's syntax to be rather confusing compared to Java's. But that might be because I went from C -> a little C++ -> Java.
It's modeled after Smalltalk, where you have the idea of 'message passing' instead of 'function calling'. If you think about it, having the two have difference syntaxes in Obj-C means that you *ALWAYS* know, at a glance, whether you're dealing with an actual object, or a struct/union from C. Not so in C++, where the hoops they have to jump through to perform correct parsing is much harder not only for the human, but for the compiler. If you have to have a mixed OO/procedural model, IMO it's best to have them distinct ala Obj-C.

But it is quite a bit different looking to the novice.

Quote:
Dr. Kickaha, please could you pass on your views about Unit testing to my Lecturers? I'm fed up of this stupid buzzword filled eXtreme Programming crap :-(
You misunderstood me... IntelliSense *prevents* you from doing unit testing, and that's a bad thing. Unit testing is a *GREAT* thing in many cases, and an important tool in your toolbox.

Like any tool though, it can be overused, and you'll see folks touting them as the latest silver bullet.

Quote:
And before I forget...

10 PRINT "BASIC is teh r00lz!!!"
20 GOTO 10
Naw.

10 POKE(RND(255) * 16384, RND(254) * 255)
20 GOTO 10

  quote
bassplayinMacFiend
Banging the Bottom End
 
Join Date: Jun 2004
 
2005-11-16, 11:11

Quote:
Originally Posted by Dr. Kickaha
Naw.

10 POKE(RND(255) * 16384, RND(254) * 255)
20 GOTO 10

Ahhh, reminds me of the good ole days of typing in pages of code from the latest Antic, Compute! or Byte magazine. Of course, BASIC was dog slow so you'd type in code that looked something like:

10 FOR X = 16384 TO 32768
20 POKE (X, DATA)
30 NEXT X
40 DATA 234, 120, 149, 123, 362, ...
50 DATA ...

and on and on, basically POKEing an ASM program into memory, then passing control to location 16384. Talk about debugging fun too!
  quote
Posting Rules Navigation
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Page 1 of 2 [1] 2  Next

Post Reply

Forum Jump
Thread Tools
Similar Threads
Thread Thread Starter Forum Replies Last Post
Java is messed up! Mommy8me Genius Bar 0 2005-11-11 10:42
Java Applets not Loading pmazer Genius Bar 2 2005-09-27 12:42
iBook or PB for Java Development bearclaw79 Purchasing Advice 7 2005-09-20 21:25
Get your Java updates! Only 45 mb. Quagmire Apple Products 31 2005-09-15 19:46
Java 1.5 - finally ghoti Apple Products 1 2005-05-08 08:20


« Previous Thread | Next Thread »

All times are GMT -5. The time now is 11:33.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004 - 2024, AppleNova