0
MacRuby
raleigh.rb April 21, 2009
      Sean Johnson
  Snooty Monkey, LLC
first = Job.find_by_company('Clemson University')

second = Job.find_by_company('Strategic Technologies')

startup = Company....
Product.create(:name => 'Virtual Access',
 :price => 50000, :platform => WIN32)

Product.create(:name => 'Jasper',
 :price...
O Ruby, Ruby,
wherefore art thou
     Ruby?
YARV      Rubinius
        MRI




JRuby   IronRuby          MacRuby
Cocoa is better than
  Java. It’s 60%
   chocolatier.
cocoa = ruby_on_rails if you.online?

cocoa = ruby_libraries if you.skool == old

cocoa = j2ee if you.wear?(suits)

cocoa ...
1985
1985

       NeXTSTEP


       OPENSTEP
1985

       NeXTSTEP


       OPENSTEP
1996
1985

                    NeXTSTEP


                    OPENSTEP
         1996


BSD Mach Kernal +
 OPENSTEP Cocoa
    = ...
1985

                           NeXTSTEP


                           OPENSTEP
         1996


                          ...
Cocoa in 60 seconds
Typed




   Cocoa in 60 seconds
Typed


    Late bound




   Cocoa in 60 seconds
Typed

                 true == YES
    Late bound




   Cocoa in 60 seconds
Typed

                  true == YES
     Late bound


 false == NO




   Cocoa in 60 seconds
Typed

                   true == YES
     Late bound


 false == NO
               garbage == collected




   Cocoa in 6...
Typed

                   true == YES
     Late bound


 false == NO
               garbage == collected it’s complicated
...
Typed

                   true == YES
     Late bound
Object == NSObject
 false == NO
               garbage == collected ...
String == NSString
Typed

                   true == YES
     Late bound
Object == NSObject
 false == NO
               ga...
String == NSString
Typed
 Hash == NSMutableDictionary
               true == YES
    Late bound
Object == NSObject
 false ...
String == NSString
Typed
                                       wordy
 Hash == NSMutableDictionary
               true == ...
String == NSString
Typed
                                       wordy
 Hash == NSMutableDictionary
               true == ...
String == NSString
Typed
                                       wordy
 Hash == NSMutableDictionary
                 true =...
String == NSString
Typed
                                       wordy
 Hash == NSMutableDictionary
                 true =...
init returns self String == NSString
Typed
                                       wordy
 Hash == NSMutableDictionary
     ...
init returns self String == NSString
Typed
                                        wordy
 Hash == NSMutableDictionary
    ...
init returns self String == NSString
Typed
                                       wordy
 Hash == NSMutableDictionary
     ...
init returns self String == NSString
 Typed
                                         wordy
  Hash == NSMutableDictionary
 ...
native numbers, strings, arrays, hashes




MacRuby in 60 seconds
Everything is an NSObject




 native numbers, strings, arrays, hashes




MacRuby in 60 seconds
Everything is an NSObject



                      garbage == collected


 native numbers, strings, arrays, hashes




Mac...
Everything is an NSObject
           [obj setLame: YES] == obj.lame(false)

                       garbage == collected


...
Everything is an NSObject
               [obj setLame: YES] == obj.lame(false)
[obj isLame] == obj.lame?
                 ...
Everything is an NSObject
               [obj setLame: YES] == obj.lame(false)
[obj isLame] == obj.lame?
                 ...
wrappers
       Everything is an NSObject
               [obj setLame: YES] == obj.lame(false)
[obj isLame] == obj.lame?
 ...
wrappers
       Everything is an NSObject
                [obj setLame: YES] == obj.lame(false)
[obj isLame] == obj.lame?
...
wrappers
        Everything is an NSObject
                [obj setLame: YES] == obj.lame(false)
[obj isLame] == obj.lame?...
wrappers
        Everything is an NSObject
                 [obj setLame: YES] == obj.lame(false)
[obj isLame] == obj.lame...
In the beginning...
macruby.org
Install
Hello, I’m a Mac
But...Cocoa is lame!
Cocoa            vs.         Ruby

      wordy                    expressive
initWithContentRect:style
                   ...
Cocoa            vs.         Ruby

      wordy                    expressive
initWithContentRect:style
                   ...
HotCocoa::Mapping.map(:button => :NSButton) do
   def init_with_options(button, options)
    button.initWithFrame options....
HotCocoa::Mapping.map(:button => :NSButton) do
 defaults :bezel => :rounded,
      :frame => DefaultEmptyRect,
      :layo...
HotCocoa::Mapping.map(:button => :NSButton) do
  constant :state, {
    :on => NSOnState,
    :o = NSOState,
    :mixed = ...
HotCocoa::Mapping.map(:button = :NSButton) do
 custom_methods do
  def bezel=(value)
    setBezelStyle(value)
  end
  def ...
HotCocoa
/Developer/Examples/Ruby/MacRuby/HotCocoa

/Library/Frameworks/MacRuby.framework/Versions/
      0.4/usr/lib/ruby...
You got Chocolate in
 my Peanut Butter!
MacRuby 0.4
         (March)

   Xcode Templates
   Embed MacRuby
 HotCocoa coverage /
 HotCocoa::Graphics
     Threaded G...
MacRuby 0.5
      YARV      LLVM


   Faster I/O on CFStream


        Pass RubySpec
@macruby

 #ruby-osx

macruby-devel@macosforge.org


http://macruby.org/trac/report
Mac
         iPhone
      Ruby on Rails
  Product Design/Mgmt.
snootymonkey.com   sean@snootymonkey.com
MacRuby
MacRuby
Upcoming SlideShare
Loading in...5
×

MacRuby

1,684

Published on

My MacRuby talk to the raleigh.rb user group on April 21, 2009.

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,684
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
38
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide



























































  • Transcript of "MacRuby"

    1. 1. MacRuby raleigh.rb April 21, 2009 Sean Johnson Snooty Monkey, LLC
    2. 2. first = Job.find_by_company('Clemson University') second = Job.find_by_company('Strategic Technologies') startup = Company.new('Venetica') Company.find_by_name('IBM').acquire(startup) startup2 = Company.new(:name => '3volve Technology, LLC') startup2.destroy startup3 = Company.new(:name => 'Snooty Monkey, LLC') me.career.to_s
    3. 3. Product.create(:name => 'Virtual Access', :price => 50000, :platform => WIN32) Product.create(:name => 'Jasper', :price => 35000, :platform => JAVA) Product.create(:name => 'VeniceBridge', :price => 70000, :platform => J2EE) Product.create(:name => 'IBM OmniFind Yahoo Edition', :price => 0, :platform => J2EE) Product.create(:name => 'Live Syllabus', :price => 0, :platform => RUBY_ON_RAILS) Product.create(:name => 'BubbleTimer', :price => 20, :platform => RUBY_ON_RAILS) Product.create(:name => 'NewsMilk iPhone', :price => 0, :platform => IPHONE) Product.create(:name => 'WinTheTrophy', :price => 0, RUBY_ON_RAILS) Product.create(:name => 'Time Portal', :price => 35, MAC_RUBY) me.products.to_s
    4. 4. O Ruby, Ruby, wherefore art thou Ruby?
    5. 5. YARV Rubinius MRI JRuby IronRuby MacRuby
    6. 6. Cocoa is better than Java. It’s 60% chocolatier.
    7. 7. cocoa = ruby_on_rails if you.online? cocoa = ruby_libraries if you.skool == old cocoa = j2ee if you.wear?(suits) cocoa = dot_net if you.evil? cocoa.analogy.to_s
    8. 8. 1985
    9. 9. 1985 NeXTSTEP OPENSTEP
    10. 10. 1985 NeXTSTEP OPENSTEP 1996
    11. 11. 1985 NeXTSTEP OPENSTEP 1996 BSD Mach Kernal + OPENSTEP Cocoa = Mac OS X
    12. 12. 1985 NeXTSTEP OPENSTEP 1996 Cocoa BSD Mach Kernal + OPENSTEP Cocoa Foundation AppKit = Mac OS X
    13. 13. Cocoa in 60 seconds
    14. 14. Typed Cocoa in 60 seconds
    15. 15. Typed Late bound Cocoa in 60 seconds
    16. 16. Typed true == YES Late bound Cocoa in 60 seconds
    17. 17. Typed true == YES Late bound false == NO Cocoa in 60 seconds
    18. 18. Typed true == YES Late bound false == NO garbage == collected Cocoa in 60 seconds
    19. 19. Typed true == YES Late bound false == NO garbage == collected it’s complicated Cocoa in 60 seconds
    20. 20. Typed true == YES Late bound Object == NSObject false == NO garbage == collected it’s complicated Cocoa in 60 seconds
    21. 21. String == NSString Typed true == YES Late bound Object == NSObject false == NO garbage == collected it’s complicated Cocoa in 60 seconds
    22. 22. String == NSString Typed Hash == NSMutableDictionary true == YES Late bound Object == NSObject false == NO garbage == collected it’s complicated Cocoa in 60 seconds
    23. 23. String == NSString Typed wordy Hash == NSMutableDictionary true == YES Late bound Object == NSObject false == NO garbage == collected it’s complicated Cocoa in 60 seconds
    24. 24. String == NSString Typed wordy Hash == NSMutableDictionary true == YES camelCased Late bound Object == NSObject false == NO garbage == collected it’s complicated Cocoa in 60 seconds
    25. 25. String == NSString Typed wordy Hash == NSMutableDictionary true == YES camelCased Late bound Array == NSMutableArray Object == NSObject false == NO garbage == collected it’s complicated Cocoa in 60 seconds
    26. 26. String == NSString Typed wordy Hash == NSMutableDictionary true == YES camelCased Late bound Array == NSMutableArray Object == NSObject nil can do some crazy shit false == NO garbage == collected it’s complicated Cocoa in 60 seconds
    27. 27. init returns self String == NSString Typed wordy Hash == NSMutableDictionary true == YES camelCased Late bound Array == NSMutableArray Object == NSObject nil can do some crazy shit false == NO garbage == collected it’s complicated Cocoa in 60 seconds
    28. 28. init returns self String == NSString Typed wordy Hash == NSMutableDictionary true == YES camelCased Late bound Array == NSMutableArray Object == NSObject nil can do some crazy shit false == NO garbage == collected it’s complicated my_object.method1.method2(arg1, arg2) Cocoa in 60 seconds
    29. 29. init returns self String == NSString Typed wordy Hash == NSMutableDictionary true == YES camelCased Late bound Array == NSMutableArray Object == NSObject nil can do some crazy shit false == NO garbage == collected it’s complicated my_object.method1.method2(arg1, arg2) [[myObject message1] message2: arg1 label2: arg2]; Cocoa in 60 seconds
    30. 30. init returns self String == NSString Typed wordy Hash == NSMutableDictionary true == YES camelCased Late bound Array == NSMutableArray Object == NSObject nil can do some crazy shit false == NO garbage == collected it’s complicated my_object.method1.method2(arg1, arg2) [[myObject message1] message2: arg1 label2: arg2]; my_object.method1.method2(arg1, :label2 => arg2) Cocoa in 60 seconds
    31. 31. native numbers, strings, arrays, hashes MacRuby in 60 seconds
    32. 32. Everything is an NSObject native numbers, strings, arrays, hashes MacRuby in 60 seconds
    33. 33. Everything is an NSObject garbage == collected native numbers, strings, arrays, hashes MacRuby in 60 seconds
    34. 34. Everything is an NSObject [obj setLame: YES] == obj.lame(false) garbage == collected native numbers, strings, arrays, hashes MacRuby in 60 seconds
    35. 35. Everything is an NSObject [obj setLame: YES] == obj.lame(false) [obj isLame] == obj.lame? garbage == collected native numbers, strings, arrays, hashes MacRuby in 60 seconds
    36. 36. Everything is an NSObject [obj setLame: YES] == obj.lame(false) [obj isLame] == obj.lame? garbage == collected framework ‘foundation’ framework ‘Cocoa’ native numbers, strings, arrays, hashes MacRuby in 60 seconds
    37. 37. wrappers Everything is an NSObject [obj setLame: YES] == obj.lame(false) [obj isLame] == obj.lame? garbage == collected framework ‘foundation’ framework ‘Cocoa’ native numbers, strings, arrays, hashes MacRuby in 60 seconds
    38. 38. wrappers Everything is an NSObject [obj setLame: YES] == obj.lame(false) [obj isLame] == obj.lame? garbage == collected framework ‘foundation’ framework ‘Cocoa’ native numbers, strings, arrays, hashes [[myObject message1] message2: arg1 label2: arg2]; MacRuby in 60 seconds
    39. 39. wrappers Everything is an NSObject [obj setLame: YES] == obj.lame(false) [obj isLame] == obj.lame? garbage == collected framework ‘foundation’ framework ‘Cocoa’ native numbers, strings, arrays, hashes [[myObject message1] message2: arg1 label2: arg2]; my_object.method1.method2(arg1, :label2 => arg2) MacRuby in 60 seconds
    40. 40. wrappers Everything is an NSObject [obj setLame: YES] == obj.lame(false) [obj isLame] == obj.lame? garbage == collected framework ‘foundation’ framework ‘Cocoa’ native numbers, strings, arrays, hashes [[myObject message1] message2: arg1 label2: arg2]; my_object.method1.method2(arg1, :label2 => arg2) my_object.method1.method2(arg1, label2:arg2) MacRuby in 60 seconds
    41. 41. In the beginning...
    42. 42. macruby.org
    43. 43. Install
    44. 44. Hello, I’m a Mac
    45. 45. But...Cocoa is lame!
    46. 46. Cocoa vs. Ruby wordy expressive initWithContentRect:style game.bets.last.valid? Mask:backing:defer:scree n:
    47. 47. Cocoa vs. Ruby wordy expressive initWithContentRect:style game.bets.last.valid? Mask:backing:defer:scree n:
    48. 48. HotCocoa::Mapping.map(:button => :NSButton) do def init_with_options(button, options) button.initWithFrame options.delete(:frame) end end require 'hotcocoa' include HotCocoa button :frame => [0,0,20,100] HotCocoa Constructors
    49. 49. HotCocoa::Mapping.map(:button => :NSButton) do defaults :bezel => :rounded, :frame => DefaultEmptyRect, :layout => {} end require 'hotcocoa' include HotCocoa b = button HotCocoa Defaults
    50. 50. HotCocoa::Mapping.map(:button => :NSButton) do constant :state, { :on => NSOnState, :o = NSOState, :mixed = NSMixedState } end require 'hotcocoa' include HotCocoa button :state = :on HotCocoa Constants
    51. 51. HotCocoa::Mapping.map(:button = :NSButton) do custom_methods do def bezel=(value) setBezelStyle(value) end def on? state == NSOnState end end end require 'hotcocoa' include HotCocoa go_button = button :state = on puts 'yeah!' if go_button.on? HotCocoa Methods
    52. 52. HotCocoa /Developer/Examples/Ruby/MacRuby/HotCocoa /Library/Frameworks/MacRuby.framework/Versions/ 0.4/usr/lib/ruby/1.9.1/hotcocoa/mappings
    53. 53. You got Chocolate in my Peanut Butter!
    54. 54. MacRuby 0.4 (March) Xcode Templates Embed MacRuby HotCocoa coverage / HotCocoa::Graphics Threaded GC Control Ruby Runtime from Obj-C API
    55. 55. MacRuby 0.5 YARV LLVM Faster I/O on CFStream Pass RubySpec
    56. 56. @macruby #ruby-osx macruby-devel@macosforge.org http://macruby.org/trac/report
    57. 57. Mac iPhone Ruby on Rails Product Design/Mgmt. snootymonkey.com sean@snootymonkey.com
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×