Why I loved building Basecamp for iPhone in RubyMotion
37signals.com
37signals.com
If you want to ship a high quality iOS app, you need to understand Objective-C inside and out. If you are using RubyMotion to avoid learning Objective-C, you will ship at the the cost of massive technical debt.
If you already know Objective-C, Ruby gives you a more concise syntax. Having used both languages for a while, and now that ARC exists, I'm comfortable using Objective-C as a high level language. Objective-C is wordier than Ruby, but when I return to the code a year later, I can still understand what it does.
As much as I hate Xcode, Apple expects you are using it. Sometimes features land in Xcode a version ahead of the command line tools.
For the handful of benefits I see from RubyMotion, I see a mountain of risks. Will Apple change its policy on accepted languages? Will the translation layer blowing up when you need to ship a hot fix the day before the iTunes store shuts down for Christmas? Will someone acquire the RubyMotion team and sunset the product?
Maybe I'm a different target audience. If an industry-changing platform appeared, I wouldn't leverage what I already know to dabble in it. I would do things the idiomatic way. Even if it takes longer to ship my first app, I think it's the faster path to mastery.
RubyMotion is another layer. You can argue it is minimal. That doesn't change that it is a dependency, out of your control, and unsupported by Apple.
Let's say the RubyMotion team is acquired, and the product sunsetted. What do you do?
RubyMotion is Ruby, which is normally succinct, short, and sweet. The iOS APIs stick out like sore thumbs amongst what is normal Ruby code: camelCase usage is pervasive and reallyFreakingLongParameterNames can’t be tuned out.
When I first read the above paragraph, I was afraid this was going to be a case of someone using a great tool to enable willful ignorance, but:
> So far, I’ve ended up with staying in Objective-C style. All of the API calls you make into the various iOS frameworks need to be in that style, and seeing the different opinions of variable and method naming clashing ended up hurting my head.
I commend the author for being perceptive and pragmatic. There is also a reason why things are the way they are in iOS and Cocoa. Long Intention Revealing names document what's going on, and reduce the incidence of unwanted name collisions. It has a heritage from Smalltalk, so it's been around and developing for something like 40 years! That puts it in the same league as Lisp as a way of doing things with merit that stands the test of time.
I'm a Ruby developer, and I find Obj-C a nice language to work with (though I do prefer the s-expression style in favour of the more recent dot notation). I still haven't managed to justify using Ruby in place of Objective-C.
The only major benefit I see is the REPL that ties into the simulator, and losing the dependency on X-Code, but again, I feel that the verbosity of the APIs is the fault for that.
Recently the RubyMotion team published this yardoc that translates all of the existing APIs for you into Ruby:
http://www.rubymotion.com/developer-center/api/index.html
But I didn't refer to that for the majority of the development since it wasn't around yet...I was knee-deep in the Apple docs for most of it.
Using nil as a final argument (also called the 'sentinel') is fine for C to mark the end of a variable length array like it expects with 'strings' (so it doesn't stretch into the next unrelated block of memory), but you'd expect Ruby to handle that for you. Because in any other circumstance, it does.
For small changes, on a 2011 MBP, Xcode takes a few seconds to rebuild and deploy to the simulator. RubyMotion takes ages, easily exceeding one minute (single-core process?). Repeated a few times, it's enough to shift my thinking from play-mode to plan-mode. At this point I'm still too uncomfortable to begin new projects with RubyMotion, just because the slowness is so annoying.
However, I was somewhat disappointed to see that they use BubbleWrap persistence instead of true CoreData. I've been struggling to use CoreData without Xcode with RubyMotion for a while and haven't found a great solution yet.
I heartily recommend Core Data. It just works the way you expect it to: it's transactional, it's got undo, it fits right into the bindings system, it supports custom serialization, extensive validation, persistent objects are real ObjC objects, and so on.
You shouldn't make such assumptions when you don't fully know how to use a tool, specially when you have such large audience.
It's one of those long-running holy wars of programming that goes back way further than iOS development.
A lot of people period, don't bother to use the analyzers and instruments.
If I could choose (and wasn't working with other people) then I would go with RubyMotion. The toolkit is a lot less mature than XCode. But the productivity is definitely higher and there's much more room for improvement via the OSS community.
RubyMotion side-bonus: you don't have to merge (basically) binary files when you're working entirely with code for UI.
I can't wait to learn more, and it's wonderful being able to develop in Sublime, use RubyGems, Git, etc.
http://nshipster.com/nil/ (wat)
http://ashfurrow.com/blog/seven-deadly-sins-of-modern-object... (6/7 of these don't apply...testing is something I need to work on though!)
I was convinced the moment I checked out https://github.com/HipByte/RubyMotionSamples and just started typing 'rake' in each directory not ever having to setup directory paths for xcode project settings.
https://developer.apple.com/library/mac/#documentation/Darwi...
Perhaps other iOS developers can weigh in on this, but I feel like it's fair to say that the most qualified developers do everything programmatically.
I've been doing everything exclusively programmatically since I've started, and I've never had any problems with XCode - to the point where I was surprised when I heard people complain about it for the first time.
From that point, the only downside I see to using Objective-C over Ruby is verbosity, but that seems pretty inconsequential given some of the benefits sandofsky mentioned above.
It's nice that there's something out there for experienced Ruby developers though.
This doesn't scale when doing projects where the UI tends to be redesigned every few days.
In a few hours it is possible to design UIs that some require days to do it.
No, not at all. Especially in iOS.
It's really variable. XIBs have issues with source control, but they can be very useful for bringing in assets without needing a load of boiler-plate image loading code. iPhoto, for example, is laid out programatically but most of the controls are coming in from XIBs.
Using XIBs is also great for universal apps. I can instantiate the same controller with one XIB on iPad and another XIB on iPhone, and the layouts can be tailored to the platforms. It's wonderful when a client comes to you asking for an iPad version of their app, and you can duplicate the XIBs, scale them up, resize controls and swap out assets and go home early.
One thing that does suck about XIBs is that they ALWAYS cause merge conflicts. That part sucks and really needs to be addressed (at this point, Apple would probably have to write a diff tool for XIBs!)
Discount for students/academics.
Open source is cool, but developers need to buy food.
Rubymotion won't hide the Objective-C API anyway, so people have still to learn and understand all of the Objective-C libs. There's no single reason to use Rubymotion. This paired with the all the typical fanboyism around Ruby, Rails, 37Signals is kind of annoying. Sorry to be harsh, but I don't care how a client for an aged app (Basecamp) is built with a cumbersome layer of abstraction.
I went the JS route with Titatium Appcelerator for our iPad app, but I've followed RubyMotion since it appeared and always wanted to give it a try.
I love ruby, but is that the only business case for rubymotion?
Ruby and Objective-C definitely aren't that similar internally - as someone else has suggested, there's no technical reason you couldn't do something similar for Python. It just happens that Ruby to Cocoa bindings have been around for a while (for some time with Apple support), and as a result there has been generally more interest in carrying it forward.
I've probably failed to adequately explain how it works, but the MacRuby source is available on GitHub, and Laurent Sansonetti has done a run through how RubyMotion does it's thing here: http://rubysource.com/laurent-sansonetti-on-rubymotion-inter...
If you're an OS X user you can check out PyObjC: http://pythonhosted.org/pyobjc/