This does, of course, raise the question of why there aren't class
constants or true static methods or variables in RB. If there were
then this question would be mostly moot.
If people want to add their names to the feature requests for these
items go to bugs:
fynjrrff, kvlwhzig, bserwazq which all ask for these feature in
different ways.
-Eric
On Friday, October 25, 2002, at 05:34 PM, TM Lutas wrote:
This seems to be going one way. Is there any reason not to put
something in a module?
Encapsulation. Placing application-specific, non-reusable code in
the Application class is more OOP than using modules. Methods and
properties of the Application class exist in their own namespace
reducing the chances of name conflicts.
On the other hand, modules come in handy when you want to create
libraries of common functions that you will use in many programs.
For instance, I have a module containing often-used string handling
functions and another for file handling. Modules are also important
if you want to define global constants. (I don't like defining
constants in properties because it introduces the possibility of
inadvertently changing the value, thus producing a hard-to-find
bug.) Methods executed from modules also tend to be slightly faster
than those in classes, but this is only apparent when calling
functions many thousands of times. And the execution speed is also
affected by where you call the function from so, your mileage may
vary.
Bob
---
A searchable archive of this list is available at:
<http://dbserver.realsoftware.com/KBDB/search.php>
Unsubscribe:
<mailto:realbasic-betas-off at lists dot realsoftware dot com>
Subscribe to the digest:
<mailto:realbasic-betas-digest at lists dot realsoftware dot com>
--
______________________________________________________________________
Eric Harris-Braun gbs at panix dot com
---
A searchable archive of this list is available at:
<http://dbserver.realsoftware.com/KBDB/search.php>
Unsubscribe:
<mailto:realbasic-betas-off at lists dot realsoftware dot com>
Subscribe to the digest:
<mailto:realbasic-betas-digest at lists dot realsoftware dot com>
.
|