From: Robert Klemme Date: 2010-04-16T15:53:38+09:00 Subject: Re: Is this good OOP structuring? 2010/4/16 Josh Cheek : > On Thu, Apr 15, 2010 at 11:39 PM, Derek Cannon > wrote: Derek,thanks for stepping in with good explanations! > > What exactly is "modularity"? > > Think how unix commands are small with a specific function, but you can > combine them in powerful ways. These small programs are modular. I'd really like to stress this point of yours: for code to be properly modularized it is essentially important that every single piece of code (class, method) has a particular purpose and does _one_ thing well. This one thing can be even as complex as "managing lists of items" (class Array does that) or "convert to an integer" (method #to_i does that). But "managing lists of items and send them to PostScript printers" would not be modular. Class Array would be bloated with printer control code that most people do no need most of the time. Plus, you change printing code and suddenly list management needs to change as well which could have negative side effects on other code using class Array. Keeping things focused not only helps reuse but also understanding (if you need to maintain code someone else wrote you will see what I mean). Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/