Why RubyMotion


March 27, 2019
Why RubyMotion

I’ll probably get burned for this one, but it’s all my opinion, based on my experiences and observations. You may have different opinions, because you have a different career with your own experiences. That doesn’t make either of us wrong. We can agree to disagree. But I’m right. 😉

Anyway let’s get to it. Why RubyMotion for your mobile development? Why not a mainstream, officially blessed language like Swift or Objective C for iOS development? Like Java or Kotlin for Android work? Or why not Javascript with Ionic/Cordova/React Native?

Let me work my way backwards through these.

JavaScript

It has to be said… JavaScript is not a great language. It’s a popular language, but it’s weird. And not in a weird-wonderful kind of way. In a weird-wtf-are-you-doing-now kind of way. There’s a lot of JavaScript cheerleaders out there, but even they will, quietly, where not many people will hear… admit that JavaScript kinda sucks. And then there’s the whole native-not-native thing. Developing mobile apps in JavaScript is not native. Stop pretending it is. Don’t @ me. Go read some of these:

And before we move on, and just to forestall all of the “you just need to give it a chance” people… I’ve been a web developer since before 1995, using CGI scripts. I’ve used JavaScript. I don’t like it. Your mileage may vary… and that’s fine. We will have to agree to disagree, because I’m not arguing about it.

Java

Moving on… I was a Java developer for many years. Starting in the wild and crazy days of browser applets and AWT (Swing, what’s that?), it was fun. Sort of. I mean, I had a perfectly nice little biz going, selling a cross-platform GUI toolkit called WNDX, written in C, until Java came along and kicked crap out of that business. So, I joined the Java bandwagon. I’m even a Java Certified Programmer 🤪. By the end of my 8th year as a Java consultant, having progressed from applets and AWT, through Swing, servlets, Struts, EJB’s, Tomcat, WebLogic, JBoss, and ilk, I had had enough. I was so sick of programming Java (and by that I mean writing XML configuration and build files), that I was seriously considering quitting development altogether. Then… I discovered Ruby, through the magic of Rails. Sure my first few months of code written in Ruby looked a lot like Java, but programming was fun again. Convention over configuration RULES. So, me? Go back to Java…? No. Freakin’. Way.

Kotlin… I have looked at it, and played with it, but (again, my opinion here) it’s been influenced way too much by Java to make me consider it too seriously. If I had no choice but to choose between Kotlin and Java…I’d probably shrug and pick JRuby (HA!), because no one has spent time convincing me that Kotlin is a better alternative. It’s just different. And using something different just because it’s newer and not that un-sexy older language… not a good reason.

Swift

Ok, now Swift… as an officially blessed language, it’s appealing, but… I’ve been watching the train wreck of this language’s development philosophy - move fast and break things - for a little too long to find it at all appealing. Five major revisions in 5 years. ARE YOU KIDDING ME?!?! I accept that my libraries and tools will change fast. The world changes fast, and we need to adapt. But my language… I expect it to be a little more stable, or at least backwardly compatible, than Swift has demonstrated. I’ve also watched people with extensive properties (lots of apps/big apps) in Objective C attempt to make the transition to Swift, and fail, because the language keeps changing half way through the process.
So, no Swift for me either. Let me know when you grow up, Swift, and then we’ll talk.

Objective C

Objective C… before there was iPhone and iOS, there was Mac development with Objective C. I was contracted to build a PhotoShop plugin for a company in Calgary (cool stuff, check it out, Perfectly Clear by Athentech), and chose to build that plugin in Objective C and Cocoa, rather than C++ and Carbon, because I could already see the way the wind was blowing for Carbon. PhotoShop may have been built with Carbon (at that time), but Carbon was on it’s way out. So I used Objective C. Remember when I said I used work on a C-based GUI library? Yah, I still kinda like C. But Objective C… yuck. All those ‘[’ and ‘]’ and the overly wordy SDKs.

NSArray *myColors;
int i;
int count;

myColors = [NSArray arrayWithObjects: @"Red", @"Green", @"Blue", @"Yellow", nil];
count = [myColors count];

for (i = 0; i < count; i++)
        NSLog (@"Element %i = %@", i, [myColors objectAtIndex: i]);

Yuck. It’s not readable. Not even close. My old WNDX C stuff was more readable than that. IMO, as a developer of over 30 years experience, code that’s not readable is pretty much impossible to maintain. And it’s even harder to maintain/read other people’s code written in that language. I was as excited as everyone else when the iOS SDK was released. Building an iPhone app, what fun! And then, it wasn’t fun at all, because it was ObjC. And my app just sat there. Ignored. Because I couldn’t work up the enthusiasm to work on it as a side project.

✨ RubyMotion ✨

An then there was RubyMotion. Yo, it’s RUBY. Remember? The language created to make developers happy? Yah, that one.

my_colors = %w(Red Green Blue Yellow)
my_colors.each_with_index { |color, i| puts "Element #{i} = #{color}" }

When RubyMotion was released, it made me happy. Because I could do iOS development in Ruby. Sure, there was still that wordy ObjC SDK to interop with, but the RubyMotion community stepped up and reduced that pain by introducing gems like BubbleWrap (making iOS SDK’s more Ruby-like)

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setInteger:9001 forKey:@"HighScore"];
[defaults synchronize];

vs

App::Persistence['HighScore'] = 9001

and RedPotion (a collection of gems like Rails, that help you build iOS apps)

And I finally got my app built and in the App Store (WIMBY - only in Canada, eh).

Ok, I’ve confessed. Those are the reasons I chose to do RubyMotion development. Those are the reasons I choose to teach mobile development with RubyMotion. You can make another choice. But, come on, why would you? 🤘

If you, too, would like to get an app in the App Store, why not check out my 6 Pack Apps workshop?