O'Reilly logo

Design Patterns in Ruby by Russ Olsen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 17. Creating Custom Objects with Meta-programming

In Chapter 13 we looked at the two GoF factory patterns. Both of these patterns try to solve one of the fundamental problems of object-oriented programming: How do you get hold of the right object to solve the problem at hand? How do you get the right parser for your input data? How do you get the right adapter for the database that you need to talk to? Where do you come up with just the security object that you need to deal with this version of the specification as opposed to that one?

With the factory patterns, the solution was to reduce the problem of getting hold of the right object to the problem of getting hold of the right class; pick the right class and that class will produce ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required