Cocoa + Ruby & Python in Leopard

Discussion in 'Mac Programming' started by Loc, Oct 9, 2007.

  1. Loc macrumors newbie

    Jul 23, 2007
    Southern California
    I'm a professional Java developer but green as a bean when it comes to Mac development. I've picked up Ruby (and Rails) on the side and just found out Leopard will have native support for Python and Ruby. Can someone enlighten me on what this means for developers of these languages? Does this mean it's easier to write apps with Cocoa, make it run faster, make more libraries available, etc? Benefits of this? I'm a n00b :)

    Since I know Ruby already I'm hoping I can leverage that to get a jump start on writing some basic Mac apps. I'm not against learning Obj-C, I just want to get something up and running quickly to get my feet wet with Mac dev :D
  2. garethlewis2 macrumors 6502

    Dec 6, 2006
    Ruby and Python will have we call official language bridges between themselves and the Cocoa frameworks. This means you can design your interface in IB then build the application in Ruby or Python instead of using Objective-C.

    As a simple rule of thumb the following will help you in deciding whether you should go and learn Objective-C 2.0. (It isn't difficult, and with GC and properties, it becomes much much easier). If the application you want to build needs to process huge amounts of digital data or do horrendous amounts of number crunching then Objective-C 2.0 is the way to go. It compiles down to a native binary and runs at maximum speed. The disadvantage of course is unlike Ruby a double does not go from being a 64bit double precision floating point number to a object that can hold a infinite precision number when the number exceeds the IEEE standard, and you can't mix these in statements either.

    On the other hand, if your application does need to process say pictures, but say hundreds instead of thousands then Ruby and Python can both handle binary data easily. Ruby with each_byte and Python with its equivalent. These will be slower. They are always interpreted. They never get converted into a runtime binary, ever. This is the downside of a VHLL when compared to a HLL, but the with machines getting more cores and faster cores to boot, it will eventually get to the stage when you don't need to use a language like Objective-C or C++ at all for most programming tasks. Unlike Ruby and Python, these two languages and anything derived from them are inherently single threaded. Ruby and Python use functional programming practices as well as function parameters.
  3. Alloye macrumors 6502a

    Apr 11, 2007
    Rocklin, CA
    Google RubyCocoa and have fun. Some of the information out there is a little dated, but it should give you an idea of what can be accomplished.

    BTW, I've been following the development of RubyCocoa for some time. The latest Leopard seed contains RubyCocoa 0.12 and a number of useful RubyGems right out of the box. The primary upside to using RubyCocoa is that Ruby is a far more productive language than Objective-C. On the other hand, Ruby is not a good choice for writing high performance or multithreaded code.

Share This Page