Слайд 2
![10. Too young](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-1.jpg)
Слайд 3
![No Libraries A collection of good libraries, especially in something](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-2.jpg)
No Libraries
A collection of good libraries, especially in something like Perl’s
CPAN, means less work to achieve better results, faster
Ruby libraries:
96 standard libraries
Ruby Application Archive (RAA) catalogs over 1,200 applications and libraries
RubyForge is hosting over 800 open source projects
RubyGems has served over 900,000 gems
Слайд 4
![No support Documentation Core 100% documented Standard library documentation in](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-3.jpg)
No support
Documentation
Core 100% documented
Standard library documentation in progress
Tutorials available for various
skill levels
Facets of Ruby book series
Community
Mailing lists in multiple languages
Usenet groups (with ML gateway)
Web forums
Слайд 5
![No one using it Companies using Ruby HP, Intel, NASA,](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-4.jpg)
No one using it
Companies using Ruby
HP, Intel, NASA, and NOAA
Uses for
Ruby
Simulation, data munging, code generation, image processing, prototyping, and more
“Killer app”
Ruby on Rails
Already being used in profitable web applications like Basecamp and Blinksale
Слайд 6
![10. Too young Ahead of its time!](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-5.jpg)
10. Too young
Ahead of its time!
Слайд 7
![9. Useless in obfuscation contests](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-6.jpg)
9. Useless in obfuscation contests
Слайд 8
![Optional Syntax No ;s needed Drop the “\n” characters Optional ()s](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-7.jpg)
Optional Syntax
No ;s needed
Drop the “\n” characters
Optional ()s
Слайд 9
![Objectified Syntax obj.attribute = methods dangerous! and query? methods](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-8.jpg)
Objectified Syntax
obj.attribute = methods
dangerous! and query? methods
Слайд 10
![Simple, flexible syntax Simple declarations: local_var = ... @instance_var =](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-9.jpg)
Simple, flexible syntax
Simple declarations:
local_var = ...
@instance_var = ...
$global_var = ...
do...end or {...}
Real exception handling, like Java
String interpolation: any Ruby code inside #{...}
Слайд 11
![Compare with other languages Ruby: puts “Hello world!” Java: threeVeryLongLines.weHopeWork... Perl: #$ Lisp: ((a(((b)))(c)))](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-10.jpg)
Compare with other languages
Ruby: puts “Hello world!”
Java: threeVeryLongLines.weHopeWork...
Perl: #$Lisp: ((a(((b)))(c)))
Слайд 12
![9. Useless in obfuscation contests Clean syntax!](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-11.jpg)
9. Useless in obfuscation contests
Clean syntax!
Слайд 13
![8. Object Oriented](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-12.jpg)
Слайд 14
![Ruby is object oriented Everything is an object Numbers, code](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-13.jpg)
Ruby is object oriented
Everything is an object
Numbers, code blocks, everything
Baked-in, not
bolted-on
No need to use “self” everywhere, like Python
Слайд 15
![Ruby has many object orientation shortcuts Automatic constructor generation, unlike](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-14.jpg)
Ruby has many object orientation shortcuts
Automatic constructor generation, unlike Perl
Easy accessors
Define
methods to interact with Core Ruby
Слайд 16
![Procedural code allowed You can ignore the class system as](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-15.jpg)
Procedural code allowed
You can ignore the class system as needed
You can
even mix and match objects with procedural code
Слайд 17
![8. Object Oriented Too flexible!](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-16.jpg)
8. Object Oriented
Too flexible!
Слайд 18
![7. Uses “Mix-ins”](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-17.jpg)
Слайд 19
![You can’t win with multiple inheritance Multiple inheritance allows a](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-18.jpg)
You can’t win with multiple inheritance
Multiple inheritance allows a class to
inherit from more than one parent
The good: Makes modeling complex object trees easier
The bad: The diamond inheritance problem
You can’t please both sides
Слайд 20
![Ruby uses single inheritance...](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-19.jpg)
Ruby uses single inheritance...
Слайд 21
![...and “Mix-ins” Similar to Java’s interfaces, plus implementation No limit](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-20.jpg)
...and “Mix-ins”
Similar to Java’s interfaces, plus implementation
No limit to how many
you use
The benefits of multiple inheritance, without the minuses
Слайд 22
![7. Uses “Mix-ins” Makes too much sense!](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-21.jpg)
7. Uses “Mix-ins”
Makes too much sense!
Слайд 23
![6. No loops](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-22.jpg)
Слайд 24
![The well-known loops](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-23.jpg)
Слайд 25
![Aren’t loops proven to work by now? “N + 1”](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-24.jpg)
Aren’t loops proven to work by now?
“N + 1” errors
foreach {
... } is conceptually backwards
Objects should manage their own traversal
Слайд 26
![Iterators Objects manage their own traversal No more “N +](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-25.jpg)
Iterators
Objects manage their own traversal
No more “N + 1” errors
Code blocks
still allow customizing behavior
Слайд 27
![6. No loops Rebellious!](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-26.jpg)
Слайд 28
![5. Code blocks everywhere](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-27.jpg)
5. Code blocks everywhere
Слайд 29
![What is a code block? Any method can accept a](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-28.jpg)
What is a code block?
Any method can accept a block
Blocks can
be called immediately or stored for later use
Blocks are closures
Слайд 30
![What are they for? Blocks can allow your code to](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-29.jpg)
What are they for?
Blocks can allow your code to react in
according to user code
Blocks are a great way to pass around behavior
Blocks are ideal for transactions
Слайд 31
![5. Code blocks everywhere Too powerful!](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-30.jpg)
5. Code blocks everywhere
Too powerful!
Слайд 32
![4. Wide open, even at runtime](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-31.jpg)
4. Wide open, even at runtime
Слайд 33
![Dynamic tools Strong reflection eval() instance_eval() class_eval() and module_eval() Hooks for runtime events](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-32.jpg)
Dynamic tools
Strong reflection
eval()
instance_eval()
class_eval() and module_eval()
Hooks for runtime events
Слайд 34
![Classes are open Add methods to a class at any](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-33.jpg)
Classes are open
Add methods to a class at any time
Even a
core class
Customize individual objects
Overload operators
Hook into Ruby’s math and conversion operations
Слайд 35
![4. Wide open, even at runtime Lawless!](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-34.jpg)
4. Wide open, even at runtime
Lawless!
Слайд 36
![3. Ruby gurus are obsessed with ducks](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-35.jpg)
3. Ruby gurus are obsessed with ducks
Слайд 37
![“If it walks like a duck and talks like a duck, it’s a duck!”](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-36.jpg)
“If it walks like a duck and talks like a duck,
it’s a duck!”
Слайд 38
![The “Duck Typing” philosophy We define an object by what](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-37.jpg)
The “Duck Typing” philosophy
We define an object by what it can
do, not its type
Most of the time, you shouldn’t even check for methods
Слайд 39
![3. Ruby gurus are obsessed with ducks Too strange!](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-38.jpg)
3. Ruby gurus are obsessed with ducks
Too strange!
Слайд 40
![2. Includes too many great toys](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-39.jpg)
2. Includes too many great toys
Слайд 41
![96 standard libraries](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-40.jpg)
Слайд 42
![2. Includes too many great toys Too distracting!](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/597338/slide-41.jpg)
2. Includes too many great toys
Too distracting!