File: INTRODUCTION

This is the documentation for RubyObjC, a bridge connecting the Ruby and Objective-C languages. It is automatically generated from the RubyObjC source files. WARNING: This is a preliminary release. All features are subject to change.

Copyright and License

RubyObjC is a copyrighted software product of Neon Design Technology, Inc. It is released under the terms of the Ruby License. See the LICENSE file for details.

Requirements

RubyObjC has been tested on systems running Mac OS 10.4.8 and greater. It is planned that other platforms will be supported in the future.

Distribution

RubyObjC is distributed as a Ruby gem. To install it, use the following command:

        gem install rubyobjc --source http://www.rubyobjc.com

News

For the latest information about RubyObjC, visit www.rubyobjc.com.

About RubyObjC

Ruby and Objective-C are powerful languages for software development that have complementary strengths and weaknesses.

RubyObjC allows Ruby and Objective-C to be used together. With it, software developers can use the strengths of both languages while avoiding their respective weaknesses.

Prior to RubyObjC, another bridge was developed between Ruby and Objective-C. This bridge, RubyCocoa, is available under the Ruby license and is actively supported by a small team of volunteers. Recently it has also received many contributions from Laurent Sansonetti at Apple Computer, Inc.

RubyObjC was created so that emphasis could be placed on the following values:

A GOOD BRIDGE GETS A LOT OF TRAFFIC

RubyObjC directly inserts handlers for Ruby methods in Objective-C method tables and adds handlers for Objective-C methods to the Ruby method tables. This allows method calls to be made more quickly than in bridges that resolve calls dynamically, perhaps by using Ruby‘s "method_missing" method. As a result, we can afford to cross the RubyObjC bridge frequently.

YOU CAN NEVER BE TOO RICH, TOO THIN, OR TOO INTROSPECTIVE

Because handlers are inserted in the Ruby class method tables, Ruby‘s "methods" method can be used to introspect the capabilities of Objective-C objects. More generally, RubyObjC includes Ruby interfaces that provide direct access to the Objective-C runtime and to data structures and statistics maintained by the RubyObjC bridge. A machine- and human-readable log file also makes it easier to diagnose problems in RubyObjC applications.

CLARITY IS BEAUTY

To avoid ambiguity, only one naming convention is used to map Objective-C selector names to Ruby. Some may find this less "beautiful", but the guiding principles are that ambiguity undermines reliability and that reliability is an essential element of beauty.

Also, the source code for RubyObjC itself was written to be as clear and minimal as possible so that RubyObjC could be reliably used in commercial software projects. The emphasis is on clarity and reliability over completeness: currently RubyObjC does not support the full range of bridged types that RubyCocoa does, but it is believed that this limitation is easily worked around with project-specific Ruby and Objective-C code. RubyObjC‘s deep Ruby interfaces to the Objective-C runtime allow many more of these issues to be addressed directly from Ruby.

LIBERTY, EQUALITY, FRATERNITY

In RubyObjC, Objective-C and Ruby are each important contributors that addresses weaknesses of the other. Instead of forcing one language to fully adapt to the other, we blend them together in a powerful partnership.

BUILD IT THE RUBY WAY

RubyObjC embraces Ruby as a systems-programming language and as a platform for domain-specific language (DSL) development. Rake is used to build the bridge, RDoc is used to generate documentation, testing is managed with Test::Unit, and RubyObjC is distributed as a Ruby gem.

RubyObjC includes a Rake task that can be used to build a Cocoa application. When an application is written with Ruby code only, it can be built with no compilation or linking. When the application includes Objective-C code, that code is automatically compiled and linked into the executable. This allows Cocoa applications to be easily built from the command line or your favorite text editor.

There‘s also an emphasis in RubyObjC toward minimizing dependence on Interface Builder for constructing user interfaces. Examples illustrate the use of Ruby to build interfaces by direct manipulation of Cocoa objects. This is leading to Ruby DSLs for concisely designing interfaces and is loosening Objective-C‘s bondage to platform-dependent graphical tools.

PORTABILITY

Although Objective-C is most often used on Apple systems, it is supported on other platforms by the GNU gcc compiler. RubyObjC was designed to minimize dependencies on Apple proprietary features so that it can be easily ported to other platforms. It was originally developed on a prerelease version of Apple‘s OS X 10.5 (Leopard), then was back-ported to OS X 10.4 (Tiger).

Author

RubyObjC was written by me, Tim Burks. Prior to its development, I built a web site that documented RubyCocoa. I called it "RubyCocoa Resources" and you‘ll find it at www.rubycocoa.com.

Acknowledgements

RubyObjC would not have been possible without the preceeding efforts of many giants. Some of them include: