From: Holden Glova Date: 2002-08-11T18:19:19+09:00 Subject: To be a Module, or not to be... -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello folks, I am attempting to write a transparent persistence framework and am having a hard time deciding if something should be a class or it should be a module. The reason I would like it to be a module is because I am trying to write a framework where I do not want to interfere with the object model used by clients of the framework. Ideally they would just include my module and get my functionality for free thus making persistence even more transparent. Where I get confused is that this module needs to set some instance variable state and initialize those variables. I would like it if there was a way for the state to be set after the the client object has been initialized? If that is not possible, or possibly not the best way to do it then please let me know. Here is some code: # # Encapsulates the behavior needed to make objects persistent and is the module # all classes wishing to be persisted should mix this in. # module ROS module Persistable def initialize # I want these variables to be instance vars. @is_persistent = false @timestamp = null end def retrieve ... end def save ... end def delete ... end end end Many thanks in advance for any help offered. - -- Signed, Holden Glova -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE9Vi0O0X8w8X71zPcRAvH1AJ4qxmaPjRkippgUEtX3HlckePJYTQCfS1wk m4CJwjJ2/iCm6l5Yz/bRY4g= =hSXa -----END PGP SIGNATURE-----