Yuck! After all these years of high level languages, having to use a mid-level language like objective-c to develop for iPhone feels like a step backwards! If only HTML5 / phonegap was more of a viable option.
I think the "feels" is your main problem. Looking at the code samples here, there's not much you could cut out in more high-level languages. In a direct comparison with e.g. MacRuby, F-Script or Objective-J, not much is gained (mostly the header files and some manual memory management). Objective-C usually looks a bit messier than it actually is. Lisp programmers don't notice parens, Objective-C programmers don't notice anything but the messages (unless they have to).
Generic GUI code always seems a bit messy. Yes, for simple apps your usual JQuery functions are small enough, but that gets messy quick enough -- it's like handling X11 events in a switch loop, easy enough when you have to react to a couple of simple events, but once you got enough going on.
Cocoa is mostly made for bigger applications. There might be some slightly easier way for mobile apps, but the gain would be minute and is really offset by having one paradigm for GUIs that stretches device classes.
I'm finding Objective-C to be a powerful addition to C and refreshingly simple compared to C++. What are you comparing it to, and what should I be missing?
You are right, compared to C++ and C ObjC has advantages. But compared to other langues it has major drawbacks. Here are some reasons I don't like Objective-C (these mostly apply to iPhone dev only)
- Header Files: These are archaic and require you to repeat code unnecessarily. Don't require humans to do something that computers are better at.
- No Automatic Garbage Collection: On the ObjC 2.0 we have this, but not on the iPhone. Unless you are making a high performance game, there is no reason the phone can't handle Automatic GC.
- No NSDictionary/NSArray literals: [[NSDictionary alloc] initWithObjectsAndKeys:@"value", @"key", @"value2", @"key2", nil]; // Enough said
- No regex: You kind of get regex's in 3.2, but they are very limited. Regex literals are much more powerful
- Xcode: You are pretty much required to use Xcode and I don't like Xcode. Even if you use the "xcodebuild" command-line script, you still have to create the project through Xcode.
- Closures: I guess we will be able to use these soon, but it is going to take awhile for all the API's to get updated to accommodate them.
- No dynamic variables: It's handy to be able to shove data into objects sometimes. It's a hack, but as long as you treat it as such you can save a lot of needless code. (You can do this via the ObjC runtime, but it's messy)
- No namespacing: ObjC handles namespaces by prefixing class names. Blah, that is so 1978.
- Unit Testing: ObjC has the poorest excuse for unit testing out of any language I've ever used.
It's not technically a language thing, but I can't get used to the unbelievable verbosity of the method names. (And for calibration purposes: I used to do a lot of Common Lisp.)
In a language inspired by Smalltalk, they turned "at:" into "objectAtIndex:"?
I mostly program in ruby, but have been working with objective-c more lately, so I can try to summarize what my thinking with a few examples:
- Why do I have to begin every string with @? I know the technical reason why, and the difference between having it and not having it, but I don’t want to type it all the time.
- Every time I type CGRectZero as an argument, I think "the method should just assume I want a CGRectZero, and if not, then I’ll tell it otherwise"
- It's distracting to my thought process to surround everything with []. That could just be a result of not spending enough time in the language
- Typing the name of every argument becomes tiresome after a while. Auto-complete does help some.
- I don’t see it in this example, but I often see cases which alloc an object, set another object to that object (usually doing some data massaging in the process), and then release the first object. In ruby, it would be a single (short) line.
I think (hope) that as I get better with the language, many of those annoyances fade away. Looking at it now, I think I could summarize it all with: The default of objective-c is to be verbose, and the default for ruby is to be terse.
edit: the "alloc, set, release" paradigm can be found in part 2, step 1.
FYI: Anything you upvote get's "saved" for you. Just click on your name, find the "saved" link, and it will show you all the things you upvoted for easy reference. =)
In addition to the note by jasonlotito on 'saved' items in HN, why not save bookmarks in your browser, in social bookmarking services like http://delicious.com, or on services like http://instapaper.com? Probably a better solution than leaving comments all over the place :)
Good question. I know the reason I don't use those services, and why I find even bookmarking to be troublesome. Please keep in mind, what follows is my perspective on things. =)
Here's the thing, there are two types of bookmarks: Daily and Archive. Daily bookmarks are things I want to visit often. I have a Tech News book marks collection, and other book marks I for Documentation, and one for work (amongst a few others). I keep them organized as best I can, and they don't get changed much. I use the browser bookmarks for that.
I also have Archive links. These are links I want to keep, but reference later. Maybe. Not sure. I want to remember them. I use Delicious to store that. But honestly, I haven't really used it for retrieval. It's also annoying. I click the bookmarklet, and it pops up a window, and takes some basic defaults, but won't just use any default tags. It's annoying clicking all those tags.
Then there is the other issue. I'll remember this article was found via HN, so I'll think HN when I think of this article. At the very least, I'll have it stored here.
Instapaper is also yet another bookmarking service I'd have to use. So, now I have bookmarks in my browser, Delicious, HN Saved, and instapaper. It's a mess.
Here is what I'd want:
* A bookmarking/archiving system that saves locally and to the cloud. I can use something like Dropbox or Live Sync to move the archive to other computers. The system really needs only save the links.
* I want to click the bookmark button and have it work. I don't want to 'install' a bookmarklet. Hook into the browser's existing functionality. An addon that adds another button is annoying as well. I have too much cruft in my chrome as it is.
* I want the service to intelligently determine what keywords to use. I want it to save the article. The entire article, pages 1 through 8 if need be.
As it is it's still easier just to trust search engines will find what I need or want. Most often, I can google my way to victory much quicker than I can find where I put the bookmark.
Anyways, these are just my thoughts on an annoyance. You might ask why I don't tackle this problem. The thing is, I just don't have any interest in doing it. So maybe someone can make this work like it should. I haven't found a solution that works like I'd want.
[* A bookmarking/archiving system that saves locally and to the cloud. I can use something like Dropbox or Live Sync to move the archive to other computers. The system really needs only save the links.]
What I currently use for this kind of stuffs (I'm on OSX) it's shovebox+dropbox.
http://www.wonderwarp.com/shovebox/
It has even an iphone client but I've never tried it.
Configuring shovebox to have his datafiles under the dropbox directory is a simple "ln -s" one time step, and then you can drop in this OSX menulet the links that can be save as bookmark or as a view of the page (available offline). It even allows to jot text note in it.
Thanks to dropbox I have my work machine and my home machine in sync.
A nice little product, it's not THE perfect solution for me, but it's the best I've found.
Xmarks or another bookmarking syncing system seems like exactly what you're looking for, minus automatic tags. All it does is take your browsers bookmarks and store them in the cloud, so no additional work is needed when you bookmark.
Xmarks also has a rather nice mobile interface as well.