SlideShare une entreprise Scribd logo
1  sur  49
Michael
“Doc”
Norton
MacRuby
and
HotCocoa
CodeStock
is
proudly
partnered
with:




                 RecruitWise
and
Staff
with
Excellence
‐
www.recruitwise.jobs



       Send
instant
feedback
on
this
session
via
Twi?er:
       



Send
a
direct
message
with
the
room
number
to
@CodeStock
       



d codestock 503 This session is great!

       For
more
informa<on
on
sending
feedback
using
Twi>er
while
at

       CodeStock,
please
see
the
“CodeStock
README”
in
your
CodeStock
guide.
Telerik
                     Deliver More Than Expected @ Code Stock 2011.




Check
out
our
NEW
Just
Decompile
Product
–
Powerful,
Free
Decompiler.
Forever.
             hDp://www.telerik.com/products/decompiling.aspx

                                                                                                  @telerik


              Contact
your
user
group
leader
for
a
$100
discount
off
your
next
Telerik
purchase!
Introduction to
MacRuby &
HotCocoa
Michael “Doc” Norton
@DocOnDev
http://www.docondev.com/
doc@leandog.com
RubyCocoa

• 2001 Written by Fujimoto Hisakuni


• A bridge between objective C and Ruby


• Bundled with Mac OSX 10.5


• Ugly (for Ruby)
RubyCocoa Hello World
require 'osx/cocoa'; include OSX

app = NSApplication.sharedApplication
win = NSWindow.alloc.initWithContentRect_styleMask_backing_defer(
    [0, 0, 200, 60],
    NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask,
    NSBackingStoreBuffered,
    false)
win.title = 'Hello World'

button = NSButton.alloc.initWithFrame(NSZeroRect)
win.contentView.addSubview(button)
button.bezelStyle = NSRoundedBezelStyle
button.title = 'Hello!'
button.sizeToFit
button.frameOrigin = NSMakePoint((win.contentView.frameSize.width / 2.0) - (button.frameSize.width / 2.0),
                                (win.contentView.frameSize.height / 2.0) - (button.frameSize.height / 2.0))

button_controller = Object.new
def button_controller.sayHello(sender)
    puts "Hello World!"
end
button.target = button_controller
button.action = 'sayHello:'

win.display
win.orderFrontRegardless

app.run
MacRuby

• 2008 to replace RubyCocoa


• Not a bridge


   • Run MUCH Faster


• Still looks ugly
MacRuby Hello World
framework ‘Cocoa’

app = NSApplication.sharedApplication
win = NSWindow.alloc.initWithContentRect([0, 0, 200, 60],
  styleMask:NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask,
  backing:NSBackingStoreBuffered,
  defer:false)

win.title = 'Hello World'

button = NSButton.alloc.initWithFrame(NSZeroRect)
win.contentView.addSubview(button)
button.bezelStyle = NSRoundedBezelStyle
button.title = 'Hello!'
button.sizeToFit
button.frameOrigin = NSMakePoint((win.contentView.frameSize.width / 2.0) - (button.frameSize.width / 2.0),
                                (win.contentView.frameSize.height / 2.0) - (button.frameSize.height / 2.0))

button_controller = Object.new
def button_controller.sayHello(sender)
    puts "Hello World!"
end
button.target = button_controller
button.action = 'sayHello:'

win.display
win.orderFrontRegardless

app.run
What is HotCocoa?

• Ruby API


  • Looks and Feels like Ruby -
    YAY!


• Simplifies use of Objective C/
  Cocoa
HotCocoa Hello World
require ‘hotcocoa’; include HotCocoa

app = NSApplication.sharedApplication
win = NSWindow.alloc.initWithContentRect([0, 0, 200, 60],
  styleMask:NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask,
  backing:NSBackingStoreBuffered,
  defer:false)

win.title = 'Hello World'

button = NSButton.alloc.initWithFrame(NSZeroRect)
win.contentView.addSubview(button)
button.bezelStyle = NSRoundedBezelStyle
button.title = 'Hello!'
button.sizeToFit
button.frameOrigin = NSMakePoint((win.contentView.frameSize.width / 2.0) - (button.frameSize.width / 2.0),
                                (win.contentView.frameSize.height / 2.0) - (button.frameSize.height / 2.0))

button_controller = Object.new
def button_controller.sayHello(sender)
    puts "Hello World!"
end
button.target = button_controller
button.action = 'sayHello:'

win.display
win.orderFrontRegardless

app.run
HotCocoa Hello World
require ‘hotcocoa’; include HotCocoa

app = NSApplication.sharedApplication


win = window :title => ‘hello world’, :frame => [0, 0, 200, 60]

button = NSButton.alloc.initWithFrame(NSZeroRect)
win.contentView.addSubview(button)
button.bezelStyle = NSRoundedBezelStyle
button.title = 'Hello!'
button.sizeToFit
button.frameOrigin = NSMakePoint((win.contentView.frameSize.width / 2.0) - (button.frameSize.width / 2.0),
                                (win.contentView.frameSize.height / 2.0) - (button.frameSize.height / 2.0))

button_controller = Object.new
def button_controller.sayHello(sender)
    puts "Hello World!"
end
button.target = button_controller
button.action = 'sayHello:'

win.display
win.orderFrontRegardless

app.run
HotCocoa Hello World
require ‘hotcocoa’; include HotCocoa

app = NSApplication.sharedApplication


win = window :title => ‘hello world’, :frame => [0, 0, 200, 60]

b = button :title => ‘Hello!’, :layout => {:align => :center}
win << b

button_controller = Object.new
def button_controller.sayHello(sender)
    puts "Hello World!"
end
button.target = button_controller
button.action = 'sayHello:'

win.display
win.orderFrontRegardless

app.run
HotCocoa Hello World
require ‘hotcocoa’; include HotCocoa

app = NSApplication.sharedApplication


win = window :title => ‘hello world’, :frame => [0, 0, 200, 60]

b = button :title => ‘Hello!’, :layout => {:align => :center}
win << b

b.on_action { puts “Hello World!” }

win.display
win.orderFrontRegardless

app.run
HotCocoa Hello World
require ‘hotcocoa’; include HotCocoa

application do

      win = window :title => ‘hello world’, :frame => [0, 0, 200, 60]

      b = button :title => ‘Hello!’, :layout => {:align => :center}
      win << b

      b.on_action { puts “Hello World!” }

end
Getting Started

• hotcocoa stock_schedule

• cd stock_schedule

• macrake
What did we make?

        ./Rakefile
        ./Stock Schedule.app/
        ./config/build.yml
        ./lib/application.rb
        ./lib/menu.rb
        ./resources/HotCocoa.icns
Menu.rb
Menu.rb (Redacted)
Application.rb
Application.rb (Updated)
Application.rb (Updated)
Windows & Frames
Window with no layout
Window with no layout
layout_view

• :mode -> :horizontal, :vertical             • options
• :spacing                                       • :expand -> :height, :width,
                                                   [:height, :width]
• :frame -> [:top, :right, :width, :height]
                                                 • :padding
• :size -> [:width, :height]
                                                    • :left_ | :right_ | :top_ | :bottom_
• :padding
                                                 • :align -> :left | :center | :right | :top
   • :left_ | :right_ | :top_ | :bottom_           | :bottom
• :margin
   • :left_ | :right_ | :top_ | :bottom_




 https://github.com/richkilmer/hotcocoa/blob/master/lib/hotcocoa/layout_view.rb
Assign layout to window view
Assign layout to window view
Filter Bar
Inject scrolling view with table
Inject scrolling view with table
Simple Grid
Are we there yet?
Create two columns
Create two columns
Populate both columns
Populate both columns
Simple Grid
Get Data from the API
Get Data from the API
Big Hideous String
Big Hideous String
Uses API (poorly)
Add Title Column
Add Title Column
Filter API Results
Filter API Results
Filters API Results
Are we there yet?
Thank You!
Michael “Doc” Norton
@DocOnDev
http://www.docondev.com/
doc@leandog.com

Contenu connexe

Similaire à CodeStock :: Introduction To MacRuby and HotCocoa

MOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app developmentMOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app developmentanistar sung
 
JS Fest 2018. Илья Иванов. Введение в React-Native
JS Fest 2018. Илья Иванов. Введение в React-NativeJS Fest 2018. Илья Иванов. Введение в React-Native
JS Fest 2018. Илья Иванов. Введение в React-NativeJSFestUA
 
Cordova: Making Native Mobile Apps With Your Web Skills
Cordova: Making Native Mobile Apps With Your Web SkillsCordova: Making Native Mobile Apps With Your Web Skills
Cordova: Making Native Mobile Apps With Your Web SkillsClay Ewing
 
Macruby& Hotcocoa presentation by Rich Kilmer
Macruby& Hotcocoa presentation by Rich KilmerMacruby& Hotcocoa presentation by Rich Kilmer
Macruby& Hotcocoa presentation by Rich KilmerMatt Aimonetti
 
Lessons from a year of building apps with React Native
Lessons from a year of building apps with React NativeLessons from a year of building apps with React Native
Lessons from a year of building apps with React NativeRyan Boland
 
Leaving Interface Builder Behind
Leaving Interface Builder BehindLeaving Interface Builder Behind
Leaving Interface Builder BehindJohn Wilker
 
Style vs. Content and Clean Theming in iOS
Style vs. Content and Clean Theming in iOSStyle vs. Content and Clean Theming in iOS
Style vs. Content and Clean Theming in iOSKeith Norman
 
Telerik AppBuilder Presentation for TelerikNEXT Conference
Telerik AppBuilder Presentation for TelerikNEXT ConferenceTelerik AppBuilder Presentation for TelerikNEXT Conference
Telerik AppBuilder Presentation for TelerikNEXT ConferenceJen Looper
 
Responsive WordPress workflow
Responsive WordPress workflowResponsive WordPress workflow
Responsive WordPress workflowJames Bundey
 
When Smalltalk Meets the Web
When Smalltalk Meets the WebWhen Smalltalk Meets the Web
When Smalltalk Meets the WebESUG
 
From Backbone to Ember and Back(bone) Again
From Backbone to Ember and Back(bone) AgainFrom Backbone to Ember and Back(bone) Again
From Backbone to Ember and Back(bone) Againjonknapp
 
Build a video chat application with twilio, rails, and javascript (part 1)
Build a video chat application with twilio, rails, and javascript (part 1)Build a video chat application with twilio, rails, and javascript (part 1)
Build a video chat application with twilio, rails, and javascript (part 1)Katy Slemon
 
Jacob Waller: Webifying Titanium Development
Jacob Waller: Webifying Titanium DevelopmentJacob Waller: Webifying Titanium Development
Jacob Waller: Webifying Titanium DevelopmentAxway Appcelerator
 
The Ring programming language version 1.9 book - Part 54 of 210
The Ring programming language version 1.9 book - Part 54 of 210The Ring programming language version 1.9 book - Part 54 of 210
The Ring programming language version 1.9 book - Part 54 of 210Mahmoud Samir Fayed
 
Introducing PanelKit
Introducing PanelKitIntroducing PanelKit
Introducing PanelKitLouis D'hauwe
 

Similaire à CodeStock :: Introduction To MacRuby and HotCocoa (20)

MOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app developmentMOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app development
 
JS Fest 2018. Илья Иванов. Введение в React-Native
JS Fest 2018. Илья Иванов. Введение в React-NativeJS Fest 2018. Илья Иванов. Введение в React-Native
JS Fest 2018. Илья Иванов. Введение в React-Native
 
Cordova: Making Native Mobile Apps With Your Web Skills
Cordova: Making Native Mobile Apps With Your Web SkillsCordova: Making Native Mobile Apps With Your Web Skills
Cordova: Making Native Mobile Apps With Your Web Skills
 
JavaScript on the Desktop
JavaScript on the DesktopJavaScript on the Desktop
JavaScript on the Desktop
 
Macruby& Hotcocoa presentation by Rich Kilmer
Macruby& Hotcocoa presentation by Rich KilmerMacruby& Hotcocoa presentation by Rich Kilmer
Macruby& Hotcocoa presentation by Rich Kilmer
 
Lessons from a year of building apps with React Native
Lessons from a year of building apps with React NativeLessons from a year of building apps with React Native
Lessons from a year of building apps with React Native
 
Leaving Interface Builder Behind
Leaving Interface Builder BehindLeaving Interface Builder Behind
Leaving Interface Builder Behind
 
Wave Workshop
Wave WorkshopWave Workshop
Wave Workshop
 
Style vs. Content and Clean Theming in iOS
Style vs. Content and Clean Theming in iOSStyle vs. Content and Clean Theming in iOS
Style vs. Content and Clean Theming in iOS
 
Telerik AppBuilder Presentation for TelerikNEXT Conference
Telerik AppBuilder Presentation for TelerikNEXT ConferenceTelerik AppBuilder Presentation for TelerikNEXT Conference
Telerik AppBuilder Presentation for TelerikNEXT Conference
 
Ext JS Introduction
Ext JS IntroductionExt JS Introduction
Ext JS Introduction
 
Responsive WordPress workflow
Responsive WordPress workflowResponsive WordPress workflow
Responsive WordPress workflow
 
When Smalltalk Meets the Web
When Smalltalk Meets the WebWhen Smalltalk Meets the Web
When Smalltalk Meets the Web
 
Session 5#
Session 5#Session 5#
Session 5#
 
From Backbone to Ember and Back(bone) Again
From Backbone to Ember and Back(bone) AgainFrom Backbone to Ember and Back(bone) Again
From Backbone to Ember and Back(bone) Again
 
Build a video chat application with twilio, rails, and javascript (part 1)
Build a video chat application with twilio, rails, and javascript (part 1)Build a video chat application with twilio, rails, and javascript (part 1)
Build a video chat application with twilio, rails, and javascript (part 1)
 
Jacob Waller: Webifying Titanium Development
Jacob Waller: Webifying Titanium DevelopmentJacob Waller: Webifying Titanium Development
Jacob Waller: Webifying Titanium Development
 
Prototype UI Intro
Prototype UI IntroPrototype UI Intro
Prototype UI Intro
 
The Ring programming language version 1.9 book - Part 54 of 210
The Ring programming language version 1.9 book - Part 54 of 210The Ring programming language version 1.9 book - Part 54 of 210
The Ring programming language version 1.9 book - Part 54 of 210
 
Introducing PanelKit
Introducing PanelKitIntroducing PanelKit
Introducing PanelKit
 

Plus de Doc Norton

Tuckman Was Wrong
Tuckman Was WrongTuckman Was Wrong
Tuckman Was WrongDoc Norton
 
A Practical Guide to Cynefin
A Practical Guide to CynefinA Practical Guide to Cynefin
A Practical Guide to CynefinDoc Norton
 
Building Blocks of a Knowledge Work Culture - NDC London 2016
Building Blocks of a Knowledge Work Culture - NDC London 2016Building Blocks of a Knowledge Work Culture - NDC London 2016
Building Blocks of a Knowledge Work Culture - NDC London 2016Doc Norton
 
Codemash pre-compiler - Collaborative Decision Making
Codemash pre-compiler - Collaborative Decision MakingCodemash pre-compiler - Collaborative Decision Making
Codemash pre-compiler - Collaborative Decision MakingDoc Norton
 
Experimentation Mindset
Experimentation MindsetExperimentation Mindset
Experimentation MindsetDoc Norton
 
The Technical Debt Trap
The Technical Debt TrapThe Technical Debt Trap
The Technical Debt TrapDoc Norton
 
Switching horses midstream - From Waterfall to Agile
Switching horses midstream - From Waterfall to AgileSwitching horses midstream - From Waterfall to Agile
Switching horses midstream - From Waterfall to AgileDoc Norton
 
Autonomy, Connection, and Excellence; The Building Blocks of a DevOps Culture
Autonomy, Connection, and Excellence; The Building Blocks of a DevOps CultureAutonomy, Connection, and Excellence; The Building Blocks of a DevOps Culture
Autonomy, Connection, and Excellence; The Building Blocks of a DevOps CultureDoc Norton
 
Creative Collaboration: Tools for Teams
Creative Collaboration: Tools for TeamsCreative Collaboration: Tools for Teams
Creative Collaboration: Tools for TeamsDoc Norton
 
Experimentation mindset
Experimentation mindsetExperimentation mindset
Experimentation mindsetDoc Norton
 
The Technical Debt Trap - NDC Oslo 2014
The Technical Debt Trap - NDC Oslo 2014The Technical Debt Trap - NDC Oslo 2014
The Technical Debt Trap - NDC Oslo 2014Doc Norton
 
Agile Metrics : Velocity is NOT the Goal - NDC Oslo 2014
Agile Metrics : Velocity is NOT the Goal - NDC Oslo 2014Agile Metrics : Velocity is NOT the Goal - NDC Oslo 2014
Agile Metrics : Velocity is NOT the Goal - NDC Oslo 2014Doc Norton
 
Let's Start An Epidemic
Let's Start An EpidemicLet's Start An Epidemic
Let's Start An EpidemicDoc Norton
 
Teamwork Ain't Easy - RailsConf 2014
Teamwork Ain't Easy - RailsConf 2014Teamwork Ain't Easy - RailsConf 2014
Teamwork Ain't Easy - RailsConf 2014Doc Norton
 
Creating a Global Engineering Culture - Agile india 2014
Creating a Global Engineering Culture - Agile india 2014Creating a Global Engineering Culture - Agile india 2014
Creating a Global Engineering Culture - Agile india 2014Doc Norton
 
Doc That Conference Keynote
Doc That Conference KeynoteDoc That Conference Keynote
Doc That Conference KeynoteDoc Norton
 
Agile Metrics: Velocity is NOT the Goal - Agile 2013 version
Agile Metrics: Velocity is NOT the Goal - Agile 2013 versionAgile Metrics: Velocity is NOT the Goal - Agile 2013 version
Agile Metrics: Velocity is NOT the Goal - Agile 2013 versionDoc Norton
 
Agile Metrics; Velocity is NOT the Goal - ScrumGathering 2013
Agile Metrics; Velocity is NOT the Goal - ScrumGathering 2013Agile Metrics; Velocity is NOT the Goal - ScrumGathering 2013
Agile Metrics; Velocity is NOT the Goal - ScrumGathering 2013Doc Norton
 
Velocity is not the goal code palo-usa
Velocity is not the goal   code palo-usaVelocity is not the goal   code palo-usa
Velocity is not the goal code palo-usaDoc Norton
 
Teamwork Ain't Easy
Teamwork Ain't EasyTeamwork Ain't Easy
Teamwork Ain't EasyDoc Norton
 

Plus de Doc Norton (20)

Tuckman Was Wrong
Tuckman Was WrongTuckman Was Wrong
Tuckman Was Wrong
 
A Practical Guide to Cynefin
A Practical Guide to CynefinA Practical Guide to Cynefin
A Practical Guide to Cynefin
 
Building Blocks of a Knowledge Work Culture - NDC London 2016
Building Blocks of a Knowledge Work Culture - NDC London 2016Building Blocks of a Knowledge Work Culture - NDC London 2016
Building Blocks of a Knowledge Work Culture - NDC London 2016
 
Codemash pre-compiler - Collaborative Decision Making
Codemash pre-compiler - Collaborative Decision MakingCodemash pre-compiler - Collaborative Decision Making
Codemash pre-compiler - Collaborative Decision Making
 
Experimentation Mindset
Experimentation MindsetExperimentation Mindset
Experimentation Mindset
 
The Technical Debt Trap
The Technical Debt TrapThe Technical Debt Trap
The Technical Debt Trap
 
Switching horses midstream - From Waterfall to Agile
Switching horses midstream - From Waterfall to AgileSwitching horses midstream - From Waterfall to Agile
Switching horses midstream - From Waterfall to Agile
 
Autonomy, Connection, and Excellence; The Building Blocks of a DevOps Culture
Autonomy, Connection, and Excellence; The Building Blocks of a DevOps CultureAutonomy, Connection, and Excellence; The Building Blocks of a DevOps Culture
Autonomy, Connection, and Excellence; The Building Blocks of a DevOps Culture
 
Creative Collaboration: Tools for Teams
Creative Collaboration: Tools for TeamsCreative Collaboration: Tools for Teams
Creative Collaboration: Tools for Teams
 
Experimentation mindset
Experimentation mindsetExperimentation mindset
Experimentation mindset
 
The Technical Debt Trap - NDC Oslo 2014
The Technical Debt Trap - NDC Oslo 2014The Technical Debt Trap - NDC Oslo 2014
The Technical Debt Trap - NDC Oslo 2014
 
Agile Metrics : Velocity is NOT the Goal - NDC Oslo 2014
Agile Metrics : Velocity is NOT the Goal - NDC Oslo 2014Agile Metrics : Velocity is NOT the Goal - NDC Oslo 2014
Agile Metrics : Velocity is NOT the Goal - NDC Oslo 2014
 
Let's Start An Epidemic
Let's Start An EpidemicLet's Start An Epidemic
Let's Start An Epidemic
 
Teamwork Ain't Easy - RailsConf 2014
Teamwork Ain't Easy - RailsConf 2014Teamwork Ain't Easy - RailsConf 2014
Teamwork Ain't Easy - RailsConf 2014
 
Creating a Global Engineering Culture - Agile india 2014
Creating a Global Engineering Culture - Agile india 2014Creating a Global Engineering Culture - Agile india 2014
Creating a Global Engineering Culture - Agile india 2014
 
Doc That Conference Keynote
Doc That Conference KeynoteDoc That Conference Keynote
Doc That Conference Keynote
 
Agile Metrics: Velocity is NOT the Goal - Agile 2013 version
Agile Metrics: Velocity is NOT the Goal - Agile 2013 versionAgile Metrics: Velocity is NOT the Goal - Agile 2013 version
Agile Metrics: Velocity is NOT the Goal - Agile 2013 version
 
Agile Metrics; Velocity is NOT the Goal - ScrumGathering 2013
Agile Metrics; Velocity is NOT the Goal - ScrumGathering 2013Agile Metrics; Velocity is NOT the Goal - ScrumGathering 2013
Agile Metrics; Velocity is NOT the Goal - ScrumGathering 2013
 
Velocity is not the goal code palo-usa
Velocity is not the goal   code palo-usaVelocity is not the goal   code palo-usa
Velocity is not the goal code palo-usa
 
Teamwork Ain't Easy
Teamwork Ain't EasyTeamwork Ain't Easy
Teamwork Ain't Easy
 

Dernier

The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 

Dernier (20)

The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 

CodeStock :: Introduction To MacRuby and HotCocoa

  • 2. CodeStock
is
proudly
partnered
with: RecruitWise
and
Staff
with
Excellence
‐
www.recruitwise.jobs Send
instant
feedback
on
this
session
via
Twi?er: 



Send
a
direct
message
with
the
room
number
to
@CodeStock 



d codestock 503 This session is great! For
more
informa<on
on
sending
feedback
using
Twi>er
while
at
 CodeStock,
please
see
the
“CodeStock
README”
in
your
CodeStock
guide.
  • 3. Telerik Deliver More Than Expected @ Code Stock 2011. Check
out
our
NEW
Just
Decompile
Product
–
Powerful,
Free
Decompiler.
Forever. hDp://www.telerik.com/products/decompiling.aspx
 @telerik Contact
your
user
group
leader
for
a
$100
discount
off
your
next
Telerik
purchase!
  • 4. Introduction to MacRuby & HotCocoa Michael “Doc” Norton @DocOnDev http://www.docondev.com/ doc@leandog.com
  • 5. RubyCocoa • 2001 Written by Fujimoto Hisakuni • A bridge between objective C and Ruby • Bundled with Mac OSX 10.5 • Ugly (for Ruby)
  • 6. RubyCocoa Hello World require 'osx/cocoa'; include OSX app = NSApplication.sharedApplication win = NSWindow.alloc.initWithContentRect_styleMask_backing_defer( [0, 0, 200, 60], NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask, NSBackingStoreBuffered, false) win.title = 'Hello World' button = NSButton.alloc.initWithFrame(NSZeroRect) win.contentView.addSubview(button) button.bezelStyle = NSRoundedBezelStyle button.title = 'Hello!' button.sizeToFit button.frameOrigin = NSMakePoint((win.contentView.frameSize.width / 2.0) - (button.frameSize.width / 2.0), (win.contentView.frameSize.height / 2.0) - (button.frameSize.height / 2.0)) button_controller = Object.new def button_controller.sayHello(sender) puts "Hello World!" end button.target = button_controller button.action = 'sayHello:' win.display win.orderFrontRegardless app.run
  • 7. MacRuby • 2008 to replace RubyCocoa • Not a bridge • Run MUCH Faster • Still looks ugly
  • 8. MacRuby Hello World framework ‘Cocoa’ app = NSApplication.sharedApplication win = NSWindow.alloc.initWithContentRect([0, 0, 200, 60], styleMask:NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask, backing:NSBackingStoreBuffered, defer:false) win.title = 'Hello World' button = NSButton.alloc.initWithFrame(NSZeroRect) win.contentView.addSubview(button) button.bezelStyle = NSRoundedBezelStyle button.title = 'Hello!' button.sizeToFit button.frameOrigin = NSMakePoint((win.contentView.frameSize.width / 2.0) - (button.frameSize.width / 2.0), (win.contentView.frameSize.height / 2.0) - (button.frameSize.height / 2.0)) button_controller = Object.new def button_controller.sayHello(sender) puts "Hello World!" end button.target = button_controller button.action = 'sayHello:' win.display win.orderFrontRegardless app.run
  • 9. What is HotCocoa? • Ruby API • Looks and Feels like Ruby - YAY! • Simplifies use of Objective C/ Cocoa
  • 10. HotCocoa Hello World require ‘hotcocoa’; include HotCocoa app = NSApplication.sharedApplication win = NSWindow.alloc.initWithContentRect([0, 0, 200, 60], styleMask:NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask, backing:NSBackingStoreBuffered, defer:false) win.title = 'Hello World' button = NSButton.alloc.initWithFrame(NSZeroRect) win.contentView.addSubview(button) button.bezelStyle = NSRoundedBezelStyle button.title = 'Hello!' button.sizeToFit button.frameOrigin = NSMakePoint((win.contentView.frameSize.width / 2.0) - (button.frameSize.width / 2.0), (win.contentView.frameSize.height / 2.0) - (button.frameSize.height / 2.0)) button_controller = Object.new def button_controller.sayHello(sender) puts "Hello World!" end button.target = button_controller button.action = 'sayHello:' win.display win.orderFrontRegardless app.run
  • 11. HotCocoa Hello World require ‘hotcocoa’; include HotCocoa app = NSApplication.sharedApplication win = window :title => ‘hello world’, :frame => [0, 0, 200, 60] button = NSButton.alloc.initWithFrame(NSZeroRect) win.contentView.addSubview(button) button.bezelStyle = NSRoundedBezelStyle button.title = 'Hello!' button.sizeToFit button.frameOrigin = NSMakePoint((win.contentView.frameSize.width / 2.0) - (button.frameSize.width / 2.0), (win.contentView.frameSize.height / 2.0) - (button.frameSize.height / 2.0)) button_controller = Object.new def button_controller.sayHello(sender) puts "Hello World!" end button.target = button_controller button.action = 'sayHello:' win.display win.orderFrontRegardless app.run
  • 12. HotCocoa Hello World require ‘hotcocoa’; include HotCocoa app = NSApplication.sharedApplication win = window :title => ‘hello world’, :frame => [0, 0, 200, 60] b = button :title => ‘Hello!’, :layout => {:align => :center} win << b button_controller = Object.new def button_controller.sayHello(sender) puts "Hello World!" end button.target = button_controller button.action = 'sayHello:' win.display win.orderFrontRegardless app.run
  • 13. HotCocoa Hello World require ‘hotcocoa’; include HotCocoa app = NSApplication.sharedApplication win = window :title => ‘hello world’, :frame => [0, 0, 200, 60] b = button :title => ‘Hello!’, :layout => {:align => :center} win << b b.on_action { puts “Hello World!” } win.display win.orderFrontRegardless app.run
  • 14. HotCocoa Hello World require ‘hotcocoa’; include HotCocoa application do win = window :title => ‘hello world’, :frame => [0, 0, 200, 60] b = button :title => ‘Hello!’, :layout => {:align => :center} win << b b.on_action { puts “Hello World!” } end
  • 15. Getting Started • hotcocoa stock_schedule • cd stock_schedule • macrake
  • 16. What did we make? ./Rakefile ./Stock Schedule.app/ ./config/build.yml ./lib/application.rb ./lib/menu.rb ./resources/HotCocoa.icns
  • 23. Window with no layout
  • 24. Window with no layout
  • 25. layout_view • :mode -> :horizontal, :vertical • options • :spacing • :expand -> :height, :width, [:height, :width] • :frame -> [:top, :right, :width, :height] • :padding • :size -> [:width, :height] • :left_ | :right_ | :top_ | :bottom_ • :padding • :align -> :left | :center | :right | :top • :left_ | :right_ | :top_ | :bottom_ | :bottom • :margin • :left_ | :right_ | :top_ | :bottom_ https://github.com/richkilmer/hotcocoa/blob/master/lib/hotcocoa/layout_view.rb
  • 26. Assign layout to window view
  • 27. Assign layout to window view
  • 29. Inject scrolling view with table
  • 30. Inject scrolling view with table
  • 32. Are we there yet?
  • 38. Get Data from the API
  • 39. Get Data from the API
  • 48. Are we there yet?
  • 49. Thank You! Michael “Doc” Norton @DocOnDev http://www.docondev.com/ doc@leandog.com

Notes de l'éditeur

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. Bridge\nTwo different Run-Times\nMessaging between Objective C and Ruby was slow\n
  7. Every Class, Object, and Method is an Objective-C Class, Object, Method\n
  8. \n
  9. \n
  10. \n
  11. Window is easy to define\n
  12. Button much easier to define\n
  13. Button much easier to define\n
  14. \n
  15. Be sure to use macrake, macirb, macgem, and macruby\n
  16. Notice StockSchedule.app is a directory\n
  17. Menu Names (Apple, File, Window, Help)\nHotKeys - &amp;#x201C;,&amp;#x201D; indicates command+, :: modifiers is explicit\n:apple is special and appears in menu under app name\n
  18. \n
  19. I don&amp;#x2019;t want it absolutely placed, I want it centered.\n
  20. Change frame to size and tell it to center the window\n
  21. Change frame to size and tell it to center the window\n
  22. This is what we are after.\nOur window will be an invisible container with inserted (nested) views.\n
  23. \n
  24. \n
  25. Building block of presentations\n
  26. and inject filter layout\n
  27. and inject filter layout\n
  28. \n
  29. \n
  30. \n
  31. \n
  32. Let&amp;#x2019;s see if we can split the column in the table\n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. No, but much closer.\nWasn&amp;#x2019;t sure about date format and ran out of time. (sorry)\nActually didn&amp;#x2019;t do the drop-downs due to multiple API calls for demo.\n
  49. \n