Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jamdr

macrumors 6502a
Original poster
Jul 20, 2003
659
0
Bay Area
I mean how hard could it have been to maintain it? The more cocoa bridges the better, because frankly Obj-C is a really annoying language to use, mainly because of the syntax. There are Python, Ruby, AS, C#, etc. bridges but now no Java bridge? I hope a third-party takes up this cause because Java is a great language to work with.
 

HiRez

macrumors 603
Jan 6, 2004
6,265
2,629
Western US
jamdr said:
I mean how hard could it have been to maintain it? The more cocoa bridges the better, because frankly Obj-C is a really annoying language to use, mainly because of the syntax. There are Python, Ruby, AS, C#, etc. bridges but now no Java bridge? I hope a third-party takes up this cause because Java is a great language to work with.
I think if you spent more time with Objective-C, you would come to like its syntax. I know that was the case for me, as I did not initially like it, and now Java seems the clunkier of the two to me. But even though I think Objective-C is clearly the best language to use for Cocoa development, I agree with you that it's too bad Apple abandoned the Cocoa-Java bridge. They do have a history of abruptly abandoning technologies, or letting them wither on the vine for so long they become less relevant. Witness OpenDoc, Hypercard, QuickTime for Java, WebObjects, AppleWorks, KidSafe, QuickDraw3D, etc. If you really need to do Java development, I highly encourage you to give Objective-C more time to sink in. There is a point where is clicks and makes sense, and stops looking awkward to read.
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
HiRez said:
I think if you spent more time with Objective-C, you would come to like its syntax. I know that was the case for me, as I did not initially like it, and now Java seems the clunkier of the two to me. But even though I think Objective-C is clearly the best language to use for Cocoa development, I agree with you that it's too bad Apple abandoned the Cocoa-Java bridge. They do have a history of abruptly abandoning technologies, or letting them wither on the vine for so long they become less relevant. Witness OpenDoc, Hypercard, QuickTime for Java, WebObjects, AppleWorks, KidSafe, QuickDraw3D, etc. If you really need to do Java development, I highly encourage you to give Objective-C more time to sink in. There is a point where is clicks and makes sense, and stops looking awkward to read.

And once you get used to categories you'll begin to wonder who other languages don't have them! I write code in a number of languages both professionally and for fun and Java was my favourite until I learnt Obj-C/Cocoa.
 

hopejr

macrumors 6502
Nov 10, 2005
310
0
New South Wales, Australia
robbieduncan said:
And once you get used to categories you'll begin to wonder who other languages don't have them! I write code in a number of languages both professionally and for fun and Java was my favourite until I learnt Obj-C/Cocoa.
Same with me. ObjC is a nice language. I prefer it out of all the languages (~15) that I know. Yeah, categories are great! The made life easier with a project I just did. I could add more code to a class without bloating the original implementation file :D.
 

caveman_uk

Guest
Feb 17, 2003
2,390
1
Hitchin, Herts, UK
Was just wondering about categories. Is there any way to forward declare a method that's in a category but is called from the original class? I know this isn't how you normally use categories but sometimes I use them to break up the code into smaller chunks that aren't really separate classes (usually because they need access to the inner workings of the class). In this case the 'original' class may call a method in the category. This gives a warning (not the end of the world I know but I like to have no warnings) but the code works at runtime.

As to the Java bridge, how many people actually used it? Nearly everything I've ever seen said if you're using Cocoa use Objective-C don't use Java.
 

generik

macrumors 601
Aug 5, 2005
4,116
1
Minitrue
Has anyone else been noticing that you need to go through more hoops to get the latest java SDK for MacOS?
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
caveman_uk said:
Was just wondering about categories. Is there any way to forward declare a method that's in a category but is called from the original class? I know this isn't how you normally use categories but sometimes I use them to break up the code into smaller chunks that aren't really separate classes (usually because they need access to the inner workings of the class). In this case the 'original' class may call a method in the category. This gives a warning (not the end of the world I know but I like to have no warnings) but the code works at runtime.

I'm not sure. It's obviously easily possible with no cross-calls.

I think this might work:
If you declare the main class with no methods at all like
Code:
<in MyObject.h>
@interface MyObject
{
}
@end

Then you can declare
Code:
<in MyObject+External.h>
#include "MyObject.h"
@interface MyObject(External)
-(void) externalMethod
@end

<in MyObject+Internal.h>
#include "MyObject.h"
@interface MyObject(Internal)
-(void) externalMethod
@end

Then of you can do something like this (not a good idea in practice)

Code:
<in MyObject+External.m>
#include "MyObject+External.h"
#include "MyObject+Internal.h"
@implementation MyObject(External)
-(void) externalMethod
{
[self internalMethod];
}
@end

<in MyObject+Internal.m>
#include "MyObject+External.h"
#include "MyObject+Internal.h"
@implementation MyObject(Internal)
-(void) internalMethod
{
[self externalMethod];
}
@end

Note I'm not on a machine where I can test that at the moment, it's just typed straight into the reply box, so may not work and may be full of errors!
 

hopejr

macrumors 6502
Nov 10, 2005
310
0
New South Wales, Australia
caveman_uk said:
Was just wondering about categories. Is there any way to forward declare a method that's in a category but is called from the original class? I know this isn't how you normally use categories but sometimes I use them to break up the code into smaller chunks that aren't really separate classes (usually because they need access to the inner workings of the class). In this case the 'original' class may call a method in the category. This gives a warning (not the end of the world I know but I like to have no warnings) but the code works at runtime.

Yes you can. That's exactly what I did when I used the categories.
 

4409723

Suspended
Jun 22, 2001
2,221
0
generik said:
Has anyone else been noticing that you need to go through more hoops to get the latest java SDK for MacOS?
I'm having trouble with Java, my Jar files keep opening in 1.4.2 even though 5.0 is installed and I can't find anywhere to change that option. Java from the terminal still works with 1.4.2 :(
 

caveman_uk

Guest
Feb 17, 2003
2,390
1
Hitchin, Herts, UK
hopejr said:
Yes you can. That's exactly what I did when I used the categories.
How do you stop the warning messages though? robbieduncan's given a suggestion but that seems to be a bit complicated just to avoid a warning (sorry Robbie!). Is there a one liner a bit like the @class thing?
 

caveman_uk

Guest
Feb 17, 2003
2,390
1
Hitchin, Herts, UK
Got it!

Just define an empty method with the same signature as the one you need to call in the base class. The definition in the category will override it - apparently. So...no warning but your method in the category gets called.
 

devman

macrumors 65816
Apr 19, 2004
1,242
8
AU
jamdr said:
I mean how hard could it have been to maintain it? The more cocoa bridges the better, because frankly Obj-C is a really annoying language to use, mainly because of the syntax. There are Python, Ruby, AS, C#, etc. bridges but now no Java bridge? I hope a third-party takes up this cause because Java is a great language to work with.

it was a mercy killing. move on.
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
caveman_uk said:
Got it!

Just define an empty method with the same signature as the one you need to call in the base class. The definition in the category will override it - apparently. So...no warning but your method in the category gets called.

That sounds a lot simpler (and therefore better) :D
 

caveman_uk

Guest
Feb 17, 2003
2,390
1
Hitchin, Herts, UK
caveman_uk said:
Got it!

Just define an empty method with the same signature as the one you need to call in the base class. The definition in the category will override it - apparently. So...no warning but your method in the category gets called.
Actually this doesn't work. The base class calls it's own method implementation. Maybe the overridding thing works if you're calling the method from outside the class.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.