MacRuby - When objective-c and Ruby meet
Upcoming SlideShare
Loading in...5
×
 

MacRuby - When objective-c and Ruby meet

on

  • 21,176 views

MACRUBY: WHAT'S THE BIG DEAL?...

MACRUBY: WHAT'S THE BIG DEAL?

Last year, Apple released MacRuby, an open source Ruby implementation
written on top of the Objective-C runtime. Writing native MacOSX
applications in Ruby without having to pay the cost of using a bridge
is now a reality. This is an important milestone for Ruby, Apple and
the Ruby community.

Matt Aimonetti explains the implementation, show how to build
desktop applications with MacRuby & HotCocoa, and discuss why Ruby
developers should add this new tool to their utility belt. Matt also talks about the future of MacRuby.

Statistics

Views

Total Views
21,176
Views on SlideShare
19,999
Embed Views
1,177

Actions

Likes
25
Downloads
297
Comments
6

15 Embeds 1,177

http://merbist.com 945
http://www.slideshare.net 72
http://www.stile.ch 68
http://coderwall.com 48
http://merboverheard.com 19
http://www.merboverheard.com 12
http://localhost 4
http://cc.usu.edu 2
http://stile.ch 1
http://translate.googleusercontent.com 1
http://www.cullect.com 1
http://static.slideshare.net 1
http://www.salle.url.edu 1
http://staging.visualcv.com 1
http://www.linkedin.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

MacRuby - When objective-c and Ruby meet MacRuby - When objective-c and Ruby meet Presentation Transcript

  • MacRuby Ruby + ObjC Friday, February 6, 2009
  • COCOA Apple's Objective-C based programming environment for Mac OS X Friday, February 6, 2009
  • COCOA • frameworks • APIs • accompanying runtimes Goal: native Mac applications Friday, February 6, 2009
  • OBJECTIVE-C 2.0 • reflective • object-oriented • garbage collection • 32 and 64-bit support Friday, February 6, 2009
  • 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, February 6, 2009
  • 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, 2009
  • MacRuby NOT A BRIDGE Friday, February 6, 2009
  • MacRuby BUILT ON TOP OF THE OBJECTIVE-C RUNTIME Friday, February 6, 2009
  • MacRuby all classes => Objective-C all methods => Objective-C all objects => Objective-C Friday, February 6, 2009
  • MacRuby CoreFoundation Friday, February 6, 2009
  • MacRuby native CoreFoundation data types Friday, February 6, 2009
  • 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; => [quot;Juanquot;] >> friends << quot;Denisquot; => [quot;Juanquot;, quot;Denisquot;] Friday, February 6, 2009
  • >> friends << {first_name: quot;Laurentquot;, last_name: quot;Sansonettiquot;} => [quot;Juanquot;, quot;Denisquot;, {:first_name=>quot;Laurentquot;, :last_name=>quot;Sansonettiquot;}] >> friends.length => 3 Friday, February 6, 2009
  • >> name = quot;Matt Aimonettiquot; => quot;Matt Aimonettiquot; >> name.uppercaseString => quot;MATT AIMONETTIquot; >> name.upcase => quot;MATT AIMONETTIquot; Friday, February 6, 2009
  • 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. framework 'Cocoa' # Loading all the Ruby project files. dir_path = NSBundle.mainBundle.resourcePath.fileSystemRepresentation Dir.entries(dir_path).each do |path| if path != File.basename(__FILE__) and path[-3..-1] == '.rb' require(path) end end # Starting the Cocoa main loop. NSApplicationMain(0, nil) Friday, February 6, 2009
  • 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 end def numberOfRowsInTableView(view) end def tableView(view, objectValueForTableColumn:column, row:index) end def tableView(view, setObjectValue:object, forTableColumn:column, row:index) end def addFriend(sender) end end Friday, February 6, 2009
  • class Controller attr_writer :friendsTableView end ivar = outlet Friday, February 6, 2009
  • class Controller def awakeFromNib end end called when instantiated by nib Friday, February 6, 2009
  • class Controller def awakeFromNib @friends = [] @friendsTableView.dataSource = self end end set the NSTableView data source Friday, February 6, 2009
  • class Controller def addFriend(sender) end end button action Friday, February 6, 2009
  • 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, 2009
  • def tableView( view, objectValueForTableColumn:column, row:index ) end NSTableView selector Friday, February 6, 2009
  • def tableView(view, setObjectValue:object, forTableColumn:column, row:index) end NSTableView selector Friday, February 6, 2009
  • 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, 100, 500, 500], :title => quot;SDRubyquot;) do |win| win << label(:text => quot;Hello from HotCocoaquot;, :layout => {:start => false}) win.will_close { exit } end end end RUBY HELPERS Friday, February 6, 2009
  • application :name => quot;Sdrubyquot; do |app| end NSApplication Friday, February 6, 2009
  • application :name => quot;Sdrubyquot; do |app| app.delegate = self end set the delegation Friday, February 6, 2009
  • # file/open def on_open(menu) end # file/new def on_new(menu) end # help menu item def on_help(menu) end # window/zoom def on_zoom(menu) end # window/bring_all_to_front def on_bring_all_to_front(menu) end set the delegation Friday, February 6, 2009
  • window(:frame => [100, 100, 500, 500], :title => quot;SDRubyquot;) do |win| end NSWindow helper Friday, February 6, 2009
  • label(:text => quot;Hello from HotCocoaquot;, :layout => {:start => false}) NSTextField helper Friday, February 6, 2009
  • 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
  • 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/macruby-getting-started http://macruby.org/trac/wiki/MacRubyTutorial http://github.com/masterkain/macruby http://tinyurl.com/macruby-hillegass Friday, February 6, 2009
  • Props to Rich Kilmer (hotcocoa) & Laurent Sansonetti (MacRuby) Friday, February 6, 2009