プログラミングRuby:実用主義プログラマーのガイド(第2版)
Rubyプログラミング言語の包括的なリファレンスおよびチュートリアルで、基本構文、オブジェクト指向設計、リフレクションやスレッドといった高度な機能、およびバージョン1.8用の完全なライブラリリファレンスをカバーしています。
コース概要
📚 コンテンツ概要
Rubyプログラミング言語の包括的なリファレンスおよびチュートリアル。基本構文、オブジェクト指向設計、リフレクションやスレッドといった高度な機能、さらにバージョン1.8用の完全なライブラリリファレンスをカバー。
完璧なガイドを通じて、洗練された強力なプログラミングの芸術をマスターしよう。
著者: デイブ・トーマス、チャド・ファウラー、アンドリュー・ハンツ
謝辞: Rubyメーリングリストのレビュアー、松本行弘(Matz)、チャド・ファウラー、キム・ウィンセット、そしてPragmatic Programmersコミュニティ。
🎯 学習目標
- 二進形式、ソース、またはCVSからのインストール方法を使ってRuby環境をインストール・設定し、irbやriといったインタラクティブツールを活用する。
- Rubyの命名規則とオブジェクト指向の原則を適用してメソッドを定義し、変数を管理する。
- 基本的な配列、ハッシュ、正規表現を使ってデータを操作する。
- 単一継承、super、およびミックスインを使用してクラス階層を定義・実装する。
- アクセス制御(Public、Private、Protected)と属性を使って、オブジェクトの可視性とデータの整合性を制御する。
- ユニットテストと統合された堅牢なコンテナクラス(例:SongList)を構築する。
- 16進数、8進数、2進数などさまざまな基数を使って数値ロジックを実装し、数値イテレータを使って制御フローを実現する。
- インタポレーション、ヘレドック、さまざまなデリミタ形式を使って複雑な文字列を構築する。
- 条件分岐における「トグルスイッチ」として、区間テストとしての範囲(Range)を活用する。
- スプラット演算子、ハッシュベースの「キーワード引数」、ブロックからプロシージャへの変換を使って、柔軟な引数リストでメソッドを定義・呼び出す。
レッスン 共 15 课时 · 预计 45.0h
レッスン
Lesson
This lesson introduces the history and philosophy of the Ruby language while guiding students through setting up a stable development environment on POSIX systems. Students will learn to manage Ruby versions, utilize package managers for dependencies, and execute scripts using standard Shebang notation.
This lesson explores inheritance in Ruby, focusing on how subclasses establish an "is-a" relationship with parent classes to evolve state and behavior. Students will learn to use the super keyword to manage initialization chains and method augmentation while maintaining encapsulation to avoid tight coupling.
This lesson explores Ruby’s scalar data types, focusing on the automatic memory management between Fixnum and Bignum integers and the use of strict conversion methods. Students will also learn to optimize string manipulation and data extraction workflows by constructing complex regular expressions.
AI035: Ch. 6-7: Method Logic and Expression Control (Lesson 4) This lesson explores flexible method definitions in Ruby, focusing on the use of default parameters, the splat operator for argument handling, and expression-based return values. Students will learn how to build adaptive interfaces and utilize parallel assignment to improve code efficiency and readability.
This lesson explores Ruby's exception hierarchy, teaching students how to treat errors as data objects to build more resilient and maintainable applications. You will learn to implement effective error handling by distinguishing between recoverable application errors and fatal system failures while applying modularity principles to improve system stability.
This lesson explores Ruby's stream-based I/O architecture, focusing on how the IO class and Kernel methods provide a unified, bidirectional interface for interacting with files, sockets, and standard streams. Students will learn to effectively manage data flow, utilize standard filters, and apply best practices for input handling and output buffering in Ruby applications.
This lesson explores the principles of reliable Ruby programming through systematic unit testing, debugging, and performance optimization. Students will learn to implement the Test::Unit framework to isolate logic errors, utilize assertions for real-time validation, and apply profiling techniques to improve code efficiency.
This lesson explores the Ruby operational environment, focusing on efficient development workflows through command-line utilities, interactive debugging with IRB, and documentation management using RDoc. Students will learn to leverage Ruby's built-in tools for stream processing, project navigation, and graceful program termination.
This lesson explores the RubyGems ecosystem, focusing on how architectural isolation and runtime path management allow multiple versions of the same library to coexist. Students will learn to resolve dependency trees, manage version constraints, and use RubyGems to prevent version collisions in complex development environments.
This lesson explores the transition from linear terminal scripts to event-driven GUI applications by integrating remote SOAP services into Ruby interfaces. Students will learn to use WSDL dynamic discovery and data sanitization techniques to build responsive, user-friendly dashboards that effectively manage complex, nested data.
This lesson explores how to extend Ruby with C to achieve high-performance execution while maintaining compatibility with Ruby’s object model. Students will learn to use the VALUE type as a bridge between languages, register C functions as Ruby methods, and manage memory safely within the Ruby Garbage Collector.
This lesson explores the structural anatomy of Ruby scripts, focusing on the language's execution lifecycle, reserved keywords, and the use of magic constants like `__FILE__`, `__LINE__`, and `DATA`. Students will learn to implement modular design patterns, such as the `if __FILE__ == $0` execution gate, to create versatile scripts that function as both standalone tools and reusable libraries.
This lesson explores the core philosophy of duck typing and the mechanics of dynamic method dispatch in Ruby. Students will learn how to implement polymorphic interfaces, handle variable arguments, and utilize blocks and the yield mechanism to create flexible, message-driven code.
This lesson explores the internal architecture of Ruby objects, focusing on how the `klass` and `super` pointers facilitate method resolution and inheritance. Students will learn how Ruby decouples instance state from class-based logic and how virtual classes are utilized to manage singleton methods.
This lesson explores Ruby’s reflection and introspection capabilities, teaching students how to dynamically inspect object interfaces, hierarchies, and capabilities at runtime. Participants will learn to implement meta-programming patterns like duck typing and dynamic dispatch while understanding the performance trade-offs of these powerful tools.