

Ask HN: Getting into OS X/iOS development as a Rubyist: learn macruby first? - jmonegro

I want to get into OS X/iOS development. I'm a rubyist.<p>Learning MacRuby would be easier for me, but I think I would inevitably transition to Objective-C as I reach its limitations (maybe some advanced stuff, libs, and iOS development).<p>But, Objective-C/Cocoa from scratch would be much harder for me to get into.<p>Is there any benefit in learning MacRuby first as a way of conditioning my brain into how Apple development works, or should I dive straight into Objective-C/Cocoa?<p>This is the learning path I have envisioned:<p>- Learn MacRuby (books, screencasts, ...)
- Learn Objective-C
- Learn Cocoa
- Learn Cocoa Touch<p>Is MacRuby a good stepping stone or should I skip it?
======
ddagradi
For iOS, MacRuby is unfortunately not an option, as it would require garbage
collection. However, for writing OS X software, MacRuby works great (we just
shipped an app with it in the App Store - <http://briquetteapp.com> \- and it
has definitely been a joy to work with).

Unfortunately, it doesn't really make the learning curve any less intense.
While Objective-C's syntax and style are somewhat difficult, the real
challenge to Mac/iOS programming is having a working knowledge of the Cocoa
API. MacRuby simply acts as a bridge between Ruby and Cocoa, meaning you need
to know exactly the same amount about API methods no matter the programming
language you choose.

Reading the currently available MacRuby book is a great idea -
<http://ofps.oreilly.com/titles/9781449380373/>. If you find yourself confused
by the concepts, you should try learning Objective-C and Cocoa first (I
learned with [http://www.amazon.com/Cocoa-Programming-Mac-
OS-3rd/dp/032150...](http://www.amazon.com/Cocoa-Programming-Mac-
OS-3rd/dp/0321503619/ref=sr_1_1?ie=UTF8&qid=1306096811&sr=8-1)). It is
certainly possible to dive in with MacRuby! Just remember that it's not 1.0
yet, and could present technical difficulties in unexpected ways. Otherwise,
it's super fun!

~~~
jmonegro
Thanks for your response! Briquette looks great :)

All things considered, it seems like MacRuby might make it's way onto iOS in
the future (<http://iflipbits.com/post/1101983568/macruby-soon-on-ios>,
although that's 8 months old, so I'm not really counting on it for now).

Yes, I figured that out after researching enough about obj-c, cocoa, and
macruby. That's why I wondered if learning MacRuby first would ease me into
the process by taking away a layer of difficulty (obj-c). Then after I get the
hang of it, I could transition to objective-c, maybe through one of PeepCode's
screencasts, "Objective-C for Rubyists".

~~~
ddagradi
It's definitely possible to start with MacRuby. It just requires a little more
overhead to translate Cocoa documentation into methods that work with MacRuby
(not to mention the occasional one that doesn't work right...).

As a Rubyist, there's definitely some differences (named parameters, for
instance), but you get the hang of it pretty quick. As a Cocoa developer,
debugging with MacRuby has issues, as Xcode doesn't always know about the
right symbols since it's not compiled (but this is getting better!).

Use the MacRuby book, and learn to love Xcode's documentation, and you should
be good to go. If you do have issues, email the macruby-devel mailing list or
visit #macruby - the community is super friendly and happy to help!

re iOS: I'm really hoping. With MacRuby shipping by default with Lion, iOS 5
will hopefully follow suit this summer.

~~~
jmonegro
With what you know, would you recommend I skip MacRuby and jump straight into
obj-c/cocoa?

~~~
ddagradi
I would. MacRuby adds to the experience once you already know what you're
doing. As an introduction to Cocoa, it adds a lot of difficulty too.

------
brandoncordell
I didn't bother using MacRuby as a stepping stone to Objective-C. Instead I
learned C first. I had no experience with compiled languages so I figured it
would be my best bet and I definitely think it helped a lot.

It's a little hard to get past Objective-C's syntax at first but after it all
begins to click it's not so bad. I think learning the Cocoa API would prove
the more difficult step in your learning path.

------
runjake
If your objective is to write Mac OS X/iOS apps, move directly to Objective C.

As others have mentioned, there is no MacRuby for iOS, and the MacRuby for Mac
OS X is fantastic, but a lot less capable than Objective C, still.

No slam to MacRuby though, as I suspect they'll be a tier 1 Mac development
platform in the next 5 years.

------
hmottestad
I don't think you have much of an alternative if you want to make good
software for iOS. As for programming for OS X, cocoa has bindings for ruby, so
that shouldn't be a problem.
<https://secure.wikimedia.org/wikipedia/en/wiki/RubyCocoa>

~~~
jmonegro
Indeed. Even though I know I'll eventually transition to Objective-C, I was
wondering if learning MacRuby first would tender down the learning curve by
easing me into how Apple development works by leveraging my existing
knowledge.

What do you think?

~~~
hmottestad
I would just go for objective-c. MacRuby is in version 0.1 and might be more
of a headache to figure out and circumvent bugs and holes then just learning
objective-c. It's not a very difficult language and easy enough if you have
tried C or Java before. You'll also need to handle memory (allocation and
deallocation), but you could try to rely on GC, but not for iOS. Lynda.com has
a video tutorial on objective-c and also tutorials on iOS programming.

~~~
lrz
MacRuby was version 0.1 about 3 years ago. A lot happened since, and we expect
the next release to be our 1.0 RC. For Cocoa development, it's very stable, we
haven't received any critical bug report since at least 3 releases.

~~~
hmottestad
Ah. I read 0.10 and thought 0.1. It's a logical mistake to make since 0.1 is a
number and is the same as 0.10, I know a lot of other people count releases
the same way, but skipping 0.10 might be a bit helpful, or keeping to a strict
0-9 policy. I saw Linus got tired of the 2.6.39 counting and just skipped
ahead to 3.0.

