Effective Ruby: 48 Specific Ways to Write Better Ruby (Paperback)

Peter J. Jones

買這商品的人也買了...

商品描述

If you’re an experienced Ruby programmer, Effective Ruby will help you harness Ruby’s full power to write more robust, efficient, maintainable, and well-performing code. Drawing on nearly a decade of Ruby experience, Peter J. Jones brings together 48 Ruby best practices, expert tips, and shortcuts—all supported by realistic code examples.

 

Jones offers practical advice for each major area of Ruby development, from modules to memory to metaprogramming. Throughout, he uncovers little-known idioms, quirks, pitfalls, and intricacies that powerfully impact code behavior and performance.

Each item contains specific, actionable, clearly organized guidelines; careful advice; detailed technical arguments; and illuminating code examples. When multiple options exist, Jones shows you how to choose the one that will work best in your situation.

 

Effective Ruby will help you systematically improve your code—not by blindly following rules, but by thoroughly understanding Ruby programming techniques.

 

Key features of this concise guide include

  • How to avoid pitfalls associated with Ruby’s sometimes surprising idiosyncrasies
  • What you should know about inheritance hierarchies to successfully use Rails (and other large frameworks)
  • How to use misunderstood methods to do amazingly useful things with collections
  • Better ways to use exceptions to improve code reliability
  • Powerful metaprogramming approaches (and techniques to avoid)
  • Practical, efficient testing solutions, including MiniTest Unit and Spec Testing
  • How to reliably manage RubyGem dependencies
  • How to make the most of Ruby’s memory management and profiling tools
  • How to improve code efficiency by understanding the Ruby interpreter’s internals

商品描述(中文翻譯)

如果你是一位有經驗的Ruby程式設計師,《Effective Ruby》將幫助你充分利用Ruby的優勢,撰寫更強大、高效、易於維護和高效執行的程式碼。彼得·J·瓊斯(Peter J. Jones)根據近十年的Ruby經驗,匯集了48個Ruby最佳實踐、專家技巧和捷徑,並提供了實際的程式碼示例來支持這些內容。

瓊斯為Ruby開發的每個主要領域提供了實用的建議,從模組到記憶體再到元程式設計。在整個過程中,他揭示了影響程式碼行為和性能的鮮為人知的慣用語法、怪癖、陷阱和細節。

每個項目都包含具體、可行、清晰組織的指南;細心的建議;詳細的技術論證;以及啟發性的程式碼示例。當存在多個選項時,瓊斯會向你展示如何選擇在你的情況下最適合的選項。

《Effective Ruby》將幫助你系統地改進你的程式碼,不是盲目遵循規則,而是深入理解Ruby程式設計技巧。

這本簡明指南的主要特點包括:

- 如何避免與Ruby有時令人驚訝的特殊性相關的陷阱
- 關於繼承層次結構的知識,以成功使用Rails(和其他大型框架)
- 如何使用被誤解的方法在集合中執行非常有用的操作
- 更好地使用例外處理來提高程式碼的可靠性
- 強大的元程式設計方法(以及應避免的技巧)
- 實用、高效的測試解決方案,包括MiniTest Unit和Spec Testing
- 如何可靠地管理RubyGem的相依性
- 如何充分利用Ruby的記憶體管理和分析工具
- 通過了解Ruby解譯器的內部工作原理來提高程式碼效率