Book description
How do you write truly elegant code with Ruby? Ruby Best Practices is for programmers who want to use Ruby as experienced Rubyists do. Written by the developer of the Ruby project Prawn, this concise book explains how to design beautiful APIs and domain-specific languages with Ruby, as well as how to work with functional programming ideas and techniques that can simplify your code and make you more productive. You'll learn how to write code that's readable, expressive, and much more.
Ruby Best Practices will help you:
- Understand the secret powers unlocked by Ruby's code blocks
- Learn how to bend Ruby code without breaking it, such as mixing in modules on the fly
- Discover the ins and outs of testing and debugging, and how to design for testability
- Learn to write faster code by keeping things simple
- Develop strategies for text processing and file management, including regular expressions
- Understand how and why things can go wrong
- Reduce cultural barriers by leveraging Ruby's multilingual capabilities
This book also offers you comprehensive chapters on driving code through tests, designing APIs, and project maintenance. Learn how to make the most of this rich, beautiful language with Ruby Best Practices.
Publisher resources
Table of contents
-
Ruby Best Practices
- SPECIAL OFFER: Upgrade this ebook with O’Reilly
- Foreword
- Preface
- 1. Driving Code Through Tests
- 2. Designing Beautiful APIs
- 3. Mastering the Dynamic Toolkit
- 4. Text Processing and File Management
- 5. Functional Programming Techniques
- 6. When Things Go Wrong
- 7. Reducing Cultural Barriers
- 8. Skillful Project Maintenance
- A. Writing Backward-Compatible Code
-
B. Leveraging Ruby’s Standard Library
- Why Do We Need a Standard Library?
- Pretty-Printer for Ruby Objects (pp)
- Working with HTTP and FTP (open-uri)
- Working with Dates and Times (date)
- Lexical Parsing with Regular Expressions (strscan)
- Cryptographic Hash Functions (digest)
- Mathematical Ruby Scripts (mathn)
- Working with Tabular Data (csv)
- Transactional Filesystem-Based Data Storage (pstore)
- Human-Readable Data Serialization (json)
- Embedded Ruby for Code Generation (erb)
- Conclusions
- C. Ruby Worst Practices
- Index
- About the Author
- Colophon
- SPECIAL OFFER: Upgrade this ebook with O’Reilly
Product information
- Title: Ruby Best Practices
- Author(s):
- Release date: June 2009
- Publisher(s): O'Reilly Media, Inc.
- ISBN: 9780596555818
You might also like
book
Ruby by Example
There may be no better way to learn how to program than by dissecting real, representative …
book
Refactoring in Ruby
The First Hands-On, Practical, All-Ruby Refactoring Workbook! Refactoring–the art of improving the design of existing code–has …
book
Service-Oriented Design with Ruby and Rails
The Complete Guide to Building Highly Scalable, Services-Based Rails Applications Ruby on Rails deployments are growing, …
book
Mastering Ruby Closures
The road to Ruby mastery is paved with blocks, procs, and lambdas. To be a truly …