The Ruby Best Practices blog is a collaborative effort between Gregory Brown, James Britt, Robert Klemme and Magnus Holm. If you like what we do here, you might also want to subscribe to Gregory's Practicing Ruby Journal.
Eric presents an example of a process which monitors itself for excessive CPU usage derived from PulseAudio source code.
Today Eric talks about how to implement signal handlers properly and what pitfalls to look out for.
I've decided to publicly release 15 more articles from my Practicing Ruby journal. Read on if you want a bunch of links to some of the best Ruby content I've ever written.
Today Eric talks about signal handling basics.
In this article, I provide some advice for folks who want to create local or online communities that help folks get better at programming. While these ideas are based on the values of Mendicant University, they should be relevant to anyone who wants to get a group of programmers together for serious practice.
Issue #26 of Practicing Ruby Volume 1, originally published on February 28, 2011. This article is about the various structural design patterns originally laid out by the Gang of Four.
Issue #25 of Practicing Ruby Volume 1, originally published on February 22, 2011. This article is about the various creational design patterns originally laid out by the Gang of Four.
Mendicant University is a free online school for software developers that aims to help smart people do amazing things for the world. Many folks often ask me how our program works, so I wrote this post to answer some of those questions.
The Practicing Ruby Journal publishes new Ruby articles by Gregory Brown on a weekly basis. It is the source of many of the articles on this blog, and is how Gregory pays his bills. Read on to find out how things have been going for the last three months. Links to three free articles are included in this post!
Today Eric presents various bits of information that the kernel manages for a process.
Eric explains duplicating file descriptors.
The Practicing Ruby Journal publishes new Ruby articles by Gregory Brown on a weekly basis. Each article is a well-polished brain dump based on real experiences that will help you become a better software developer. Paying subscribers not only get access to a great learning resource, but also help make it possible for Gregory to spend more and more time working on the completely free Mendicant University. Read on to learn more.
Eric explains Unix time concepts and how time related functionality is accessed from Ruby.
We learn what pipes are and how they are realized in a Unix kernel.
This article explains how hierarchical filesystems are organized and what utilities Ruby provides for access to directories and directory entries.
Issue #24 of Practicing Ruby, originally published on February 11, 2011. This article is about how to use the concept of connascence when reasoning about software design problems.
This article presents the various types of meta data of a file which can be obtained from the kernel. We also learn how to access this information from Ruby.
This article introduces basic methods used for doing IO and how they map to system calls.
Class IO is at the core of Ruby's IO functionality. We also look at what types of buffers are active in an application and whether and how they are shared.
This is an introduction to places where information about processes in a running Unix system can be found.
Issue #23 of Practicing Ruby, originally published on February 5, 2011. This article is about apply the SOLID design principles to Ruby programs.
Explanation of the different functional layers involved in eventually getting the kernel to do something for us.
Eric describes common strategies to reduce the number of system calls done. This does make sense since they come with an overhead.
POSIX filesystems are byte oriented and the abstraction is difficult to adhere for certain use cases.
In this installment Eric explains basic features of the Unix hierarchical filesystem including virtual filesystems.
Eric introduces fundamental concepts of the runtime architecture of a Unix system: processes and file descriptors.
This is the first article in the series of our guest author Eric Wong about Unix systems programming (USP).
Issue #22 of Practicing Ruby, originally published on January 28, 2011. This article is the second half of a two part series about my way of practicing software development.
Issue #21 of Practicing Ruby, originally published on January 26, 2011. This article is the first half of a two part series about my way of practicing software development.
Issue #20 of Practicing Ruby, originally published on January 22, 2011. This article is the second half of a two part series about using mocks in testing.
Issue #19 of Practicing Ruby, originally published on January 19, 2011. This article is the first in a two part series about using mocks in testing.
Issue #18 of Practicing Ruby, originally published on January 14, 2011. This article is a small rant about TDD practices.
Issue #17 of Practicing Ruby, originally published on January 7, 2011. This article highlights some Ruby developers I find particularly interesting.
Issue #16 of Practicing Ruby, originally published on January 3, 2011. This article highlights some Ruby developers I find particularly interesting.
Issue #15 of Practicing Ruby, originally published on December 31, 2010. This article is the second half of a two part series about duck typing.
Issue #14 of Practicing Ruby, originally published on December 28, 2010. This article is the first in a two part series about duck typing.
Issue #13 of Practicing Ruby, originally published on December 23, 2010. This issue is a fun diversion that digs into one of the more notable obfuscated programs produced in the Ruby community.
Issue #12 of Practicing Ruby, originally published on December 21, 2010. This issue discusses how to use Ruby for coding up quick proof-of-concept prototypes.
Issue #11 of Practicing Ruby, originally published on December 21, 2010. This article was the third in a four part series on modules, and what you can use them for.
Want an extremely easy way to help make a huge impact on the software development community? I have an idea!
Issue #10.5 of Practicing Ruby, originally published on December 15, 2010. This issue adds a bit more context to what was discussed in Issue #10.
Issue #10 of Practicing Ruby, originally published on December 14, 2010. This article was the third in a four part series on modules, and what you can use them for.
While we've seen a small resurgence in activity on this blog due to the gradual release of the Practicing Ruby newsletter, it's been quite a while since we've seen any posts that were specifically written for this blog. I went ahead and caught up with the RBP bloggers to see what they've been up to.
Issue #9 of Practicing Ruby, originally published on December 10, 2010. This article was the second in a four part series on modules, and what you can use them for.
Issue #8 of Practicing Ruby, originally published on December 8, 2010. This article was the start of a four part series on modules, and what you can use them for.
Issue #7 of Practicing Ruby, originally published on December 3, 2010. This article describes a learning technique I use frequently to help me reflect on my software design and development practices.
Issue #6 of Practicing Ruby, originally published on December 1, 2010. This article describes a learning technique I use frequently to help me reflect on my software design and development practices.
Issue #5 of Practicing Ruby, originally published on November 25, 2010. This article covers various alternatives to testing private methods explicitly in your unit tests.
Issue #4 of Practicing Ruby, originally published on November 18, 2010. The focus is on how to build configurable applications that don't suck.
Issue #3 of Practicing Ruby, originally published on November 16, 2010. The focus is on how to build configurable applications that don't suck.
Issue #2 of Practicing Ruby, originally published on November 11, 2010. The focus is on one of the most fundamental bits of Ruby knowledge one must master: the method lookup path.
The very first issue of Practicing Ruby, originally published on November 9, 2010. The focus is on one of the most fundamental bits of Ruby knowledge one must master: the method lookup path.
Now that my paid newsletter is wrapping up, I've decided to bring this blog back to life by gradually releasing back issues for the enjoyment of RBP blog readers. We also decided to do a small rebranding in the process.
My work with students at Ruby Mendicant University over the last several months has taught me a ton about what topics are stumbling points for intermediate Ruby developers. In an effort to help support the ongoing operations of RMU while simultaneously helping others learn, I'm launching an inexpensive bi-weekly newsletter.
Ruby Mendicant University is an experiment in alternative technical education that got its start through some brainstorming done here on the RBP blog back in June, 2010. This series of posts will bring the community up to date on what we've been up to, and what lies on the horizon.
For a while I have been pondering how to write about complexity. I believe this term is a crucial one for our profession and we should understand it in order to be able to make a good job. Today I will explore the first dimension of complexity: complexity to avoid redundancy.
Details on how to get involved with my new Ruby Mendicant University idea.
It's time for another one of my crazy ideas: This time, a free online Ruby training program. Please read about it and let me know what you think.
The story of how I got involved in Ruby, and made one of the best friends anyone could ask for. And also, why you should be registering for Red Dirt RubyConf right now.
I'm pleased to announce the launch of rubyproblems.com, a new Ruby learning resource that readers of RBP are sure to enjoy.
As of today, you can download the full PDF copy of my book "Ruby Best Practices". I have also put the manuscript and production sources out there, so contributors can start to play with things as they see fit. Click through for details.
This week, we have the Reducing Cultural Barriers chapter of Ruby Best Practices available for reading and discussion. In it, you'll learn about some multilingualization and localization techniques, including a bit about how encodings work in Ruby 1.9.
This week, we have the When Things Go Wrong chapter of Ruby Best Practices available for reading and discussion. In it, you'll find practical tips that will make troubleshooting your Ruby code a whole lot easier.
Playing around with code can be fun and even provide new insights into the language or coding techniques.
This week, we have the Functional Programming Techniques chapter of Ruby Best Practices available for reading and discussion.
If you want to create a class to do math with (more precisely, a class with that employs operator overloading) additional aspects come into play compared to the class I presented in "The Complete Class".
After a short delay, the Text Processing and File Management chapter of Ruby Best Practices is now available for you to read and discuss.
If you were expecting to see Chapter 4 released today, unfortunately, it's not going to happen this week. See the main post for details.
Releasing Chapter 2 and 3 of my book, "Ruby Best Practices". Last week's comments on Chapter 1 were great, so hopefully we can keep that up this week.
Sorry to interrupt you, but you've totally lost me. What is this "Sexp" you're speaking of? I've heard it before, but never quite understood it...
From the time I began writing the "Ruby Best Practices" book, I knew I'd eventually release it under a Creative Commons license. It's now time to start that process. This post releases the book's first chapter, "Driving Code Through Tests".
Reflections on our recent training event The Compleat Rubyist, held January 22-23 in Tampa, FL. Everybody learned a ton, including us instructors.
A common way of studying the game of Go is to work backwards from a bad position to discover what a better move would have been. In this article, I'll show you how to do that with Ruby code as well.
There are a few concepts you have to implement for many classes such as equivalence, hash code calculation etc. Today I will discuss these and provide a sample class implementation with all of them.
I will try to expose the utility of class Struct which is part of the standard library. And it does not even need a require! Read on for full story.
Now that the code has reached a final version and interest in the blog series has died away Muppet Laboratories will close the door for now.
Keeping your focus and flow while still making notes of bugs and quirks can be challenging. Luckily, as Ruby hackers, we can build tools to reduce the friction of mundane tasks
We are coming close to the end to the Laboratory series: finally the animal is complete and munches away on your logfiles.
In the wake of yet another Ruby drama scene, there is one community Best Practice that always works.
The dramatic decrease of performance bugged me. Today I show, how I managed to remedy that - and even get a faster version than before.
Ruby 1.9 gives us Object#tap, which is immediately useful for some benign purposes. But lately I've been getting more creative and can use some peer review to tell me if what I'm doing is elegant or ugly.
Today I'll add a bit more explanation to the last article and provide the reasoning behind the implementation.
I could not find a LRU class which fits nicely with our requirements so I wrote it myself. This is just a short article showing the integration of it.
This is the 25th post since RBP blog started up. Let us know what you think of how things have gone so far.
A complete section excerpted from the "Designing Beautiful APIs" chapter of my O'Reilly book, Ruby Best Practices.
The InteractionProcessor is one of the core components of our Animal. We will look at how it is built - and why it's done that way.
In response to Aaron Patterson's "Double Dispatch Dance", we'll take a look at another way to get funky with design patterns. Go read his post first if you haven't already.
I hacked together a first draft illustrating the intended architecture.
Today I will go into more detail with regard to the application structure and the thought process that led to it.
Let's take a quick tour of how to convert anything to anything using the Double Dispatch and Visitor patterns.
Today we will go into medias res. I will start by outlining application design and collect some useful facts derived from requirements. You'll even see small snippets of Ruby code!
Part of being a good Ruby hacker is being part of a community. Let's look at some best practices for posting to mailing lists, ruby-talk in particular
Often times, when a newbie tries to make their code more "Rubyish", it means using some cute meta-programming hack that experienced hackers would never use due to its obscurity or fragility. However, the Ruby Way isn't just an urban myth, nor is it some dark secret held tightly by its masters. In this article, we'll look at a simple but powerful API design technique that will make your code more "Rubyish" without invoking any deep voodoo.
Now it's time to collect all the requirements from the discussion threads and put them into some groups.
Naming your methods properly is an important task when it comes to writing readable and reusable code. Today, let's explore one useful concept: Symmetry.
I caught up with Brian Ford to ask a few questions about RubySpec, the effort to describe Ruby through BDD style specs. With any luck, after reading his responses, you'll be as excited about this awesome effort as I am.
Today we will start the announced project. You will find a description of the problem I will attempt to solve in the course of the project. Please read on.
Often we present finished code which includes all the decisions that have been made during its construction. I will try show the process that led to the final code like we are looking at a test tube.
The more code we read, the more we learn about our craft. No self-respecting Rubyist should go without reading at least bits and pieces of Ruby's standard library, so I'd like to get you started on that journey today.
When we program we routinely pick different control flow freatures. Often we do not think much about our choice and in fact in many situations it is obvious what we should do. I got curious about the nature of control flow features with respect to their effects on readability when I realized that catch ... throw is an extreme rare thing to see. Let's look a bit closer at this.
A quick look at of a map of where in the world our traffic has come from in the last few days, along with a few questions for our readers.
The article was inspired by last article's comments. Much has been said in the comments already and today I'll mostly try to combine and organize it to give an overview from begin to end.
Building anonymous classes may sound a bit esoteric, but they can actually come in handy in a number of ways. I've collected three and a half of my favorite tricks for your enjoyment.
Last time I demonstrated how using library methods with blocks can improve robustness of a program. This time I will show how such methods are implemented.
If given the choice, would you rather maintain one gigantic Rails application, or a handful of smaller ones? Using some simple organizational techniques along with ActiveResource, you can still tackle the big problems without the big headaches that come along with monolithic systems.
Geeks are prone to build complex tools to solve problems, but the real goal is to solve the right problems. The Korma blogging tool hits that sweet spot.
One way to look at Ruby's blocks is as anonymous functions and one of the uses of them is to make your code more robust.
This blog will hopefully be a great community resource for Ruby developers who are constantly in search of better coding practices and techniques. Although it'll be a few days before things get rolling, I'm happy to announce the project and the great group of collaborators we've put together.