Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
MacRuby
                           Ruby + ObjC




Friday, February 6, 2009
COCOA
             Apple's Objective-C based programming environment for
                                   Mac OS X
Frida...
COCOA


    • frameworks

    • APIs

    • accompanying          runtimes

                           Goal: native Mac ap...
OBJECTIVE-C 2.0


    • reflective

    • object-oriented

    • garbage              collection

    • 32         and 64-b...
RUBY


                           obj.method parameter




Friday, February 6, 2009
OBJECTIVE-C 2.0


                           [obj method:parameter];




Friday, February 6, 2009
RUBY


                           friends = []




Friday, February 6, 2009
OBJECTIVE-C 2.0


                NSMutableArray *friends =
             [[NSMutableArray alloc] init];




Friday, Februa...
COCOA



                       Goal => native Mac applications => ObjC




Friday, February 6, 2009
:emo:
Friday, February 6, 2009
RUBYCOCOA


                   bridge between
          the Objective-C runtime and MRI




Friday, February 6, 2009
RUBYCOCOA


               No more ObjC code to write :)




Friday, February 6, 2009
RUBYCOCOA


                    Write cocoa apps in RUBY :)




Friday, February 6, 2009
RUBYCOCOA


          potentially prohibitive cost :(




Friday, February 6, 2009
RUBYCOCOA


                           conversion cost :(




Friday, February 6, 2009
RUBYCOCOA


                       message forwarding cost :(




Friday, February 6, 2009
MacRuby




Friday, February 6, 2009
MacRuby




                           APPLE'S OPEN SOURCE
                                  PROJECT



Friday, February 6...
MacRuby




                           NOT A BRIDGE




Friday, February 6, 2009
MacRuby




                           BUILT ON TOP OF THE
                           OBJECTIVE-C RUNTIME



Friday, Febru...
MacRuby




   
 all classes 
 => Objective-C
   
 all methods 
=> Objective-C
   
 all objects 
=> Objective-C

Friday, F...
MacRuby




                           CoreFoundation




Friday, February 6, 2009
MacRuby




                           native CoreFoundation
                                  data types



Friday, Febru...
MacRuby




                           native threads




Friday, February 6, 2009
MacRuby




           Objective-C Garbage Collector




Friday, February 6, 2009
CODE EXAMPLE




Friday, February 6, 2009
$ macirb
     >> friends = []
     => []
     >> friends.class
     => NSMutableArray
     >> friends << quot;Juanquot;
  ...
>> friends << {first_name: quot;Laurentquot;,
                   last_name: quot;Sansonettiquot;}
   => [quot;Juanquot;, q...
>>           name = quot;Matt Aimonettiquot;
   =>           quot;Matt Aimonettiquot;
   >>           name.uppercaseString...
X-CODE ENVIRONMENT




Friday, February 6, 2009
FREE



                           http://developer.apple.com/TOOLS/xcode/
Friday, February 6, 2009
WELL DOCUMENTED



                            http://developer.apple.com/index.html
Friday, February 6, 2009
WELL DONE
Friday, February 6, 2009
GREAT TOOLS
Friday, February 6, 2009
NEW PROJECT
Friday, February 6, 2009
MacRuby.framework
Friday, February 6, 2009
rb_main.rb
Friday, February 6, 2009
# Loading the Cocoa framework. If you need to load more
         frameworks, you can
         # do that here too.
        ...
MainMenu.nib
Friday, February 6, 2009
Friday, February 6, 2009
V of MVC
Friday, February 6, 2009
PREPARE BINDINGS
Friday, February 6, 2009
C of MVC
Friday, February 6, 2009
class Controller
                 attr_writer :friendsTableView

                    def awakeFromNib
                    ...
class Controller
             attr_writer :friendsTableView
            end




                           ivar = outlet
F...
class Controller

                      def awakeFromNib
                      end

               end




            cal...
class Controller

                      def awakeFromNib
                        @friends = []
                        @fr...
class Controller

                   def addFriend(sender)
                   end

               end




                ...
bind the UI with the Controller
Friday, February 6, 2009
NSTableDataSource
                            informal protocol




Friday, February 6, 2009
def numberOfRowsInTableView(view)
                   end




                NSTableDataSource protocol
Friday, February 6...
def tableView( view,
                    objectValueForTableColumn:column,
                    row:index )
            end...
def tableView(view,
                            setObjectValue:object,
                            forTableColumn:column,
...
Compile
Friday, February 6, 2009
HOTCOCOA
Friday, February 6, 2009
PURE RUBY SEXINESS
Friday, February 6, 2009
NO X-CODE
Friday, February 6, 2009
RUBY DSL FOR COCOA
Friday, February 6, 2009
$ hotcocoa sdruby




Friday, February 6, 2009
$ hotcocoa sdruby




                            PROJECT SETTINGS
Friday, February 6, 2009
$ hotcocoa sdruby




                    CORE OF THE APP CODE
Friday, February 6, 2009
$ hotcocoa sdruby




                               MENU BAR
Friday, February 6, 2009
$ hotcocoa sdruby




                               RAKE TASKS
Friday, February 6, 2009
$ hotcocoa sdruby




                             APP RESOURCES
Friday, February 6, 2009
def start
      application :name => quot;Sdrubyquot; do |app|
        app.delegate = self
        window(:frame => [100, ...
application :name => quot;Sdrubyquot; do |app|
               end




                           NSApplication
Friday, Feb...
application :name => quot;Sdrubyquot; do |app|
                 app.delegate = self
               end




               ...
# file/open
                def on_open(menu)
                end

                # file/new
                def on_new(m...
window(:frame => [100, 100, 500, 500], :title => quot;SDRubyquot;) do |win|
     end




                           NSWind...
label(:text => quot;Hello from HotCocoaquot;, :layout => {:start => false})




                           NSTextField hel...
win << label(:text => quot;Hello from HotCocoaquot;)




         contentView.addSubview helper
Friday, February 6, 2009
win.will_close { exit }




                           window callback
Friday, February 6, 2009
$ macrake




Friday, February 6, 2009
USE ANY COCOA
                             FRAMEWORK



Friday, February 6, 2009
WEBKIT




Friday, February 6, 2009
framework 'webkit'




Friday, February 6, 2009
win << web_view( :layout => {:expand => [:width, :height]},
                     :url => quot;http://sdruby.comquot;)




...
Friday, February 6, 2009
$ macrake deploy

                                  Raffle.app




Friday, February 6, 2009
AND MUCH MORE




Friday, February 6, 2009
DEMO APPS




Friday, February 6, 2009
SD RUBY RAFFLE APP
Friday, February 6, 2009
¿What to do
                           with MacRuby?



Friday, February 6, 2009
WEB APP
                           CLIENT



Friday, February 6, 2009
REUSE RUBY CODE




Friday, February 6, 2009
RETHINK DESKTOP APPS




Friday, February 6, 2009
WEBKIT INTEGRATION




Friday, February 6, 2009
¿MacRuby’s future?




Friday, February 6, 2009
MUCH BETTER
                           PERFORMANCE



Friday, February 6, 2009
NEW VM




Friday, February 6, 2009
SOURCE OBFUSCATION




Friday, February 6, 2009
COMPILED CODE




Friday, February 6, 2009
OPTIMIZATIONS BASED ON
             THE UNDERLYING OS



Friday, February 6, 2009
SOLID & SUPPORTED WAY TO
          WRITE COCOA APPS



Friday, February 6, 2009
¿MAINSTREAM WAY TO WRITE
            COCOA APPS?



Friday, February 6, 2009
¿IPHONE OUTPUT?




Friday, February 6, 2009
resources:
                                       http://www.macruby.org
                            http://tinyurl.com/ma...
Props to
                              Rich Kilmer
                              (hotcocoa)
                              ...
Upcoming SlideShare
Loading in …5
×

resources: http://www.macruby.org http://tinyurl.com/macruby-getting-started http://macruby.org/trac/wiki/MacRubyTutorial http://github.com/masterkain/macruby MacRuby - When objective-c and Ruby meet

32,494 views

Published on

resources:
http://www.macruby.org
http://tinyurl.com/macruby-getting-started
http://macruby.org/trac/wiki/MacRubyTutorial
http://github.com/masterkain/macruby
http://tinyurl.com/macruby-hillegass




Friday, February 6, 2009

Published in: Technology
  • Objective-C Programming: The Big Nerd Ranch Guide (2nd Edition) (Big Nerd Ranch Guides) --- http://amzn.to/1R982Rx
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Objective C: Crash Course - The Ultimate Beginner's Course to Learning Objective C Programming in Under 12 Hours --- http://amzn.to/1T2JKuO
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Programming in Objective-C (6th Edition) (Developer's Library) --- http://amzn.to/21Bvido
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • good one
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Video available there: http://sdruby.com/podcast/58
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

×