Effective Ruby: 48 Specific Ways to Write Better Ruby

Author:   Peter Jones
Publisher:   Pearson Education (US)
ISBN:  

9780133846973


Pages:   240
Publication Date:   25 September 2014
Format:   Paperback
Availability:   In Print   Availability explained
This item will be ordered in for you from one of our suppliers. Upon receipt, we will promptly dispatch it out to you. For in store availability, please contact us.

Our Price $49.95 Quantity:  
Add to Cart

Share |

Effective Ruby: 48 Specific Ways to Write Better Ruby


Add your own review!

Overview

Full Product Details

Author:   Peter Jones
Publisher:   Pearson Education (US)
Imprint:   Addison Wesley
Dimensions:   Width: 18.00cm , Height: 1.30cm , Length: 23.20cm
Weight:   0.456kg
ISBN:  

9780133846973


ISBN 10:   0133846970
Pages:   240
Publication Date:   25 September 2014
Audience:   Professional and scholarly ,  Professional & Vocational
Format:   Paperback
Publisher's Status:   Active
Availability:   In Print   Availability explained
This item will be ordered in for you from one of our suppliers. Upon receipt, we will promptly dispatch it out to you. For in store availability, please contact us.

Table of Contents

Foreword xi Preface xiii Acknowledgments xvii About the Author xix Chapter 1: Accustoming Yourself to Ruby 1 Item 1: Understand What Ruby Considers to Be True 1 Item 2: Treat All Objects as If They Could Be nil 3 Item 3: Avoid Ruby's Cryptic Perlisms 6 Item 4: Be Aware That Constants Are Mutable 9 Item 5: Pay Attention to Run-Time Warnings 12 Chapter 2: Classes, Objects, and Modules 17 Item 6: Know How Ruby Builds Inheritance Hierarchies 17 Item 7: Be Aware of the Different Behaviors of super 24 Item 8: Invoke super When Initializing Subclasses 28 Item 9: Be Alert for Ruby's Most Vexing Parse 31 Item 10: Prefer Struct to Hash for Structured Data 35 Item 11: Create Namespaces by Nesting Code in Modules 38 Item 12: Understand the Different Flavors of Equality 43 Item 13: Implement Comparison via <=> and the Comparable Module 49 Item 14: Share Private State through Protected Methods 53 Item 15: Prefer Class Instance Variables to Class Variables 55 Chapter 3: Collections 59 Item 16: Duplicate Collections Passed as Arguments before Mutating Them 59 Item 17: Use the Array Method to Convert nil and Scalar Objects into Arrays 63 Item 18: Consider Set for Efficient Element Inclusion Checking 66 Item 19: Know How to Fold Collections with reduce 70 Item 20: Consider Using a Default Hash Value 74 Item 21: Prefer Delegation to Inheriting from Collection Classes 79 Chapter 4: Exceptions 85 Item 22: Prefer Custom Exceptions to Raising Strings 85 Item 23: Rescue the Most Specific Exception Possible 90 Item 24: Manage Resources with Blocks and ensure 94 Item 25: Exit ensure Clauses by Flowing Off the End 97 Item 26: Bound retry Attempts, Vary Their Frequency, and Keep an Audit Trail 100 Item 27: Prefer throw to raise for Jumping Out of Scope 104 Chapter 5: Metaprogramming 107 Item 28: Familiarize Yourself with Module and Class Hooks 107 Item 29: Invoke super from within Class Hooks 114 Item 30: Prefer define_method to method_missing 115 Item 31: Know the Difference between the Variants of eval 122 Item 32: Consider Alternatives to Monkey Patching 127 Item 33: Invoke Modified Methods with Alias Chaining 133 Item 34: Consider Supporting Differences in Proc Arity 136 Item 35: Think Carefully Before Using Module Prepending 141 Chapter 6: Testing 145 Item 36: Familiarize Yourself with MiniTest Unit Testing 145 Item 37: Familiarize Yourself with MiniTest Spec Testing 149 Item 38: Simulate Determinism with Mock Objects 152 Item 39: Strive for Effectively Tested Code 156 Chapter 7: Tools and Libraries 163 Item 40: Know How to Work with Ruby Documentation 163 Item 41: Be Aware of IRB's Advanced Features 166 Item 42: Manage Gem Dependencies with Bundler 170 Item 43: Specify an Upper Bound for Gem Dependencies 175 Chapter 8: Memory Management and Performance 179 Item 44: Familiarize Yourself with Ruby's Garbage Collector 179 Item 45: Create Resource Safety Nets with Finalizers 185 Item 46: Be Aware of Ruby Profiling Tools 189 Item 47: Avoid Object Literals in Loops 195 Item 48: Consider Memoizing Expensive Computations 197 Epilogue 201 Index 203

Reviews

This book is quite unlike any other Ruby book, and in a couple hundred pages, I imagine anyone who reads this-novice or expert-will emerge a better Ruby programmer. -From the Foreword by Mitchell Hashimoto, founder and CEO of HashiCorp, creator of Vagrant


This book is quite unlike any other Ruby book, and in a couple hundred pages, I imagine anyone who reads this-novice or expert-will emerge a better Ruby programmer. -From the Foreword by Mitchell Hashimoto, founder and CEO of HashiCorp, creator of Vagrant


This book is quite unlike any other Ruby book, and in a couple hundred pages, I imagine anyone who reads this--novice or expert--will emerge a better Ruby programmer. --From the Foreword by Mitchell Hashimoto, founder and CEO of HashiCorp, creator of Vagrant


Author Information

Peter J. Jones is a freelance software developer and a senior instructor for programming workshops taught by Devalot.com. He has been programming in Ruby since 2005, and has written and taught several development workshops, including an 11-week Ruby class for beginners.

Tab Content 6

Author Website:  

Customer Reviews

Recent Reviews

No review item found!

Add your own review!

Countries Available

All regions
Latest Reading Guide

ls

Shopping Cart
Your cart is empty
Shopping cart
Mailing List