About This Title

Pages: 102
Published: May 2011
ISBN: 9781937785512
In Print

Exceptional Ruby

Master the Art of Handling Failure in Ruby

by Avdi Grimm

Writing code that works is hard. Writing code that handles unexpected errors and still works is really hard. Most of us learn by trial and error. This short book removes the uncertainty. With over 100 pages of content and dozens of working examples, you’ll learn everything from the mechanics of how exceptions work to how to design a robust failure management architecture for your app or library. Whether you are a Ruby novice or a seasoned veteran, Exceptional Ruby will help you write cleaner, more resilient Ruby code.


This work was written and produced entirely by the author. We are proud to be distributing it.

eBook Formats:

  • PDF for desktop/tablets

  • epub for Apple Books, e-readers

  • mobi for Kindle readers

Get all eBook formats here for $15.00 (USD)

Add to Cart we accept visa, mastercard, amex, discover, paypal


Paperback Formats:

Please support indie bookstores!
Find indie bookstores in the U.S. Find indie bookstores around the world.


Inside this electronic-only book, you’ll find:

  • A detailed look at the lifecycle of a Ruby exception.
  • Overriding Kernel#raise for fun and profit.
  • Alternatives to exceptions, for when “fail fast” isn’t the right answer.
  • How to write a crash logger.
  • Advanced dynamic exception matching in rescue clauses.
  • Avoiding failure cascades with the Barricade and Circuit Breaker patterns.
  • Five questions to ask before raising an exception.
  • Exception safety testing for critical methods.
  • How to create an error API for your library that will make other developers want to kiss you.
  • The three exception classes every app or library needs.
  • And much, much more… over 100 pages of tips, guidelines, and awesome hacks!

This book, available in PDF, mobi, and ePub formats, was entirely written and produced by the author. We are proud to be distributing it.

What You Need

Resources

Releases:

  • P1.0 2011/07/11

Contents & Extracts

  • About
  • Acknowledgements
  • Introduction
  • What is a failure?
    • Definitions
    • Failure as a breach of contract
    • Reasons for failure
  • The life-cycle of an exception
    • It all starts with a raise (or a fail)
    • Calling raise
    • Overriding raise for fun and profit
    • raise internals
    • ensure
    • Coming to the rescue
    • If at first you don’t succeed, retry, retry again
    • raise during exception handling
    • else
    • Uncaught exceptions
    • Exceptions in threads
    • Are Ruby exceptions slow?
  • Responding to failures
    • Failure flags and benign values
    • Reporting failure to the console
    • Remote failure reporting
    • Ending the program
  • Alternatives to exceptions
    • Sidebanddata
    • Multiple return values
    • Output parameters
    • Caller-supplied fallback strategy
    • Global variables
    • Process reification
    • Beyond exceptions
  • Your failure handling strategy
    • Exceptions shouldn’t be expected
    • A rule of thumb for raising
    • Use throw for expected cases
    • What constitutes an exceptional case?
    • Caller-supplied fallback strategy
    • Some questions before raising
    • Isolateexceptionhandlingcode
    • Exception Safety
    • Be specific when eating exceptions
    • Namespace your own exceptions
    • Taggingexceptionswithmodules
    • The no-raise library API
    • Three essential exception classes
  • Conclusion
  • References
  • Appendix A: Exception tester implementation
  • Appendix B: An incomplete tour of ruby’s standard exceptions

Author

My name is Avdi Grimm. I’ve been hacking on Ruby code for 10 years, and I’m still loving it! I’ve spoken at numerous Ruby conferences and user groups, and I write about Ruby gotchas, guidelines, and style (among other things) at my blog, Virtuous Code. I run ShipRise, a consultancy specializing in sustainable software development and facilitating geographically dispersed agile teams. I live in York County, Pennsylvania with my wife and four children.

eBook Formats:

  • PDF for desktop/tablets

  • epub for Apple Books, e-readers

  • mobi for Kindle readers

Get all eBook formats here for $15.00 (USD)

Add to Cart we accept visa, mastercard, amex, discover, paypal


Paperback Formats:

Please support indie bookstores!
Find indie bookstores in the U.S. Find indie bookstores around the world.

Related Titles:

About This Title

Pages: 102
Published: May 2011
ISBN: 9781937785512
Edition: 1
In Print