The Ruby Beginner's Guide (5th Edition) cover

The Ruby Beginner's Guide (5th Edition)

No rating yet
Word count
500K words
Chapters
29
Series
Turing Programming Series
ISBN
9787115462947

Tags

Summary

The Ruby Beginner's Guide (5th Edition) is the Chinese translation of the fifth edition of the classic Japanese Ruby introductory book Tanoshii Ruby, co-authored by Yukihiro Takahashi, founder of the Japan Ruby Association, and Yuzo Goto, reviewed and recommended with a preface by Ruby's creator Yukihiro Matsumoto, translated by He Wensi, and published in 2017 by Posts & Telecom Press as part of the Turing Programming Series. The book is written for Ruby 2.3 and aimed at readers with no programming experience at all. It starts with "how to run the ruby command" and "how to use the irb interactive environment," then uses the most basic elements—strings, numbers, the puts/p methods, variables, comments, conditionals, and loops—to get readers writing small runnable programs as quickly as possible. It then systematically explains Ruby's core syntax: objects, classes, and methods; the scope of variables and constants; multiple assignment; the various forms of conditionals and loops; method definition and parameters; classes and modules; operator overloading; error handling and exceptions; blocks and iterators. Next, it introduces commonly used classes chapter by chapter: numbers, arrays, strings, hashes, regular expressions, IO, File and Dir, Encoding, Time and Date, Proc, and others. Finally, two examples—text processing and postal code lookup—tie the knowledge together into small runnable tools. The appendixes provide a guide to setting up a Ruby environment and a quick-reference syntax guide; some chapters include exercises, with answers and all the book's code included.

Editor's review

Ruby 入门书不少,但由 Ruby 之父松本行弘亲自审校、并作序推荐的中文教材并不多,这本就是其中之一。它的原作《たのしいRuby》在日本长期作为 Ruby 入门首选,特点是不急着堆概念,而是让读者先跑通第一个程序,再回头理解「对象」和「方法」这些词到底在说什么。全书结构清楚:第 1 部分用三章带零基础读者完成环境搭建、数组散列正则的初体验和第一个命令行小程序;第 2 部分把对象模型、类与模块、异常处理、块这些 Ruby 的骨架讲透;第 3 部分按类库分章,读起来像一本可随手翻查的用法手册;第 4 部分用文本处理和邮政编码检索两个实例收尾,让人真正体会「用 Ruby 解决实际问题」的感觉。第 5 版对 Ruby 2.3 做了更新,并补充了中文输出、编码等对中文读者很实用的内容;部分章节配有练习题,附答案与全书代码。作为一本 300 多页、定价亲民的入门书,它的性价比相当高。

Who it's for

A good fit for

  • 没有任何编程经验、想从零学一门脚本语言的读者
  • 有其他语言基础,想快速上手 Ruby 语法的开发者
  • 正在学习 Rails 或准备学习 Rails、需要补齐 Ruby 基本功的人
  • 需要一本可随手查阅 Ruby 常用类用法的在职程序员

Not a good fit for

  • 希望直接学习 Rails 框架开发 Web 应用、跳过程序语言基础的读者
  • 寻找 Ruby 高级元编程、性能优化或并发等进阶主题的资深开发者
  • 只想了解编程概念、不打算动手写代码的纯理论型读者

Reading tips

  1. 按章节顺序推进,每章的示例代码务必亲手敲一遍,比读代码有效得多。
  2. 先花半天把附录 A 的环境搭好,确保 ruby 与 irb 都能正常运行,再进入第 1 章。
  3. 第 3 部分可按需跳读,把它当作类库速查表,遇到具体问题时再回来查。
  4. 读完第 23 章后,试着把「检索邮政编码」改写为自己的小需求,检验学习成果。

About the publisher

Posts & Telecom Press China · Founded in 1953

Posts & Telecom Press is known for its strengths in science and technology, computing, and information and communications titles, and has extended its publishing into photography, art, software learning, and inspirational growth, giving it a fairly diverse range. Its catalog includes computing and communications works such as Refactoring and Patterns (Revised Edition) and Huawei Switch Learning Guide (Second Edition), alongside bilingual collector's editions such as The Little Prince (Chinese-English-French illustrated collector's edition), The Great Gatsby, and Three Days to See. Beijing Ten Years: 1980-1990 and Ghost Blade: WLOP Personal Illustration Collection reflect its presence in photography and art. Its authors include Antoine de Saint-Exupéry, Helen Keller, Joshua Kerievsky, Wang Da, Zhang Zhaozeng, and WLOP.

Contents

  1. Part 1 First Taste of Ruby
  2. Chapter 1 A First Look at Ruby
  3. Chapter 2 Convenient Objects (Arrays, Hashes, Regular Expressions)
  4. Chapter 3 Creating Commands (Command-Line Input, File Reading, Method Definition)
  5. Part 2 Ruby Fundamentals
  6. Chapter 4 Objects, Variables, and Constants
  7. Chapter 5 Conditionals
  8. Chapter 6 Loops
  9. Chapter 7 Methods
  10. Chapter 8 Classes and Modules
  11. Chapter 9 Operators
  12. Chapter 10 Error Handling and Exceptions
  13. Chapter 11 Blocks
  14. Part 3 Ruby's Classes
  15. Chapter 12 Numeric Classes
  16. Chapter 13 The Array Class
  17. Chapter 14 The String Class
  18. Chapter 15 The Hash Class
  19. Chapter 16 The Regexp Class
  20. Chapter 17 The IO Class
  21. Chapter 18 The File and Dir Classes
  22. Chapter 19 The Encoding Class
  23. Chapter 20 The Time and Date Classes
  24. Chapter 21 The Proc Class
  25. Part 4 Building Tools by Hand
  26. Chapter 22 Text Processing
  27. Chapter 23 Postal Code Lookup
  28. Appendix A Setting Up a Ruby Environment
  29. Appendix B Ruby Reference

FAQ

这本书需要先有编程基础吗?
不需要。作者明确以「没有编程经验」的读者为对象,从如何安装 Ruby、如何在命令行运行程序讲起,前提条件只是会用电脑、能看懂简单的英文报错信息。
第5版对应哪个 Ruby 版本?现在还适用吗?
本书基于 Ruby 2.3 编写。Ruby 2.0 之后语法变化相对平缓,书中的核心语法与常用类用法在较新版本上基本仍然适用,个别新特性需另行查阅官方文档。
这本书和《Programming Ruby》有什么区别?
《Programming Ruby》(镐头书)更偏全面参考与进阶,篇幅大;本书定位是轻量入门,篇幅约 330 页,先帮读者建立语感与基本概念,更适合作为第一本 Ruby 书。
书中的练习题有答案吗?
有。据出版方介绍,部分章节设置有练习题,并附带习题答案和全书代码,可配合图灵社区的相关页面获取。

Comments

Find this book

This site is an index: you start “Search all sources” in your browser, and the entries it lists all point to third-party sites; please judge their availability yourself.

More by the same author

Top rated in the same category