On Fri, 4 Apr 2003 22:51:02 +0900, Jim Freeze wrote: > Hi > > I've been poking around the mailing list looking for some insight > into using inheritance vs module include. It seems like every time > I have a good idea for some class, I wrangle with this question. IMO, there are different reasons to use each: Module 1. Provides namespace wrapping. 2. Extends the functionality of a class. Enumerable adds several methods to a class; Comparable does the same. 3. Is not expected to be extended itself. 4. Exists once and only once, but isn't "unique" in any meaningful sense (like a Singleton class). Class 1. Provides namespace wrapping. 2. Can be extended by children. 3. May exist more than once, or (if a Singleton), has been limited to exist once but exists uniquely. In many ways, it is an art choosing your choice of encapsulation methods. If you have a set of related functions that operate on a provided set of data without configuration information, you may want a module (e.g., Math); if they operate on a provided set of data with configuration information *or* operate on themselves, you may want a class (e.g., Text::Format). -austin -- Austin Ziegler, austin / halostatue.ca on 2003.04.04 at 13:40:29