Practicing Ruby
About Github Twitter
  • Safely evaluating user-defined formulas and calculations
    Learn how to use Dentaku to evaluate Excel-like formulas in Ruby programs (w. Solomon White)
    Issue 8.2 — September 10, 2015
  • Problem discovery comes before problem solving
    A brief story about why you should play around with problems before trying to solve them.
    Issue 8.1 — March 26, 2015
  • The anatomy of information in software systems
    Explore the tradeoffs involved in designing message formats, and the messy boundary between humans and computers.
    Issue 7.10 — September 8, 2014
  • A self guided course on streams, files, file formats, and sockets
    Explore UNIX-style stream processing, binary file formats, the Racc parser generator, and socket programming.
    Issue 7.9 — March 31, 2014
  • Sustainable maintenance: Focus on quality first
    Learn three useful practices for maintaining high quality open source projects (w. Eric Hodel)
    Issue 7.8 — February 17, 2014
  • Hunt the Wumpus: An exercise in creative coding
    Build Gregory Yob's classic text-based game from scratch, using the provided test suite as a guide.
    Issue 7.7 — December 11, 2013
  • Infrastructure automation by example
    Discover why infrastructure automation matters by exploring real Chef recipes. (w. Mathias Lafeldt)
    Issue 7.6 — November 12, 2013
  • Exploring low-level computing concepts with Ruby
    Implement a minimal simulator of the classic 6502 processor using nothing but JRuby.
    Issue 7.5 — October 1, 2013
  • Making incremental improvements to legacy systems
    Experience the challenge of overhauling one of Practicing Ruby's oldest features. (w. Jordan Byron)
    Issue 7.4 — September 5, 2013
  • Using data to explore questions about our lives
    Aggregate and analyze 500+ data points from a SMS-based mood study using R and Ruby. (w. Jia Wu)
    Issue 7.3 — August 6, 2013
  • Implementing a minimal HTTP server in Ruby
    Build just enough HTTP functionality from scratch to serve up static files. (w. Luke Francl)
    Issue 7.2 — July 2, 2013
  • Simulating tiny worlds for fun and profit
    Practice exploratory programming by modeling forest fires, rabbit populations, and diseases.
    Issue 7.1 — June 4, 2013
  • A low cost approach to working on side projects
    Save time by building a standalone feature before designing a complete product.
    Issue 6.10 — May 7, 2013
  • Avoiding brittleness in data munging projects
    Process data and generate reports without writing unmaintainable spaghetti code.
    Issue 6.9 — April 23, 2013
  • From adhoc script to object-oriented program
    Gradually convert a "throwaway" procedural program into a well-defined domain model.
    Issue 6.8 — April 10, 2013
  • The Law of Demeter: Some archaeological notes
    Explore the history of a classic design principle and how it relates to Ruby. (w. David A. Black)
    Issue 6.7 — March 26, 2013
  • Cleaning up bloated method interfaces
    Tame a complex method interface using keyword arguments and parameter objects.
    Issue 6.6 — March 12, 2013
  • Debugging without the doom and gloom
    Use stack traces, the Pry console, and tests to hunt bugs with confidence. (w. Carol Nichols)
    Issue 6.5 — February 26, 2013
  • Code reuse in Ruby: It's complicated!
    Learn the costs and benefits of the many ways that Ruby lets you reuse code.
    Issue 6.4 — February 12, 2013
  • A gentle introduction to actor-based concurrency
    Solve "Dining Philosophers" using mutex locks, then do it again using actors. (w. Alberto F. Capel)
    Issue 6.3 — January 25, 2013
  • A self-guided tour of an interesting codebase
    Practice your code reading skills by walking through a small GUI client to the GNU Go game engine.
    Issue 6.2 — January 15, 2013
  • Parsing JSON the hard way
    Learn about low-level parser and compiler tools by implementing a JSON parser. (w. Aaron Patterson)
    Issue 6.1 — January 1, 2013
  • An adventure in prototypes
    Build a text adventure game and a prototype-based object model, at the same time! (w. Avdi Grimm)
    Issue 5.10 — December 11, 2012
  • Simulating the emergent behavior of ant colonies
    Explore how simple rules for individuals can yield complex group behavior by simulating an ant colony.
    Issue 5.9 — November 27, 2012
  • Expanding your code reading horizons
    See how much even a few dozen lines of code can tell you about a programming language.
    Issue 5.8 — November 13, 2012
  • Understanding the relationships between objects
    Learn how to model dependencies, notifications, adjustments, and internal object relationships.
    Issue 5.7 — October 28, 2012
  • Guidelines for growing a stable codebase
    Discover the process we use for continuously improving practicingruby.com. (w. Jordan Byron)
    Issue 5.6 — October 16, 2012
  • Process spawning patterns
    Implement Ruby's system and backticks methods using the fork/exec pattern. (w. Jesse Storimer)
    Issue 5.5 — October 2, 2012
  • Building the rstat.us API: Choices and challenges
    Consider the design tradeoffs between the JSON API and hypermedia API styles. (w. Carol Nichols)
    Issue 5.4 — September 18, 2012
  • Event loops demystified
    Build a Node.js/EventMachine-style event loop in roughly 150 lines of Ruby code. (w. Magnus Holm)
    Issue 5.3 — September 4, 2012
  • Temporal coupling and the Law of Demeter
    See how NASA JPL's take on the Law of Demeter simplifies building robust asynchronous code.
    Issue 5.2 — August 19, 2012
  • A practical application of basic statistical methods
    Crunch some numbers to see how Olympic medal wins relate to GDP and population. (w. Jia Wu)
    Issue 5.1 — August 7, 2012
  • Spiking is not cowboy coding
    Search for the boundary lines between organized chaos and wild, unstructured hacking.
    Issue 4.12.4 — July 26, 2012
  • Mock objects deeply influence design
    Learn the rules that you need to follow in order to use mock objects as an effective design tool.
    Issue 4.12.3 — July 24, 2012
  • Refactoring is not redesign
    Discover how the differences between refactoring and redesign affect testing strategies.
    Issue 4.12.2 — July 19, 2012
  • End-to-end testing is essential
    Build acceptance tests that reflect application behavior, rather than implementation details.
    Issue 4.12.1 — July 18, 2012
  • Lessons learned from my TDD self-study
    Revisit the reasons for Gregory's 90-day self-study on TDD, and see the results.
    Issue 4.12 — July 17, 2012
  • Responsibility-centric vs. data-centric design
    Work through two approaches to object modeling and examine their tradeoffs. (w. Greg Moeck)
    Issue 4.11 — July 10, 2012
  • Implementing the Active Record pattern, Part 2
    Consider using "object-oriented mixins" to reduce inheritance-related problems in ActiveRecord.
    Issue 4.10 — July 3, 2012
  • The hidden costs of inheritance
    Think through some problems with inheritance-based modeling and then try a few related exercises.
    Issue 4.9 — June 19, 2012
  • Implementing the Active Record pattern, Part 1
    Build a basic foundation to serve as the groundwork for implementing an ActiveRecord-style ORM.
    Issue 4.8 — June 12, 2012
  • Writing confident code
    Develop intention-revealing code that is confident about its responsibilities. (w. Avdi Grimm)
    Issue 4.7 — June 5, 2012
  • Persisting relations in a polyglot world
    Explore some non-traditional persistence mechanisms and their uses. (w. Piotr Szotkowski)
    Issue 4.6 — May 21, 2012
  • Solving the "Scoring Predictions" kata
    Work through a coding puzzle and learn some fun tricks along the way. (w. James Edward Gray II)
    Issue 4.5 — May 15, 2012
  • Tricks for working with text and files
    Tear apart a minimal clone of the Jekyll blog engine in search of helpful Ruby idioms.
    Issue 4.4 — May 10, 2012
  • What are the costs and benefits of TDD?
    Think through how to evaluate the impact of test-driven development on your work.
    Issue 4.1 — April 10, 2012
  • Lessons learned from coding in the danger zone
    Establish a few survival skills for working in hostile programming environments.
    Issue 3.10 — March 13, 2012
  • Using games to practice domain modeling
    Learn about modeling non-trivial business logic by implementing Minecraft's crafting table.
    Issue 3.9 — February 28, 2012
  • Criteria for disciplined inheritance, Part 2
    Discover how Barbara Liskov's concept of "behavioral subtypes" apply to object modeling in Ruby.
    Issue 3.8 — February 21, 2012
  • Criteria for disciplined inheritance, Part 1
    See how M. Sakkinen's notion of "Disciplined Inheritance" in 1989 still applies to modern Ruby code.
    Issue 3.7 — February 15, 2012
  • Framework design and implementation, Part 2
    Explore some lessons learned the hard way in developing the Newman mail framework.
    Issue 3.6 — February 8, 2012
  • Framework design and implementation, Part 1
    Dig through the Newman mail framework's source code in search of useful patterns and practices.
    Issue 3.5 — February 2, 2012
  • Building a better Turing tarpit
    In this issue, we improve the design of the Brainf*ck interpreter that was introduced in Issue 3.3
    Issue 3.4 — January 25, 2012
  • Exploring the depths of a Turing tarpit
    Read the code for a simple Brainf*ck interpreter and think about how it might be improved.
    Issue 3.3 — January 17, 2012
  • Patterns for building excellent examples
    Learn how to write code samples that clearly communicate ideas to other programmers.
    Issue 3.2 — January 10, 2012
  • The qualities of great software
    See what ISO/IEC 9126 has to say about software quality, and how its metrics apply to Ruby code.
    Issue 3.1 — January 3, 2012
  • Thoughts on "Arguments and Results", Part 2
    Work through result objects inspired by James Noble's classic "Arguments and Results" paper.
    Issue 2.15 — November 30, 2011
  • Thoughts on "Arguments and Results", Part 1
    Work through argument objects inspired by James Noble's classic "Arguments and Results" paper.
    Issue 2.14 — November 23, 2011
  • Working with binary file formats
    Read and write bitmap files using only a few dozen lines of Ruby code.
    Issue 2.12 — November 9, 2011
  • Domain specific API construction
    Master classic Ruby DSL design patterns by ripping off well-known libraries and tools.
    Issue 2.11 — November 2, 2011
  • From requirements discovery to release
    Watch a small game project develop from the brainstorming phase to its first public release.
    Issue 2.10 — October 27, 2011
  • Building Unix-style command line applications
    Build a basic clone of the 'cat' utility while learning some Ruby idioms for command line applications.
    Issue 2.9 — October 18, 2011
  • Ruby and the singleton pattern don't get along
    Model the singleton pattern in seven different ways, without discovering an elegant solution.
    Issue 2.8 — October 11, 2011
  • "Unobtrusive Ruby" in Practice
    Explore ideas from Mike Burns's "Unobtrusive Ruby" blog post via practical code samples.
    Issue 2.7 — October 4, 2011
  • Learning new things step-by-step
    Build a simple arcade game in 13 tiny steps.
    Issue 2.6 — September 27, 2011
  • Thoughts on regression testing
    Benefit from two lessons about regression testing that were learned the hard way.
    Issue 2.5 — September 20, 2011
  • Building Enumerable & Enumerator in Ruby
    Learn about Ruby's powerful iteration tools by implementing some of its functionality yourself.
    Issue 2.4 — September 13, 2011
  • A closure is a double edged sword
    Discover why the closure property can sometimes lead to hard-to-spot memory leaks.
    Issue 2.3 — September 6, 2011
  • How to attack sticky problems
    Work through a few lessons that will help you find a starting point whenever you feel stuck.
    Issue 2.2 — August 30, 2011
  • Ways to load code
    Explore the strengths and weaknesses of the many code loading mechanisms in Ruby.
    Issue 2.1 — August 23, 2011
  • Structural Design Patterns
    Examine a use case for each of the classic structural design patterns laid out by the Gang of Four.
    Issue 1.26 — February 28, 2011
  • Creational Design Patterns
    Examine a use case for each of the classic creational design patterns laid out by the Gang of Four.
    Issue 1.25 — February 22, 2011
  • Connascence as a Software Design Metric
    Work through code samples inspired by Jim Weirich's "Building Blocks of Modularity" presentation.
    Issue 1.24 — February 11, 2011
  • SOLID Design Principles
    Work through code samples inspired by Sandi Metz's "SOLID Object-oriented Design" presentation.
    Issue 1.23 — February 5, 2011
  • How to practice, Part 2
    See an example of how the practice methods outlined in Issue 1.21 can be applied to a real project.
    Issue 1.22 — January 28, 2011
  • How to practice, Part 1
    Discover a new way to practice your coding skills by asking yourself the right questions.
    Issue 1.21 — January 26, 2011
  • Thoughts on Mocking, Part 2
    Explore a few good uses of mock objects from a non-mockist's perspective.
    Issue 1.20 — January 22, 2011
  • Thoughts on Mocking, Part 1
    Consider how the ideas from Martin Fowler's "Mocks aren't Stubs" can be applied to Ruby.
    Issue 1.19 — January 19, 2011
  • Dirty Little Secrets about Testing
    Take a look at some dark corners of the traditional testing dogma.
    Issue 1.18 — January 14, 2011
  • Interesting Ruby Hacker-Writers
    Find out which Ruby hackers consistently write great content worth reading.
    Issue 1.17 — January 7, 2011
  • Interesting Ruby Hackers
    Find out which Ruby hackers consistently write great code worth reading.
    Issue 1.16 — January 3, 2011
  • Duck Typing in Practice, Part 2
    Examine real uses of Ruby's duck-typing capabilities in various open source projects and Ruby itself.
    Issue 1.15 — December 31, 2010
  • Duck Typing in Practice, Part 1
    Investigate the three main ways of doing type checking in Ruby, then work on some related exercises.
    Issue 1.14 — December 28, 2010
  • Obfuscations of Christmas Past
    Tear apart an obfuscated Ruby program from Leah Neukirchen to learn some neat tricks.
    Issue 1.13 — December 23, 2010
  • Rapid Prototyping
    Build a tiny prototype of a tetris game on the command line.
    Issue 1.12 — December 21, 2010
  • Uses for Modules, Part 4
    Explore the use of mixins for customizing individual objects.
    Issue 1.11 — December 16, 2010
  • Addendum to Uses For Modules, Part 3
    Learn the subtle differences between "extend self", "def self.method", and "module_function".
    Issue 1.10.a — December 15, 2010
  • Uses for Modules, Part 3
    See how modules can be used as namespaced function bags, and as singleton objects.
    Issue 1.10 — December 14, 2010
  • Uses for Modules, Part 2
    Use mixins as an alternative to multiple inheritance to augment class definitions.
    Issue 1.9 — December 10, 2010
  • Uses for Modules, Part 1
    Use modules as namespaces for your libraries and applications.
    Issue 1.8 — December 8, 2010
  • Meditations on Bad and Good Code, Part 2
    Read through a cleaned up version of the ugly "Tic Tac Toe" game created in Issue 1.5
    Issue 1.7 — December 3, 2010
  • Meditations on Bad and Good Code, Part 1
    Build an ugly tic-tac-toe game by writing the entire implementation as a single procedural script.
    Issue 1.6 — December 1, 2010
  • Testing Private Methods
    Understand why testing private methods can be a code smell.
    Issue 1.5 — November 25, 2010
  • Writing Configurable Applications, Part 2
    Build dynamic Ruby-based configuration objects.
    Issue 1.4 — November 18, 2010
  • Writing Configurable Applications, Part 1
    Learn what not to do when configuring applications, then explore a simple YAML-based configuration.
    Issue 1.3 — November 16, 2010
  • Ruby's method lookup path, Part 2
    Use your knowledge of Ruby's lookup path to determine where to add methods in a program.
    Issue 1.2 — November 11, 2010
  • Ruby's method lookup path, Part 1
    Discover the complicated, multi-step dance that is the Ruby method lookup path.
    Issue 1.1 — November 9, 2010
  • Send questions and feedback to:
  • [email protected]

The world's largest collection of lessons for experienced Ruby developers.