O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Effective Ruby

Video Description

4+ Hours of Video Training


Effective Ruby LiveLessons Video Training explains the tips, tricks, and best practices used by the most proficient Rubyists. The series is based on Effective Ruby, the book written by Peter Jones for the Effective Software Development Series. Each lesson contains a set of items designed to provide expert guidance on what to do and what to avoid when writing Ruby. Hands-on demonstrations help the viewer understand how to put each item into action.


Each of the video’s five lessons includes items centered on a key topic. The video starts with items focused on how to make effective use of arrays and hashes before moving on to lessons that teach viewers how to improve their objects by creating seams between them and how to write excellent tests for their Ruby applications. Next, the training teaches viewers how to solve problems associated with enumerables and callables, and finally how to best make use of the standard library. After watching this video, Rubyists will have gained the knowledge necessary to really master the language; viewers will be able to immediately apply the advice, tips, and tricks learned to the Ruby programs they’re writing to improve the quality of their code.

Related Files

The companion files for this LiveLesson can be downloaded from https://github.com/samphippen/efrll.

About the Instructor

Sam Phippen has been writing software for more than seven years. Sam has spent the last four years building Ruby and Ruby on Rails applications. He routinely gives conference talks about software design and testing and currently serves the Ruby community as a member of the RSpec core team. Sam regularly contributes to Open Source Ruby applications and works as a consultant at Fun and Plausible Solutions. Mostly, Sam helps his clients with software design and improving the quality of the applications that they are building. He loves refactoring sticky rails applications and uses a number of principles of object oriented design to ensure that the software he works on will be maintainable far into the future.

Skill Level

  • Intermediate
  • Advanced

What You Will Learn

  • How to write Ruby code that will be easier to change in the future
  • How to make better use of the standard library and Ruby language features for greater productivity
  • How to make better and faster technical decisions through the development of a “reference frame”

Who Should Take This Course

  • Professional Ruby or Rails developers with 1 5 years of experience

Course Requirements

  • Familiarity with the fundamentals of Ruby syntax
  • Some experience coding Ruby professionally

Table of Contents

Lesson 1: Arrays and Hashes

In the first lesson you learn some of the more advanced ways to use Ruby’s built-in collection classes to simplify your applications, as well as some of the common pitfalls associated with using these objects.

Lesson 2: Seams

In Lesson 2, you learn ways to decouple objects in your system. You also discover some standards and practices used by expert Ruby developers for creating seams between objects.

Lesson 3: Testing

In Lesson 3, you learn some of the easiest ways to improve your tests, and how to improve the design of your system through the use of well-structured tests.

Lesson 4: Enumerables and Callables

Lesson 4 teaches you how to use enumerables and callable to simply express powerful concepts built on standard Ruby APIs.

Lesson 5: The Standard Library

In Lesson 5 you thoroughly explore the Ruby standard library and learn how to use the library to improve your writing of applications.

About LiveLessons Video Training

The LiveLessons Video Training series publishes hundreds of hands-on, expert-led video tutorials covering a wide selection of technology topics designed to teach you the skills you need to succeed. This professional and personal technology video series features world-leading author instructors published by your trusted technology brands: Addison-Wesley, Cisco Press, IBM Press, Pearson IT Certification, Prentice Hall, Sams, and Que. Topics include: IT Certification, Programming, Web Development, Mobile Development, Home and Office Technologies, Business and Management, and more. View all LiveLessons on InformIT at: http://www.informit.com/livelessons.

Table of Contents

  1. Introduction
    1. Effective Ruby LiveLessons: Introduction 00:04:13
  2. Lesson 1: Arrays and Hashes
    1. Learning Objectives 00:00:47
    2. Item 1 Duplicate collections you receive as arguments 00:08:09
    3. Item 2 Use Set for efficient presence checks 00:07:36
    4. Item 3 Consider using a default hash value 00:06:09
    5. Item 4 Use Hash#fetch over Hash#[] 00:07:54
    6. Item 5 Prefer decorating collections 00:12:58
  3. Lesson 2: Seams
    1. Learning Objectives 00:00:43
    2. Item 6 Avoid using class variables 00:06:30
    3. Item 7 Avoid using class methods 00:05:56
    4. Item 8 Obey the Law of Demeter 00:07:17
    5. Item 9 Prefer methods over instance variables 00:05:46
    6. Item 10 Prefer methods over constants 00:04:10
    7. Item 11 Use the === protocol for matching tasks 00:06:29
  4. Lesson 3: Testing
    1. Learning Objectives 00:00:45
    2. Item 12 Use only one assertion or expectation per test 00:06:57
    3. Item 13 Order your tests with the arrange, act, and assert pattern 00:08:49
    4. Item 14 Run your tests in a random order 00:05:07
    5. Item 15 Prefer spies to mocks or stubs 00:12:10
    6. Item 16 Use Rack::Test for integration testing 00:07:55
  5. Lesson 4: Enumerables and Callables
    1. Learning Objectives 00:00:57
    2. Item 17 Prefer enumerable methods 00:00:56
    3. Item 17.1 Use zip and each_with_index 00:10:59
    4. Item 17.2 Use each_slice and each_con 00:08:50
    5. Item 17.3 Use partition, select, and find 00:17:54
    6. Item 17.4 Use group_by, reduce, and each_with_object 00:16:15
    7. Item 17.5 Implement your own enumerable 00:04:46
    8. Item 18 Prefer lambda instead of proc 00:08:23
    9. Item 19 Use Symbol#to_proc where appropriate 00:04:02
    10. Item 20 Use #method to pass instance methods as callables 00:04:42
    11. Item 21 Use {} for blocks that return and do..end for blocks that mutate 00:07:00
  6. Lesson 5: The Standard Library
    1. Learning Objectives 00:00:40
    2. Item 22 Use block forms for IO 00:04:45
    3. Item 23 Understand the difference between Time, DateTime, and Date 00:06:40
    4. Item 24 Do HTTP requests with Net::HTTP 00:06:58
    5. Item 25 Prefer file methods over manual path manipulation 00:01:32
    6. Item 25.1 Use #absolute_path, #dirname, and __FILE__ to be OS independent 00:05:27
    7. Item 25.2 Use File.extname to determine file type 00:03:51
    8. Item 25.3 Use File.join to build file paths safely 00:03:45
  7. Summary
    1. Effective Ruby LiveLessons: Summary 00:02:04