SlideShare une entreprise Scribd logo
1  sur  18
Top 10+ Things
 Every .NET Developer
Should Know About Ruby

       Jeff Cohen
       @jeffcohen
jeff@purpleworkshops.com
Windy City Rails
 Sept. 12, 2009

      Essential Javascript
         Oct. 17, 2009

            Rails for Everyone
              Oct. 24, 2009
Top 10+ Things
 Every .NET Developer
Should Know About Ruby
1. History & Philosophy

SmallTalk    C++   Ruby   Java VB6     C#
 1983       Perl   1993   1995 1996   2000
            1989
1. History & Philosophy



Yukihiro Matsumoto
     "Matz"
1. History & Philosophy

2003 Interview with Matz:
http://www.artima.com/intv/ruby.html

Minimal Interface vs. Humane Interface

What You Feel > What You Can Do

Sapir-Whorff Hypothesis
2. irb


 "Immediate Mode"
for Ruby developers
3. Conventions
MyClass

methods_are_in_lowercase

methods_can_be_questions?

some_methods_have_consequences!

methods_can_set_a_value=

@instance_variable

MY_CONSTANT or MyConstant or MyClass
4. Objects

Everything is an object

A class is an object

No "primitives."

You can pass classes around like objects

Easy reflection/introspection
5. Messages

Think in Messages, not Methods

"hello".length

"hello".send(:length)

All message handlers (ok, fine: "methods")
return a value to the calling code
6. Blocks

Extremely Common Ruby Idiom

Most Seen in Iterators

Anoymous Methods

Can Be Saved For Later Use (lambda)
7. It's Just a Script


No compilation

A class "declaration" is code that's executing!
8. Dynamic Typing

The type of an object is deduced at runtime

Open Classes

Object-Specific Type (enables Singleton Methods)

Strongly Typed even though not Statically Typed

IntelliSense is hard to do
In Case You Rant At Me
About The Lack of Intellisense
   It rots your mind:
   http://www.charlespetzold.com/etc/
   DoesVisualStudioRotTheMind.html

   It forces bottom-up design

   It forces linear programming, not free-form
   experimentation

   It discourages Test-Driven Development

   It's a sign that your API is TOO FREAKING BIG
9. OOP

Use Modules to Mix-In Behavior

Don't Worry About Interfaces

Duck Typing

No Abstract Classes
10. Metaprogramming
method_missing

Add methods and attributes at run time

Can do prototype-style programming

Rails gained fame by intelligent usage of
metaprogramming techniques
11. Even More...

Ruby Class Methods vs. .NET Static Methods

begin/rescue/ensure vs. try/catch/finally

String interpolation

Other new things: symbols, lambdas, closures

No method overloading
C'mon in - the water's fine!

  Rails for Everyone
    Oct. 24, 2009
       $395.00
   purpleworkshops.com

Contenu connexe

Tendances

Code analyzer: FindBugs and PMD
Code analyzer: FindBugs and PMDCode analyzer: FindBugs and PMD
Code analyzer: FindBugs and PMDKan-Han (John) Lu
 
Java Interview Questions - 1
Java Interview Questions - 1Java Interview Questions - 1
Java Interview Questions - 1zynofustechnology
 
What are the benefits of reactive programming in java
What are the benefits of reactive programming in java What are the benefits of reactive programming in java
What are the benefits of reactive programming in java Dmytro Melnychuk
 
Live Typing - California Smalltalkers
Live Typing - California SmalltalkersLive Typing - California Smalltalkers
Live Typing - California SmalltalkersHernan Wilkinson
 
Intro To Ror
Intro To RorIntro To Ror
Intro To Rormyuser
 
How to not suck at JavaScript
How to not suck at JavaScriptHow to not suck at JavaScript
How to not suck at JavaScripttmont
 
Ruby on Rails: a brief introduction
Ruby on Rails: a brief introductionRuby on Rails: a brief introduction
Ruby on Rails: a brief introductionLuigi De Russis
 
Metaprogramming in Ruby
Metaprogramming in RubyMetaprogramming in Ruby
Metaprogramming in Rubyjonromero
 
What is-pmd
What is-pmdWhat is-pmd
What is-pmd3trg
 
Day1 - TDD (Lecture SS 2015)
Day1 - TDD (Lecture SS 2015)Day1 - TDD (Lecture SS 2015)
Day1 - TDD (Lecture SS 2015)wolframkriesing
 
Basics of Metaprogramming in Ruby
Basics of Metaprogramming in RubyBasics of Metaprogramming in Ruby
Basics of Metaprogramming in RubyDigital Natives
 

Tendances (18)

Ruby memory model
Ruby memory modelRuby memory model
Ruby memory model
 
Ruby
RubyRuby
Ruby
 
Code analyzer: FindBugs and PMD
Code analyzer: FindBugs and PMDCode analyzer: FindBugs and PMD
Code analyzer: FindBugs and PMD
 
Java Interview Questions-5
Java Interview Questions-5Java Interview Questions-5
Java Interview Questions-5
 
Moving to PHP from Java
Moving to PHP from JavaMoving to PHP from Java
Moving to PHP from Java
 
Java Interview Questions - 1
Java Interview Questions - 1Java Interview Questions - 1
Java Interview Questions - 1
 
Twins: OOP and FP
Twins: OOP and FPTwins: OOP and FP
Twins: OOP and FP
 
What are the benefits of reactive programming in java
What are the benefits of reactive programming in java What are the benefits of reactive programming in java
What are the benefits of reactive programming in java
 
Live Typing - California Smalltalkers
Live Typing - California SmalltalkersLive Typing - California Smalltalkers
Live Typing - California Smalltalkers
 
Intro To Ror
Intro To RorIntro To Ror
Intro To Ror
 
How to not suck at JavaScript
How to not suck at JavaScriptHow to not suck at JavaScript
How to not suck at JavaScript
 
Ruby on Rails: a brief introduction
Ruby on Rails: a brief introductionRuby on Rails: a brief introduction
Ruby on Rails: a brief introduction
 
Java presentation
Java presentation Java presentation
Java presentation
 
Metaprogramming in Ruby
Metaprogramming in RubyMetaprogramming in Ruby
Metaprogramming in Ruby
 
What is-pmd
What is-pmdWhat is-pmd
What is-pmd
 
Day1 - TDD (Lecture SS 2015)
Day1 - TDD (Lecture SS 2015)Day1 - TDD (Lecture SS 2015)
Day1 - TDD (Lecture SS 2015)
 
Basics of Metaprogramming in Ruby
Basics of Metaprogramming in RubyBasics of Metaprogramming in Ruby
Basics of Metaprogramming in Ruby
 
TypeScript - An Introduction
TypeScript - An IntroductionTypeScript - An Introduction
TypeScript - An Introduction
 

Similaire à Top 10+ Things .NET Developers Should Know About Ruby

Ruby on Rails - An overview
Ruby on Rails -  An overviewRuby on Rails -  An overview
Ruby on Rails - An overviewThomas Asikis
 
Ruby tutorial
Ruby tutorialRuby tutorial
Ruby tutorialknoppix
 
Ruby for C#-ers (ScanDevConf 2010)
Ruby for C#-ers (ScanDevConf 2010)Ruby for C#-ers (ScanDevConf 2010)
Ruby for C#-ers (ScanDevConf 2010)Thomas Lundström
 
Ruby On Rails Overview
Ruby On Rails OverviewRuby On Rails Overview
Ruby On Rails Overviewjonkinney
 
Rubyonrails 120409061835-phpapp02
Rubyonrails 120409061835-phpapp02Rubyonrails 120409061835-phpapp02
Rubyonrails 120409061835-phpapp02sagaroceanic11
 
Golang #5: To Go or not to Go
Golang #5: To Go or not to GoGolang #5: To Go or not to Go
Golang #5: To Go or not to GoOliver N
 
Tech breakfast 18
Tech breakfast 18Tech breakfast 18
Tech breakfast 18James Leone
 
Concurrent Programming with Ruby and Tuple Spaces
Concurrent Programming with Ruby and Tuple SpacesConcurrent Programming with Ruby and Tuple Spaces
Concurrent Programming with Ruby and Tuple Spacesluccastera
 
Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Mark Menard
 
It's OK to make a new folder within Rails.
It's OK to make a new folder within Rails.It's OK to make a new folder within Rails.
It's OK to make a new folder within Rails.cschaafsma
 
Exploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLExploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLBarry Jones
 
Java - A broad introduction
Java - A broad introductionJava - A broad introduction
Java - A broad introductionBirol Efe
 

Similaire à Top 10+ Things .NET Developers Should Know About Ruby (20)

Why Ruby?
Why Ruby? Why Ruby?
Why Ruby?
 
Ruby on Rails - An overview
Ruby on Rails -  An overviewRuby on Rails -  An overview
Ruby on Rails - An overview
 
All of Javascript
All of JavascriptAll of Javascript
All of Javascript
 
Ruby
RubyRuby
Ruby
 
Ruby tutorial
Ruby tutorialRuby tutorial
Ruby tutorial
 
Ruby for C#-ers (ScanDevConf 2010)
Ruby for C#-ers (ScanDevConf 2010)Ruby for C#-ers (ScanDevConf 2010)
Ruby for C#-ers (ScanDevConf 2010)
 
Ruby On Rails Overview
Ruby On Rails OverviewRuby On Rails Overview
Ruby On Rails Overview
 
All of javascript
All of javascriptAll of javascript
All of javascript
 
Rubyonrails 120409061835-phpapp02
Rubyonrails 120409061835-phpapp02Rubyonrails 120409061835-phpapp02
Rubyonrails 120409061835-phpapp02
 
Golang #5: To Go or not to Go
Golang #5: To Go or not to GoGolang #5: To Go or not to Go
Golang #5: To Go or not to Go
 
Tech breakfast 18
Tech breakfast 18Tech breakfast 18
Tech breakfast 18
 
Ruby on Rails 3 Day BC
Ruby on Rails 3 Day BCRuby on Rails 3 Day BC
Ruby on Rails 3 Day BC
 
IronRuby
IronRubyIronRuby
IronRuby
 
Concurrent Programming with Ruby and Tuple Spaces
Concurrent Programming with Ruby and Tuple SpacesConcurrent Programming with Ruby and Tuple Spaces
Concurrent Programming with Ruby and Tuple Spaces
 
Ruby Hell Yeah
Ruby Hell YeahRuby Hell Yeah
Ruby Hell Yeah
 
Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1
 
It's OK to make a new folder within Rails.
It's OK to make a new folder within Rails.It's OK to make a new folder within Rails.
It's OK to make a new folder within Rails.
 
Exploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLExploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQL
 
The Joy Of Ruby
The Joy Of RubyThe Joy Of Ruby
The Joy Of Ruby
 
Java - A broad introduction
Java - A broad introductionJava - A broad introduction
Java - A broad introduction
 

Dernier

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 

Dernier (20)

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 

Top 10+ Things .NET Developers Should Know About Ruby

  • 1. Top 10+ Things Every .NET Developer Should Know About Ruby Jeff Cohen @jeffcohen jeff@purpleworkshops.com
  • 2. Windy City Rails Sept. 12, 2009 Essential Javascript Oct. 17, 2009 Rails for Everyone Oct. 24, 2009
  • 3. Top 10+ Things Every .NET Developer Should Know About Ruby
  • 4. 1. History & Philosophy SmallTalk C++ Ruby Java VB6 C# 1983 Perl 1993 1995 1996 2000 1989
  • 5. 1. History & Philosophy Yukihiro Matsumoto "Matz"
  • 6. 1. History & Philosophy 2003 Interview with Matz: http://www.artima.com/intv/ruby.html Minimal Interface vs. Humane Interface What You Feel > What You Can Do Sapir-Whorff Hypothesis
  • 7. 2. irb "Immediate Mode" for Ruby developers
  • 9. 4. Objects Everything is an object A class is an object No "primitives." You can pass classes around like objects Easy reflection/introspection
  • 10. 5. Messages Think in Messages, not Methods "hello".length "hello".send(:length) All message handlers (ok, fine: "methods") return a value to the calling code
  • 11. 6. Blocks Extremely Common Ruby Idiom Most Seen in Iterators Anoymous Methods Can Be Saved For Later Use (lambda)
  • 12. 7. It's Just a Script No compilation A class "declaration" is code that's executing!
  • 13. 8. Dynamic Typing The type of an object is deduced at runtime Open Classes Object-Specific Type (enables Singleton Methods) Strongly Typed even though not Statically Typed IntelliSense is hard to do
  • 14. In Case You Rant At Me About The Lack of Intellisense It rots your mind: http://www.charlespetzold.com/etc/ DoesVisualStudioRotTheMind.html It forces bottom-up design It forces linear programming, not free-form experimentation It discourages Test-Driven Development It's a sign that your API is TOO FREAKING BIG
  • 15. 9. OOP Use Modules to Mix-In Behavior Don't Worry About Interfaces Duck Typing No Abstract Classes
  • 16. 10. Metaprogramming method_missing Add methods and attributes at run time Can do prototype-style programming Rails gained fame by intelligent usage of metaprogramming techniques
  • 17. 11. Even More... Ruby Class Methods vs. .NET Static Methods begin/rescue/ensure vs. try/catch/finally String interpolation Other new things: symbols, lambdas, closures No method overloading
  • 18. C'mon in - the water's fine! Rails for Everyone Oct. 24, 2009 $395.00 purpleworkshops.com

Notes de l'éditeur

  1. Class.new => Object Factory 1.class obj.nil? hello.methods.sort