Re: The use of modules (or not)



If you really want to use globals, google for the singleton pattern. There
is absolutely nothing wrong with "global" variables in this context, as long
as they are managed properly and you protect the implementation sufficiently
from changes. They are essential in many circumstances (I use them for my
"cache manager" in the software I am currently using) - and yes, you can
define your singleton class in a module for global access.


"Morten Snedker" <morten_spammenot_ATdbconsult.dk> wrote in message
news:1epfb1p43l68b73h5saohti3c2208pqhc4@xxxxxxxxxx
> I've read that modules in .Net are mainly for backwards compability.
> Is this true?
>
> If I have variables I want to be exposed to all classes (regular
> classes, forms etc), I'd find it natural to put these in a module and
> dimension them Public.
>
> Or is the proper way to do it differently?
>
>
> Regards /Snedker


.



Relevant Pages

  • Re: Singleton Pattern
    ... that uses the singleton pattern to create just about everything. ... When you skip globals and start to pass variables ... you alter your design so that you don't have to do that as ... you discover that not everything needs the database and your design ...
    (comp.object)
  • Re: The use of modules (or not)
    ... > If you really want to use globals, google for the singleton pattern. ... > context, as long as they are managed properly and you protect the ... You dont need a singleton to make globals. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: The use of modules (or not)
    ... Yes thats true - and of course if you are using the singleton pattern, ... singleton object can be the only instance. ... >> If you really want to use globals, ...
    (microsoft.public.dotnet.languages.vb)
  • Re: scope of static?
    ... when one declares some public method or variable ... A static exists within the scope of a class loader. ... instance field is global within the context of an instance". ... I have seen "globals" that exist within the context of a JVM; ...
    (comp.lang.java.help)
  • Re: Looking for real world examples to explain the difference between procedural (structured?) progr
    ... stateless. ... quaternion support, ... ... obviously you do need a context because you are ... I usually use context structs (as opposed to globals) for most things, ...
    (comp.object)

Loading