Chapter 14. Libraries

Any Ruby application will use libraries—be it the core or standard libraries, or third-party gems downloaded from RubyForge or a similar repository.

Libraries sometimes put us in a dilemma: We want the library to be different, and yet we don’t want to change it. Even when it’s possible to change a library, that can carry risk because it could affect other clients, and it could mean we would have to redo our changes for future versions of the library.

Sometimes, library code is a bit smelly in order that client code doesn’t have to be. Micah Martin points out that a library that is so factored it has lots of public classes and no smells can be harder to use; it’s helpful if the library makes a narrow, easy-to-use interface ...

Get Refactoring in Ruby now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.