CARVIEW |
Ruby Best Practices
Increase Your Productivity -- Write Better Code
All Posts (feed)
Weekend Reading: RBP Chapters 2-3
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.2010-02-05 14:00 by Gregory Brown (View Comments)
Sexp for Rubyists
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...2010-02-04 21:00 by Magnus Holm (View Comments)
Weekend Reading: RBP Chapter 1
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".2010-01-29 14:32 by Gregory Brown (View Comments)
Reflections from "The Compleat Rubyist"
Reflections on our recent training event The Compleat Rubyist, held January 22-23 in Tampa, FL. Everybody learned a ton, including us instructors.2010-01-25 15:36 by Gregory Brown (View Comments)
Learning From Bad Ideas
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.2009-11-22 22:57 by Gregory Brown (View Comments)
The Complete Class
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.2009-10-24 18:05 by Robert Klemme (View Comments)
Structs inside out
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.2009-09-21 21:48 by Robert Klemme (View Comments)
Muppet Labs closing for now
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.2009-09-07 19:03 by Robert Klemme (View Comments)
James will be right back after these interruptions
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 tasks2009-08-30 13:00 by James Britt (View Comments)
Completing the Animal
We are coming close to the end to the Laboratory series: finally the animal is complete and munches away on your logfiles.2009-08-24 21:09 by Robert Klemme (View Comments)
Be Nice and Have Fun
In the wake of yet another Ruby drama scene, there is one community Best Practice that always works.2009-08-21 11:25 by Gregory Brown (View Comments)
A bit of Optimization
The dramatic decrease of performance bugged me. Today I show, how I managed to remedy that - and even get a faster version than before.2009-08-09 20:47 by Robert Klemme (View Comments)
Should I Tap that Hash? (Ruby 1.9 Style)
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.2009-08-05 12:00 by Gregory Brown (View Comments)
LRU Integration explained
Today I'll add a bit more explanation to the last article and provide the reasoning behind the implementation.2009-07-31 16:33 by Robert Klemme (View Comments)
LRU Integration
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.2009-07-10 21:07 by Robert Klemme (View Comments)
25th Post!
This is the 25th post since RBP blog started up. Let us know what you think of how things have gone so far.2009-07-07 05:00 by Gregory Brown (View Comments)
Code Blocks: Ruby's Swiss Army Knife
A complete section excerpted from the "Designing Beautiful APIs" chapter of my O'Reilly book, Ruby Best Practices.2009-07-07 04:00 by Gregory Brown (View Comments)
Animal Interaction Processing
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.2009-06-30 16:30 by Robert Klemme (View Comments)
The Decorator Delegator Disco
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.2009-06-27 16:00 by Gregory Brown (View Comments)
The Animal raises its head
I hacked together a first draft illustrating the intended architecture.2009-06-22 22:36 by Robert Klemme (View Comments)
Shadow of the Animal
Today I will go into more detail with regard to the application structure and the thought process that led to it.2009-06-21 19:36 by Robert Klemme (View Comments)
The Double Dispatch Dance
Let's take a quick tour of how to convert anything to anything using the Double Dispatch and Visitor patterns.2009-06-19 20:30 by Aaron Patterson (View Comments)
First Design Considerations
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!2009-06-12 20:36 by Robert Klemme (View Comments)
"And your Mom, too." Ruby-talk best practices.
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 particular2009-06-10 21:59 by James Britt (View Comments)
Quack Attack: Making Your Code More Rubyish
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.2009-06-09 13:00 by Gregory Brown (View Comments)
Requirements Summary of the Laboratory Project
Now it's time to collect all the requirements from the discussion threads and put them into some groups.2009-06-08 21:59 by Robert Klemme (View Comments)
Name that method: Symmetry
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.2009-06-05 19:39 by Magnus Holm (View Comments)
RubySpec as a Community Resource (Interview w. Brian Ford)
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.2009-06-04 07:52 by Gregory Brown (View Comments)
The Laboratory Project
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.2009-06-03 21:56 by Robert Klemme (View Comments)
Enter the Muppet Laboratories
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.2009-05-29 17:54 by Robert Klemme (View Comments)
Reading Ruby's Standard Library for Fun and Profit
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.2009-05-24 18:25 by Gregory Brown (View Comments)
Control flow features and readability
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.2009-05-19 20:46 by Robert Klemme (View Comments)
Hello World (Literally)
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.2009-05-05 06:42 by Gregory Brown (View Comments)
The Universe between begin
and end
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.
2009-05-01 10:05 by Robert Klemme (View Comments)
Fun with Class.new
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.2009-04-30 17:55 by Gregory Brown (View Comments)
Writing Block Methods with automatic Resource Cleanup
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.2009-04-20 19:47 by Robert Klemme (View Comments)
Rails Modularity for Lazy Bastards
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.2009-04-16 04:31 by Gregory Brown (View Comments)
Solve the problem, not just a problem
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.2009-04-13 20:11 by James Britt (View Comments)
Using Blocks for Robustness
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.2009-04-09 14:25 by Robert Klemme (View Comments)
Welcome to the RBP blog
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.2009-04-07 17:02 by Gregory Brown (View Comments)
All content is under Copyright (C) 2009 by the individual authors of this blog and is hereby released under the Attribution-Noncommercial-Share Alike 3.0 Unported license.
If you have any questions, please contact the author of the material you are interested in using.
If you enjoy reading this blog, you might also like to read the Ruby Best Practices book, by Gregory Brown.