You also can't pass a module around. The module is just a namespace for methods that extend the RB language. It's nice for things like "extends" and database stuff where you don't want to have more than one instance floating around. I don't have a hard-and-fast rule for when to use a module instead of a class. Many times both are equally "correct" so it comes down to personal preference (and other times hindsight proves that wrong and you might end up making changes). Oftentimes when I find something that just doesn't fit into the OBJECT world nicely I cram it into a module.
~joe -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dave Crist Sent: Friday, March 31, 2006 2:47 PM To: REALbasic NUG Subject: Classes vs Modules I have been working this semester translating some useful numerical code from Java to RB... mainly because I thought it would make me more aware of how I work and what I can do to make it better... plus it will wind up giving me another language to do AI work in... that said: From Java, I am used to thinking about external libraries of code as classes. The idea is neat, straightforward, and I like it. However, since I have been using RB (mainly as a project/gui tool) I have always thought that a module WAS an external class of sorts. Further reading about modules, though, seems to indicate that the real goal of a module is just a central location for a collection of methods and properties and is not instantiable. But wait: that's just a finalized class that inherits from Object, right? Besides subclassing, is that the real difference. Is a module just a class that doesn't inherit from anything and can't be instantiated or subclasses? When would it be better to use a module than a class, then? Are there performance issues? Anything else to be aware of? Just throwing it out there. Thanks in advance, dave _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives of this list here: <http://support.realsoftware.com/listarchives/lists.html> _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives of this list here: <http://support.realsoftware.com/listarchives/lists.html>
