SlideShare uma empresa Scribd logo
1 de 2
Baixar para ler offline
Programming Ruby
Keith Alcock, TCS Member
tcs@keithalcock.com

Ruby is an open source, cross-platform, object-oriented programming language
especially suitable for, but not limited to, scripting tasks. This book, known as the
PickAxe for its cover illustration, could easily guide an aspiring programmer to mastery
of that first programming language. At the same time it provides an experienced
programmer with nearly every language detail short of the interpreter’s source code.
The book has enabled me to satisfy a yearly resolution to learn a new programming
language and has done so in record time.

Ruby shares with Objective-C a quality seldom found in current popular programming
languages: substantial Smalltalk influence. Along with a minor amount of Smalltalk
syntax, Ruby borrows many design ideas such as dynamic typing, internal iterators,
blocks, and an object-oriented representation of even “primitive” data types. It melds
these with a more popular C-style syntax, especially for control flow and argument
passing, to achieve what its practitioners must consider the best of both (and maybe all)
worlds. Objective-C is more schizophrenic, including all the syntax of C in addition to
Smalltalk constructs offset by brackets. It requires little new syntax, just a mixing of old.
A simple example illustrates the comparison.

Smalltalk:
      1 to: 10 do: [ :index |
             self setTemperatureTo: 0.0 forHeaterIndex: index.
      ].

Ruby:
        (0..9).each do | index |
                self.set_temperature_to_for_heater_index(0.0,index)
        end

Objective-C:
       int index;
       for (index=0;index<10;index++)
               [ self setTemperatureTo: 0.0f forHeaterIndex: index ];

C:
        int index;
        for (index=0;index<10;index++)
                setTemperatureToForHeaterIndex(furnace,0.0f,index);

Programming Ruby is divided into four main sections: “Facets of Ruby” containing the
Ruby tutorial, “Ruby in Its Setting” explaining how to use Ruby for various tasks
including web integration and GUI development, “Ruby Crystallized” detailing language
specifics, and the “Ruby Library Reference” documenting the built-in classes and
modules as well as the standard library from Abbrev to Zlib. A fifth section provides
appendices and a comprehensive index. The book guides the reader from initial
installation on day one to extending Ruby with C just before graduation, and then
provides a comprehensive reference section just in case anything gets forgotten. It’s a
book that won’t be confined to a shelf, but will find an important place opened on a
desk.

In covering a topic, the author does an excellent job illuminating the big picture along
with the details. For example, not only is iteration explained, but also the iterator; not
only coercion, but double dispatch; not only classes, but types and dynamic typing; not
only debugging, but unit testing. Ruby variables are flagged with $, @, or @@ to
indicate scope (global, instance, class), which is enforced by the interpreter, but it is
also useful to know that Ruby programmers use two spaces for indentation, which is
only enforced by the community, as are variable and class naming conventions.
Inclusion of this information ensures that Ruby programmers start off on the right foot
and needn’t unlearn frowned upon habits. Not everything is so serious, though. A fair
amount of subtle humor is presented and I actually appreciated being associated with
the “hippie-freak dynamic typing crowd” as the author fondly calls it.

Nothing is perfect, of course, and the book could be improved in some ways. A
prominent and comprehensive class hierarchy diagram is lacking. Many methods
accept a single, unnamed, optional block argument, but I missed a discussion of how to
best handle cases when two blocks are required. Programmers are renowned for their
insistent use of unnecessary abbreviations and the book contains examples such as
hsh for hash, prc for proc for procedure, and thr for thread. Some documented methods
return strange values which leave you wanting a more complete explanation. Two such
examples are float.infinite? and stat.size? which would normally return Booleans but
don’t. These are obviously very minor details.

So why should you learn a new programming language this year (or every year)?
According to the Pragmatic Programmers (one being author of this book), you can
“broaden your thinking and avoid getting stuck in a rut.” Ruby is filled with good ideas
including some not yet mentioned like safe levels, freezing objects, and in place or
immediate operations. If one isn’t planning to use the language directly, but simply
borrow its ideas, many can be applied to other languages. I added a Range class to my
Smalltalk library, for instance, based on examples in this book. I highly recommend it.

Title: Programming Ruby
Author: Dave Thomas
Publisher: Pragmatic Bookshelf
Distributor: O’Reilly Media, Inc.
Pages: 862
Price: US $44.95
ISBN: 0-9745140-5-5
Website: http://www.pragmaticprogrammer.com/title/ruby

Mais conteúdo relacionado

Mais procurados

Ruby Introduction
Ruby IntroductionRuby Introduction
Ruby Introduction
Prabu D
 

Mais procurados (18)

PROGRAMMING LANGUAGES
PROGRAMMING LANGUAGESPROGRAMMING LANGUAGES
PROGRAMMING LANGUAGES
 
Ruby Introduction
Ruby IntroductionRuby Introduction
Ruby Introduction
 
Computer Programming Overview
Computer Programming OverviewComputer Programming Overview
Computer Programming Overview
 
Go programing language
Go programing languageGo programing language
Go programing language
 
Evolution of Programming Languages
Evolution of Programming LanguagesEvolution of Programming Languages
Evolution of Programming Languages
 
Introduction to programing languages part 1
Introduction to programing languages   part 1Introduction to programing languages   part 1
Introduction to programing languages part 1
 
C#
C#C#
C#
 
Daniele Esposti - Evolution or stagnation programming languages - Codemotion ...
Daniele Esposti - Evolution or stagnation programming languages - Codemotion ...Daniele Esposti - Evolution or stagnation programming languages - Codemotion ...
Daniele Esposti - Evolution or stagnation programming languages - Codemotion ...
 
Daniele Esposti - Evolution or stagnation programming languages - Codemotion ...
Daniele Esposti - Evolution or stagnation programming languages - Codemotion ...Daniele Esposti - Evolution or stagnation programming languages - Codemotion ...
Daniele Esposti - Evolution or stagnation programming languages - Codemotion ...
 
Programming language
Programming languageProgramming language
Programming language
 
Introduction to programming languages part 1
Introduction to programming languages   part 1Introduction to programming languages   part 1
Introduction to programming languages part 1
 
Lets Go - An introduction to Google's Go Programming Language
Lets Go - An introduction to Google's Go Programming Language Lets Go - An introduction to Google's Go Programming Language
Lets Go - An introduction to Google's Go Programming Language
 
Programming paradigm
Programming paradigmProgramming paradigm
Programming paradigm
 
Go Language presentation
Go Language presentationGo Language presentation
Go Language presentation
 
Programming Languages
Programming LanguagesProgramming Languages
Programming Languages
 
Imperative programming
Imperative programmingImperative programming
Imperative programming
 
Groovy as a Dynamic Language
Groovy as a Dynamic LanguageGroovy as a Dynamic Language
Groovy as a Dynamic Language
 
Web programming UNIT II by Bhavsingh Maloth
Web programming UNIT II by Bhavsingh MalothWeb programming UNIT II by Bhavsingh Maloth
Web programming UNIT II by Bhavsingh Maloth
 

Semelhante a Ruby

Page List & Sample Material (Repaired)
Page List & Sample Material (Repaired)Page List & Sample Material (Repaired)
Page List & Sample Material (Repaired)
Muhammad Haseeb Shahid
 
ruby_vs_perl_and_python
ruby_vs_perl_and_pythonruby_vs_perl_and_python
ruby_vs_perl_and_python
tutorialsruby
 
ruby_vs_perl_and_python
ruby_vs_perl_and_pythonruby_vs_perl_and_python
ruby_vs_perl_and_python
tutorialsruby
 
On the path to become a jr. developer short version
On the path to become a jr. developer short versionOn the path to become a jr. developer short version
On the path to become a jr. developer short version
Antonelo Schoepf
 
A Strong Object Recognition Using Lbp, Ltp And Rlbp
A Strong Object Recognition Using Lbp, Ltp And RlbpA Strong Object Recognition Using Lbp, Ltp And Rlbp
A Strong Object Recognition Using Lbp, Ltp And Rlbp
Rikki Wright
 
Intro To Ror
Intro To RorIntro To Ror
Intro To Ror
myuser
 
Workin ontherailsroad
Workin ontherailsroadWorkin ontherailsroad
Workin ontherailsroad
Jim Jones
 
WorkinOnTheRailsRoad
WorkinOnTheRailsRoadWorkinOnTheRailsRoad
WorkinOnTheRailsRoad
webuploader
 
Design patterns in_c_sharp
Design patterns in_c_sharpDesign patterns in_c_sharp
Design patterns in_c_sharp
Cao Tuan
 

Semelhante a Ruby (20)

Page List & Sample Material (Repaired)
Page List & Sample Material (Repaired)Page List & Sample Material (Repaired)
Page List & Sample Material (Repaired)
 
ruby_vs_perl_and_python
ruby_vs_perl_and_pythonruby_vs_perl_and_python
ruby_vs_perl_and_python
 
ruby_vs_perl_and_python
ruby_vs_perl_and_pythonruby_vs_perl_and_python
ruby_vs_perl_and_python
 
ROR basics
ROR basicsROR basics
ROR basics
 
Languages used by web app development services remotestac x
Languages used by web app development services  remotestac xLanguages used by web app development services  remotestac x
Languages used by web app development services remotestac x
 
Ruby on Rails Introduction M&P - IT Skill Development Program 07
Ruby on Rails Introduction M&P - IT Skill Development Program 07Ruby on Rails Introduction M&P - IT Skill Development Program 07
Ruby on Rails Introduction M&P - IT Skill Development Program 07
 
On the path to become a jr. developer short version
On the path to become a jr. developer short versionOn the path to become a jr. developer short version
On the path to become a jr. developer short version
 
C++ book
C++ bookC++ book
C++ book
 
C++programing
C++programingC++programing
C++programing
 
C++programing
C++programingC++programing
C++programing
 
Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1
 
C# and java comparing programming languages
C# and java  comparing programming languagesC# and java  comparing programming languages
C# and java comparing programming languages
 
A Strong Object Recognition Using Lbp, Ltp And Rlbp
A Strong Object Recognition Using Lbp, Ltp And RlbpA Strong Object Recognition Using Lbp, Ltp And Rlbp
A Strong Object Recognition Using Lbp, Ltp And Rlbp
 
A Slice Of Rust - A quick look at the Rust programming language
A Slice Of Rust - A quick look at the Rust programming languageA Slice Of Rust - A quick look at the Rust programming language
A Slice Of Rust - A quick look at the Rust programming language
 
Objc
ObjcObjc
Objc
 
Intro To Ror
Intro To RorIntro To Ror
Intro To Ror
 
ruby pentest
ruby pentestruby pentest
ruby pentest
 
Workin ontherailsroad
Workin ontherailsroadWorkin ontherailsroad
Workin ontherailsroad
 
WorkinOnTheRailsRoad
WorkinOnTheRailsRoadWorkinOnTheRailsRoad
WorkinOnTheRailsRoad
 
Design patterns in_c_sharp
Design patterns in_c_sharpDesign patterns in_c_sharp
Design patterns in_c_sharp
 

Mais de tutorialsruby

&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
tutorialsruby
 
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
tutorialsruby
 
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
tutorialsruby
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
tutorialsruby
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
tutorialsruby
 
Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0
tutorialsruby
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
tutorialsruby
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
tutorialsruby
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008
tutorialsruby
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008
tutorialsruby
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheets
tutorialsruby
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheets
tutorialsruby
 

Mais de tutorialsruby (20)

&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
 
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0
 
xhtml_basics
xhtml_basicsxhtml_basics
xhtml_basics
 
xhtml_basics
xhtml_basicsxhtml_basics
xhtml_basics
 
xhtml-documentation
xhtml-documentationxhtml-documentation
xhtml-documentation
 
xhtml-documentation
xhtml-documentationxhtml-documentation
xhtml-documentation
 
CSS
CSSCSS
CSS
 
CSS
CSSCSS
CSS
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
 
HowTo_CSS
HowTo_CSSHowTo_CSS
HowTo_CSS
 
HowTo_CSS
HowTo_CSSHowTo_CSS
HowTo_CSS
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheets
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheets
 

Último

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Último (20)

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
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
 
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
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
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?
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
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
 
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
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
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...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
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
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
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...
 

Ruby

  • 1. Programming Ruby Keith Alcock, TCS Member tcs@keithalcock.com Ruby is an open source, cross-platform, object-oriented programming language especially suitable for, but not limited to, scripting tasks. This book, known as the PickAxe for its cover illustration, could easily guide an aspiring programmer to mastery of that first programming language. At the same time it provides an experienced programmer with nearly every language detail short of the interpreter’s source code. The book has enabled me to satisfy a yearly resolution to learn a new programming language and has done so in record time. Ruby shares with Objective-C a quality seldom found in current popular programming languages: substantial Smalltalk influence. Along with a minor amount of Smalltalk syntax, Ruby borrows many design ideas such as dynamic typing, internal iterators, blocks, and an object-oriented representation of even “primitive” data types. It melds these with a more popular C-style syntax, especially for control flow and argument passing, to achieve what its practitioners must consider the best of both (and maybe all) worlds. Objective-C is more schizophrenic, including all the syntax of C in addition to Smalltalk constructs offset by brackets. It requires little new syntax, just a mixing of old. A simple example illustrates the comparison. Smalltalk: 1 to: 10 do: [ :index | self setTemperatureTo: 0.0 forHeaterIndex: index. ]. Ruby: (0..9).each do | index | self.set_temperature_to_for_heater_index(0.0,index) end Objective-C: int index; for (index=0;index<10;index++) [ self setTemperatureTo: 0.0f forHeaterIndex: index ]; C: int index; for (index=0;index<10;index++) setTemperatureToForHeaterIndex(furnace,0.0f,index); Programming Ruby is divided into four main sections: “Facets of Ruby” containing the Ruby tutorial, “Ruby in Its Setting” explaining how to use Ruby for various tasks including web integration and GUI development, “Ruby Crystallized” detailing language specifics, and the “Ruby Library Reference” documenting the built-in classes and
  • 2. modules as well as the standard library from Abbrev to Zlib. A fifth section provides appendices and a comprehensive index. The book guides the reader from initial installation on day one to extending Ruby with C just before graduation, and then provides a comprehensive reference section just in case anything gets forgotten. It’s a book that won’t be confined to a shelf, but will find an important place opened on a desk. In covering a topic, the author does an excellent job illuminating the big picture along with the details. For example, not only is iteration explained, but also the iterator; not only coercion, but double dispatch; not only classes, but types and dynamic typing; not only debugging, but unit testing. Ruby variables are flagged with $, @, or @@ to indicate scope (global, instance, class), which is enforced by the interpreter, but it is also useful to know that Ruby programmers use two spaces for indentation, which is only enforced by the community, as are variable and class naming conventions. Inclusion of this information ensures that Ruby programmers start off on the right foot and needn’t unlearn frowned upon habits. Not everything is so serious, though. A fair amount of subtle humor is presented and I actually appreciated being associated with the “hippie-freak dynamic typing crowd” as the author fondly calls it. Nothing is perfect, of course, and the book could be improved in some ways. A prominent and comprehensive class hierarchy diagram is lacking. Many methods accept a single, unnamed, optional block argument, but I missed a discussion of how to best handle cases when two blocks are required. Programmers are renowned for their insistent use of unnecessary abbreviations and the book contains examples such as hsh for hash, prc for proc for procedure, and thr for thread. Some documented methods return strange values which leave you wanting a more complete explanation. Two such examples are float.infinite? and stat.size? which would normally return Booleans but don’t. These are obviously very minor details. So why should you learn a new programming language this year (or every year)? According to the Pragmatic Programmers (one being author of this book), you can “broaden your thinking and avoid getting stuck in a rut.” Ruby is filled with good ideas including some not yet mentioned like safe levels, freezing objects, and in place or immediate operations. If one isn’t planning to use the language directly, but simply borrow its ideas, many can be applied to other languages. I added a Range class to my Smalltalk library, for instance, based on examples in this book. I highly recommend it. Title: Programming Ruby Author: Dave Thomas Publisher: Pragmatic Bookshelf Distributor: O’Reilly Media, Inc. Pages: 862 Price: US $44.95 ISBN: 0-9745140-5-5 Website: http://www.pragmaticprogrammer.com/title/ruby