SlideShare a Scribd company logo
Corey Haines, Journeyman Developer




                                                       Ruby
                                                         It really is Love




Saturday, May 30, 2009
About




Saturday, May 30, 2009
Not About


                         Convincing You To Use Ruby




Saturday, May 30, 2009
About


                         Things I love in Ruby
                                         duck-typing
                                        open classes
                         (almost) everything is executable ruby code




Saturday, May 30, 2009
Should You Learn Ruby?




Saturday, May 30, 2009
Corey Haines
                             Journeyman
                              Developer

                          That’s Me!




                            www.coreyhaines.com

                           coreyhaines@gmail.com

Saturday, May 30, 2009
On To Ruby




Saturday, May 30, 2009
“...trying to make Ruby
                         natural, not simple.”
                                - Yukihiro Matsumoto
                                                        “Matz”




                                    image courtesy Jim Lindley on flickr




Saturday, May 30, 2009
Qualities


                          Simple Syntax
                         Object-Oriented
                           Duck-Typing
                             Blocks
                          Open Classes


Saturday, May 30, 2009
Qualities


                          Simple Syntax
                         Object-Oriented
                           Duck-Typing
                             Blocks
                          Open Classes


Saturday, May 30, 2009
Initializers



                 arr = [1, 6, 2, 3, 5]

                 arr2 = [“Element”, “Another one”]

                 lookup = { :ruby => “love”,
                            :c_sharp => “good too”,
                            :python => “cool” }




Saturday, May 30, 2009
Classes
                 class Rectangle
                  attr_accessor :width, :height

                    def initialize(width, height)
                     self.width = width
                     self.height = height
                    end

                  def area
                   width * height
                  end
                 end




Saturday, May 30, 2009
>> r = Rectangle.new(5, 20)
               => #<Rectangle:0x3691d8 @width=5, @height=20>
               >> r.area
               => 100




Saturday, May 30, 2009
Qualities


                          Simple Syntax
                         Object-Oriented
                           Duck-Typing
                             Blocks
                          Open Classes


Saturday, May 30, 2009
Everything is an object


                         >> 9.succ
                         => 10
                         >> 9.nil?
                         => false
                         >> 9.between? 8, 10
                         => true
                         >> 9.class
                         => Fixnum




Saturday, May 30, 2009
No Really

                         >> 9.succ
                         => 10
                         >> 9.nil?
                         => false
                         >> 9.between? 8, 10
                         => true                    Wha?
                         >> 9.class
                         => Fixnum
                         >> Fixnum.class
                         => Class




Saturday, May 30, 2009
Ever written something like this?


             public void MakeItQuack<T>(T quacker)
             where T : ICanQuack
             {
               quacker.Quack();
             }




Saturday, May 30, 2009
Really Wanted



           public void MakeItQuack<T>(T quacker)
           where T can quack
           {
             quacker.quack();
           }




Saturday, May 30, 2009
Qualities


                          Simple Syntax
                         Object-Oriented
                           Duck-Typing
                             Blocks
                          Open Classes


Saturday, May 30, 2009
No, not that kind




Saturday, May 30, 2009
Duck-Typing




                                   Walks like a duck
                                   Quacks like a duck
                                   Must be a duck?




Saturday, May 30, 2009
Well, no



                         But, we can interact with it like a duck!


                         And Pretend!




Saturday, May 30, 2009
def make_it_quack(quacker)
                          quacker.quack();
                         end




Saturday, May 30, 2009
Type != Class




                         Behavior/Interaction-Orientation




Saturday, May 30, 2009
Qualities


                          Simple Syntax
                         Object-Oriented
                           Duck-Typing
                             Blocks
                          Open Classes


Saturday, May 30, 2009
Blocks

                         a = [5, 7, 10, 24]

                         a.each do |num|
                          puts num
                         end

                         b = a.map do |num|
                          num * 2
                         end

                         puts b.inspect




Saturday, May 30, 2009
Accepting Blocks

                   def five_times
                    yield 1
                    yield 2
                    yield 3
                    yield 4
                    yield 5
                   end

                   five_times do |num|
                     puts num
                   end




Saturday, May 30, 2009
Accepting Blocks

         def five_times(&block)
          block.call(1)
          block.call(2)
          block.call(3)
          block.call(4)
          block.call(5)
         end

         five_times do |num|
           puts num
         end




Saturday, May 30, 2009
Qualities


                          Simple Syntax
                         Object-Oriented
                           Duck-Typing
                             Blocks
                          Open Classes


Saturday, May 30, 2009
Open Classes




                         Say goodbye to sealed/virtual/override/argh




Saturday, May 30, 2009
def convert(to_convert)
               return nil if to_convert.nil?
               return to_convert if to_convert.empty?
               do_conversion(to_convert)
             end




Saturday, May 30, 2009
As You Wish




                         class NilClass
                            def empty?
                              true
                            end
                         end




Saturday, May 30, 2009
def convert(to_convert)
                           return to_convert if to_convert.empty?
                           do_conversion(to_convert)
                         end




Saturday, May 30, 2009
Setting Time




                         current_time = 17




Saturday, May 30, 2009
write the code you wish you had


                                 current_time = 5.pm




Saturday, May 30, 2009
Then get it working



                            class Fixnum
                             def pm
                              self + 12
                             end
                            end




Saturday, May 30, 2009
Type != Class (redux)




                         a = “coreyhaines@gmail.com;me@coreyhaines.com”




Saturday, May 30, 2009
Type != Class (redux redux)

                         a = “coreyhaines@gmail.com;me@coreyhaines.com”
                         a.extend(EmailAddressList)


                         puts a.email_addresses.inspect


                         a.each_address do |address|
                         Mailer.send_email_to(address)
                         end




Saturday, May 30, 2009
Remember

                         With great power comes great responsibility




Saturday, May 30, 2009
Qualities


                          Simple Syntax
                         Object-Oriented
                           Duck-Typing
                             Blocks
                          Open Classes


Saturday, May 30, 2009
Qualities

                         Awesomeness!
                             Simple Syntax
                            Object-Oriented
                              Duck-Typing
                                Blocks
                             Open Classes


Saturday, May 30, 2009
Method Missing




Saturday, May 30, 2009
Examples




                         Builder




Saturday, May 30, 2009
Mixins




Saturday, May 30, 2009
Type != Class




Saturday, May 30, 2009
Examples




                         Email Addresses




Saturday, May 30, 2009
defining methods




Saturday, May 30, 2009
Examples




                         Email Addresses




Saturday, May 30, 2009

More Related Content

Recently uploaded

Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website
Pixlogix Infotech
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
ThomasParaiso2
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 

Recently uploaded (20)

Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 

Featured

Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
Christy Abraham Joy
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
Vit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
MindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools
 

Featured (20)

Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 

Intro To Ruby

  • 1. Corey Haines, Journeyman Developer Ruby It really is Love Saturday, May 30, 2009
  • 3. Not About Convincing You To Use Ruby Saturday, May 30, 2009
  • 4. About Things I love in Ruby duck-typing open classes (almost) everything is executable ruby code Saturday, May 30, 2009
  • 5. Should You Learn Ruby? Saturday, May 30, 2009
  • 6. Corey Haines Journeyman Developer That’s Me! www.coreyhaines.com coreyhaines@gmail.com Saturday, May 30, 2009
  • 7. On To Ruby Saturday, May 30, 2009
  • 8. “...trying to make Ruby natural, not simple.” - Yukihiro Matsumoto “Matz” image courtesy Jim Lindley on flickr Saturday, May 30, 2009
  • 9. Qualities Simple Syntax Object-Oriented Duck-Typing Blocks Open Classes Saturday, May 30, 2009
  • 10. Qualities Simple Syntax Object-Oriented Duck-Typing Blocks Open Classes Saturday, May 30, 2009
  • 11. Initializers arr = [1, 6, 2, 3, 5] arr2 = [“Element”, “Another one”] lookup = { :ruby => “love”, :c_sharp => “good too”, :python => “cool” } Saturday, May 30, 2009
  • 12. Classes class Rectangle attr_accessor :width, :height def initialize(width, height) self.width = width self.height = height end def area width * height end end Saturday, May 30, 2009
  • 13. >> r = Rectangle.new(5, 20) => #<Rectangle:0x3691d8 @width=5, @height=20> >> r.area => 100 Saturday, May 30, 2009
  • 14. Qualities Simple Syntax Object-Oriented Duck-Typing Blocks Open Classes Saturday, May 30, 2009
  • 15. Everything is an object >> 9.succ => 10 >> 9.nil? => false >> 9.between? 8, 10 => true >> 9.class => Fixnum Saturday, May 30, 2009
  • 16. No Really >> 9.succ => 10 >> 9.nil? => false >> 9.between? 8, 10 => true Wha? >> 9.class => Fixnum >> Fixnum.class => Class Saturday, May 30, 2009
  • 17. Ever written something like this? public void MakeItQuack<T>(T quacker) where T : ICanQuack { quacker.Quack(); } Saturday, May 30, 2009
  • 18. Really Wanted public void MakeItQuack<T>(T quacker) where T can quack { quacker.quack(); } Saturday, May 30, 2009
  • 19. Qualities Simple Syntax Object-Oriented Duck-Typing Blocks Open Classes Saturday, May 30, 2009
  • 20. No, not that kind Saturday, May 30, 2009
  • 21. Duck-Typing Walks like a duck Quacks like a duck Must be a duck? Saturday, May 30, 2009
  • 22. Well, no But, we can interact with it like a duck! And Pretend! Saturday, May 30, 2009
  • 23. def make_it_quack(quacker) quacker.quack(); end Saturday, May 30, 2009
  • 24. Type != Class Behavior/Interaction-Orientation Saturday, May 30, 2009
  • 25. Qualities Simple Syntax Object-Oriented Duck-Typing Blocks Open Classes Saturday, May 30, 2009
  • 26. Blocks a = [5, 7, 10, 24] a.each do |num| puts num end b = a.map do |num| num * 2 end puts b.inspect Saturday, May 30, 2009
  • 27. Accepting Blocks def five_times yield 1 yield 2 yield 3 yield 4 yield 5 end five_times do |num| puts num end Saturday, May 30, 2009
  • 28. Accepting Blocks def five_times(&block) block.call(1) block.call(2) block.call(3) block.call(4) block.call(5) end five_times do |num| puts num end Saturday, May 30, 2009
  • 29. Qualities Simple Syntax Object-Oriented Duck-Typing Blocks Open Classes Saturday, May 30, 2009
  • 30. Open Classes Say goodbye to sealed/virtual/override/argh Saturday, May 30, 2009
  • 31. def convert(to_convert) return nil if to_convert.nil? return to_convert if to_convert.empty? do_conversion(to_convert) end Saturday, May 30, 2009
  • 32. As You Wish class NilClass def empty? true end end Saturday, May 30, 2009
  • 33. def convert(to_convert) return to_convert if to_convert.empty? do_conversion(to_convert) end Saturday, May 30, 2009
  • 34. Setting Time current_time = 17 Saturday, May 30, 2009
  • 35. write the code you wish you had current_time = 5.pm Saturday, May 30, 2009
  • 36. Then get it working class Fixnum def pm self + 12 end end Saturday, May 30, 2009
  • 37. Type != Class (redux) a = “coreyhaines@gmail.com;me@coreyhaines.com” Saturday, May 30, 2009
  • 38. Type != Class (redux redux) a = “coreyhaines@gmail.com;me@coreyhaines.com” a.extend(EmailAddressList) puts a.email_addresses.inspect a.each_address do |address| Mailer.send_email_to(address) end Saturday, May 30, 2009
  • 39. Remember With great power comes great responsibility Saturday, May 30, 2009
  • 40. Qualities Simple Syntax Object-Oriented Duck-Typing Blocks Open Classes Saturday, May 30, 2009
  • 41. Qualities Awesomeness! Simple Syntax Object-Oriented Duck-Typing Blocks Open Classes Saturday, May 30, 2009
  • 43. Examples Builder Saturday, May 30, 2009
  • 45. Type != Class Saturday, May 30, 2009
  • 46. Examples Email Addresses Saturday, May 30, 2009
  • 48. Examples Email Addresses Saturday, May 30, 2009