tag:blogger.com,1999:blog-6864853053396532264.post4032276122888684821..comments2024-01-25T06:36:43.336-07:00Comments on Osmorphis: Java on the iPhone?JEShttp://www.blogger.com/profile/05678402081101110580noreply@blogger.comBlogger11125tag:blogger.com,1999:blog-6864853053396532264.post-36908541543725485182012-05-04T12:34:46.221-06:002012-05-04T12:34:46.221-06:00you raised very good issues. seems you have someth...you raised very good issues. seems you have something great in your mind, just hit that. java on iphone is a great thing to doAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-6864853053396532264.post-70735093678180907492009-08-03T13:58:02.855-06:002009-08-03T13:58:02.855-06:00True, but who creates a dictionary and places only...True, but who creates a dictionary and places only one element in it? The code snippet simply demonstrates the verbosity of typical operations.JEShttps://www.blogger.com/profile/05678402081101110580noreply@blogger.comtag:blogger.com,1999:blog-6864853053396532264.post-47635194776832723522009-08-03T12:19:57.533-06:002009-08-03T12:19:57.533-06:00Your three lines can be easily replaced with one:
...Your three lines can be easily replaced with one:<br /><br />NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObject:@"data" forKey:@"key"];<br /><br />Unless you are planning on inserting a large (known) number of objects into the dictionary, there's no need to use "initWithCapacity" at all.<br /><br />You can also create an empty dictionary simply with:<br /><br />NSMutableDictionary *dict = [NSMutableDictionary dictionary];<br /><br />and add items as needed. Note both of these methods return autoreleased objects.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6864853053396532264.post-57163069215121240702009-06-29T08:12:19.274-06:002009-06-29T08:12:19.274-06:00oh, and I would use the java-to-xcode pre-compiler...oh, and I would use the java-to-xcode pre-compiler in a heartbeat, regardless of the debugging challenges.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6864853053396532264.post-90243739986639143472009-06-29T08:11:15.798-06:002009-06-29T08:11:15.798-06:00I think apple will have to re-evaluate it's Ob...I think apple will have to re-evaluate it's ObjC sour grapes offering as android (and other java dev enabled phones) becomes a stronger contender in the market place. It's plain stupid not to offer developers a common alternative now.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6864853053396532264.post-28655588697027679992009-06-17T10:16:25.958-06:002009-06-17T10:16:25.958-06:00@Pierre: Thanks for the comments. I think it reall...@Pierre: Thanks for the comments. I think it really boils down to ascetics. I have been programming in Obj-C for 8 months and it still hasn't found a place in my heart. I tolerate only because Xcode adds many nice features for using the language. Without Xcode, Obj-C programming would be a tedious endeavor.<br /><br />Certainly there will people who love Obj-C and some who hate it. You can't please everyone, which is why I think it is rather short-sighted for Apple to expect everyone to program in one language. I wish there were more options.JEShttps://www.blogger.com/profile/05678402081101110580noreply@blogger.comtag:blogger.com,1999:blog-6864853053396532264.post-53936715303605700852009-06-16T17:29:21.744-06:002009-06-16T17:29:21.744-06:001) Objective-C has pointers because it's mean...1) Objective-C has pointers because it's meant to be used to develop native apps that often need to manage the memory in a more efficient way than a garbage collector. Java doesn't have that problem: it's GC all the way.<br /><br />2) Yes, the [object method] syntax is a bit weird at first but it has its advantages too: you can select the entire block between the brackets with a simple key-command (traditionally cmd-B) and copy it somewhere else. Besides, is it really more whacked than object->method() which contains 4 special characters instead of 2 for [object method]?<br /><br />3) Semi-colons allow you to split an instruction over several lines.<br /><br />4) Naming arguments is the first thing that makes C++ programmers (and apparently Java programmers too) develop an indigestion because they find Obj-C so verbose. I felt the same at first, but after working a few weeks on a large code-base that you aren't familiar with, trust me, you will learn to loooove this syntax and wonder why it has not been adopted in other languages.<br /><br />5) If you have a comma between arguments, do you also want one between the object and the method? The result would look like [object, method] or [object, method:param1, name2:param2]. Now, that's really verbose. It's best to learn to separate the arguments in a visually pleasant way, over several lines if necessary.<br /><br />6) Obj-C is often used in conjunction with C or C++ (source code, libraries, frameworks) and, of course, it is very useful to preserve the same syntax for static strings.<br /><br />Overall I think your irritation with the language comes from a lack of familiarity with it. I worked on very large code-bases in C++ and Obj-C. In my opinion, both have their benefits but when you are developing in the higher levels of the app, you quickly learn to appreciate Obj-C. It fits much better into the paradigm of "write once, read many".Pierrehttp://www.photobiker.comnoreply@blogger.comtag:blogger.com,1999:blog-6864853053396532264.post-53168889664966075022009-06-10T20:44:02.183-06:002009-06-10T20:44:02.183-06:00Hm, PhoneGap looks interesting, but it's not m...Hm, PhoneGap looks interesting, but it's not my cup of tea. Thanks for the reference, though.JEShttps://www.blogger.com/profile/05678402081101110580noreply@blogger.comtag:blogger.com,1999:blog-6864853053396532264.post-69013198061438283322009-06-10T14:07:04.957-06:002009-06-10T14:07:04.957-06:00I realise that it is not exactly what you are aimi...I realise that it is not exactly what you are aiming for, but an alternative way of writing apps in Java for the iPhone is GWT + PhoneGap.davidroehttps://www.blogger.com/profile/06733836519005917356noreply@blogger.comtag:blogger.com,1999:blog-6864853053396532264.post-83949657008555450442009-06-10T04:54:05.329-06:002009-06-10T04:54:05.329-06:00I am a former Java coder myself, but I stopped upg...I am a former Java coder myself, but I stopped upgrading after the introduction of the typing system; up to 1.2 Java syntax was really neat.<br /><br />In my view, Objective-C isn't nearly as bad. True, some things need getting used to, but I actually prefer the square brackets to the dot notation for method calls. You lose a lot of round brackets as compensation. As for some of the syntax: it's a superset of C, hence the @"" for NSString constants. You can always do better when starting fresh without having to care for backwards compatibility. That's one reason why Java's syntax is now so bloated...<br /><br />The only thing that really gets me about Objective-C are the header files, really. I thought Java showed that we can do without them, and they're a pain.<br /><br />One solution might be to write your own run-time virtual machine (in Objective-C), and then use your own scripting language. Surely Apple can't object to that?Oliver Masonhttps://www.blogger.com/profile/15470911924018335990noreply@blogger.comtag:blogger.com,1999:blog-6864853053396532264.post-18318238991473583592009-06-10T00:10:57.111-06:002009-06-10T00:10:57.111-06:00i think it's futile - you hit on the debugging...i think it's futile - you hit on the debugging issue, which i think is a deal breaker. also xcode will helpfully fill in all the parameters on long method names, and it will tell you what the possible completions are so you can know ahead of time if the method you're looking for even exists.<br /><br />i really don't find objective-c as bad as you make it out. the java code looks only ever so slightly better. not a big enough improvement to warrant all the steps backward you'll be taking.<br /><br />good luck with it!jsdhttps://www.blogger.com/profile/03199457169038528948noreply@blogger.com