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

jiminaus

macrumors 65816
Original poster
Dec 16, 2010
1,449
1
Sydney
I've gone over to the dark-side and am starting to do Android development, and with it I'm back to coding in Java.

I've just coded the following line of Java.
Code:
getLoaderManager().initLoader(0, null, this);

It made be realise just how the Objective-C style of method naming really makes code so much less enigmatic. If Android used Objective-C, the equivalent would be:
Code:
[self.loadManager startLoaderWithId:0 args:nil delegate:self];
(I have to change init to start because init implies something in Objective-C that the Java code doesn't).

I know a lot of new comers to Objective-C complain about the strange Objective-C syntax. But I hope this example highlights its advantage.
 
Objective-C method calls are nearly self-commenting. The verbosity is a good thing– unless, of course, it encourages less // commenting.

Can you compare performance? How well does the Java run compared to the same code in iOS?
 
Objective-C method calls are nearly self-commenting. The verbosity is a good thing– unless, of course, it encourages less // commenting.

That's what I keep wanting to do in my Java code. The code itself isn't documenting what these vague arguments are, so I keep wanting to document that by putting comments after each argument. Before my exposure to Objective-C, I never had this compulsion.

Can you compare performance? How well does the Java run compared to the same code in iOS?

The Objective-C code was purely hypothetical.
 
Last edited:
Thing is, like the guy in Stanford Video's says. is that they tried to make Objective C readability, as close as normal English as possible.
Which is totally correct. if you literly read the lines, it's mostly easy to read through the code as a normal book. that's what I think is ObjC > other languages. Even though in beginning it's a tad confusing.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.