Your SlideShare is downloading. ×
0
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

MacRuby - When objective-c and Ruby meet

14,884

Published on

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.

Published in: Technology
6 Comments
27 Likes
Statistics
Notes
No Downloads
Views
Total Views
14,884
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
299
Comments
6
Likes
27
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  1. MacRuby Ruby + ObjC Friday, February 6, 2009
  2. COCOA Apple's Objective-C based programming environment for Mac OS X Friday, February 6, 2009
  3. COCOA • frameworks • APIs • accompanying runtimes Goal: native Mac applications Friday, February 6, 2009
  4. OBJECTIVE-C 2.0 • reflective • object-oriented • garbage collection • 32 and 64-bit support Friday, February 6, 2009
  5. RUBY obj.method parameter Friday, February 6, 2009
  6. OBJECTIVE-C 2.0 [obj method:parameter]; Friday, February 6, 2009
  7. RUBY friends = [] Friday, February 6, 2009
  8. OBJECTIVE-C 2.0 NSMutableArray *friends = [[NSMutableArray alloc] init]; Friday, February 6, 2009
  9. COCOA Goal => native Mac applications => ObjC Friday, February 6, 2009
  10. :emo: Friday, February 6, 2009
  11. RUBYCOCOA bridge between the Objective-C runtime and MRI Friday, February 6, 2009
  12. RUBYCOCOA No more ObjC code to write :) Friday, February 6, 2009
  13. RUBYCOCOA Write cocoa apps in RUBY :) Friday, February 6, 2009
  14. RUBYCOCOA potentially prohibitive cost :( Friday, February 6, 2009
  15. RUBYCOCOA conversion cost :( Friday, February 6, 2009
  16. RUBYCOCOA message forwarding cost :( Friday, February 6, 2009
  17. MacRuby Friday, February 6, 2009
  18. MacRuby APPLE'S OPEN SOURCE PROJECT Friday, February 6, 2009
  19. MacRuby NOT A BRIDGE Friday, February 6, 2009
  20. MacRuby BUILT ON TOP OF THE OBJECTIVE-C RUNTIME Friday, February 6, 2009
  21. MacRuby all classes => Objective-C all methods => Objective-C all objects => Objective-C Friday, February 6, 2009
  22. MacRuby CoreFoundation Friday, February 6, 2009
  23. MacRuby native CoreFoundation data types Friday, February 6, 2009
  24. MacRuby native threads Friday, February 6, 2009
  25. MacRuby Objective-C Garbage Collector Friday, February 6, 2009
  26. CODE EXAMPLE Friday, February 6, 2009
  27. $ macirb >> friends = [] => [] >> friends.class => NSMutableArray >> friends << quot;Juanquot; => [quot;Juanquot;] >> friends << quot;Denisquot; => [quot;Juanquot;, quot;Denisquot;] Friday, February 6, 2009
  28. >> 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
  29. >> name = quot;Matt Aimonettiquot; => quot;Matt Aimonettiquot; >> name.uppercaseString => quot;MATT AIMONETTIquot; >> name.upcase => quot;MATT AIMONETTIquot; Friday, February 6, 2009
  30. X-CODE ENVIRONMENT Friday, February 6, 2009
  31. FREE http://developer.apple.com/TOOLS/xcode/ Friday, February 6, 2009
  32. WELL DOCUMENTED http://developer.apple.com/index.html Friday, February 6, 2009
  33. WELL DONE Friday, February 6, 2009
  34. GREAT TOOLS Friday, February 6, 2009
  35. NEW PROJECT Friday, February 6, 2009
  36. MacRuby.framework Friday, February 6, 2009
  37. rb_main.rb Friday, February 6, 2009
  38. # 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
  39. MainMenu.nib Friday, February 6, 2009
  40. Friday, February 6, 2009
  41. V of MVC Friday, February 6, 2009
  42. PREPARE BINDINGS Friday, February 6, 2009
  43. C of MVC Friday, February 6, 2009
  44. 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
  45. class Controller attr_writer :friendsTableView end ivar = outlet Friday, February 6, 2009
  46. class Controller def awakeFromNib end end called when instantiated by nib Friday, February 6, 2009
  47. class Controller def awakeFromNib @friends = [] @friendsTableView.dataSource = self end end set the NSTableView data source Friday, February 6, 2009
  48. class Controller def addFriend(sender) end end button action Friday, February 6, 2009
  49. bind the UI with the Controller Friday, February 6, 2009
  50. NSTableDataSource informal protocol Friday, February 6, 2009
  51. def numberOfRowsInTableView(view) end NSTableDataSource protocol Friday, February 6, 2009
  52. def tableView( view, objectValueForTableColumn:column, row:index ) end NSTableView selector Friday, February 6, 2009
  53. def tableView(view, setObjectValue:object, forTableColumn:column, row:index) end NSTableView selector Friday, February 6, 2009
  54. Compile Friday, February 6, 2009
  55. HOTCOCOA Friday, February 6, 2009
  56. PURE RUBY SEXINESS Friday, February 6, 2009
  57. NO X-CODE Friday, February 6, 2009
  58. RUBY DSL FOR COCOA Friday, February 6, 2009
  59. $ hotcocoa sdruby Friday, February 6, 2009
  60. $ hotcocoa sdruby PROJECT SETTINGS Friday, February 6, 2009
  61. $ hotcocoa sdruby CORE OF THE APP CODE Friday, February 6, 2009
  62. $ hotcocoa sdruby MENU BAR Friday, February 6, 2009
  63. $ hotcocoa sdruby RAKE TASKS Friday, February 6, 2009
  64. $ hotcocoa sdruby APP RESOURCES Friday, February 6, 2009
  65. 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
  66. application :name => quot;Sdrubyquot; do |app| end NSApplication Friday, February 6, 2009
  67. application :name => quot;Sdrubyquot; do |app| app.delegate = self end set the delegation Friday, February 6, 2009
  68. # 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
  69. window(:frame => [100, 100, 500, 500], :title => quot;SDRubyquot;) do |win| end NSWindow helper Friday, February 6, 2009
  70. label(:text => quot;Hello from HotCocoaquot;, :layout => {:start => false}) NSTextField helper Friday, February 6, 2009
  71. win << label(:text => quot;Hello from HotCocoaquot;) contentView.addSubview helper Friday, February 6, 2009
  72. win.will_close { exit } window callback Friday, February 6, 2009
  73. $ macrake Friday, February 6, 2009
  74. USE ANY COCOA FRAMEWORK Friday, February 6, 2009
  75. WEBKIT Friday, February 6, 2009
  76. framework 'webkit' Friday, February 6, 2009
  77. win << web_view( :layout => {:expand => [:width, :height]}, :url => quot;http://sdruby.comquot;) Friday, February 6, 2009
  78. Friday, February 6, 2009
  79. $ macrake deploy Raffle.app Friday, February 6, 2009
  80. AND MUCH MORE Friday, February 6, 2009
  81. DEMO APPS Friday, February 6, 2009
  82. SD RUBY RAFFLE APP Friday, February 6, 2009
  83. ¿What to do with MacRuby? Friday, February 6, 2009
  84. WEB APP CLIENT Friday, February 6, 2009
  85. REUSE RUBY CODE Friday, February 6, 2009
  86. RETHINK DESKTOP APPS Friday, February 6, 2009
  87. WEBKIT INTEGRATION Friday, February 6, 2009
  88. ¿MacRuby’s future? Friday, February 6, 2009
  89. MUCH BETTER PERFORMANCE Friday, February 6, 2009
  90. NEW VM Friday, February 6, 2009
  91. SOURCE OBFUSCATION Friday, February 6, 2009
  92. COMPILED CODE Friday, February 6, 2009
  93. OPTIMIZATIONS BASED ON THE UNDERLYING OS Friday, February 6, 2009
  94. SOLID & SUPPORTED WAY TO WRITE COCOA APPS Friday, February 6, 2009
  95. ¿MAINSTREAM WAY TO WRITE COCOA APPS? Friday, February 6, 2009
  96. ¿IPHONE OUTPUT? Friday, February 6, 2009
  97. 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
  98. Props to Rich Kilmer (hotcocoa) & Laurent Sansonetti (MacRuby) Friday, February 6, 2009

×