in reply to what is a propper way to make a chunk of data accessible to all my packages for retrieval and modification ?

Grandfather has pointed you in the standard direction, which is to use a singleton object. However, I'm more willing to challenge your assertions that:

I need everything in the Webapp namespace to access the %Webapp::Bathroom data. And I need any module I want to be able to modify data in there as well.

That just sounds like an incomplete design* to me. There are several reason why I don't think you really want what you think you want. Some are webapp-specific and some aren't.

*: If you claim it's a complete design, then it's a bad design. I went with the nicer possibility.


My criteria for good software:
  1. Does it work?
  2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
  • Comment on Re: what is a propper way to make a chunk of data accessible to all my packages for retrieval and modification ?

Replies are listed 'Best First'.
Re^2: what is a propper way to make a chunk of data accessible to all my packages for retrieval and modification ?
by leocharre (Priest) on Feb 20, 2006 at 05:55 UTC

    oh boy.. this is freaky. oo.. so.. you never actually touch or interact with the data in an object.. ever. you ask for it like you would ask your mother to please get you a coke from the kitchen - instead of getting it yourself. wow. this is shocking. i feel suddenly.. weirded out to all heck.

    i think i can see the use in this.. it really does keep stuff appart from each other, doesn't it ? - instead of having a master move memorized by which you reach into the cookie jar.. you have a trained monkey that goes to the cookie jar and brings it back to you.. how this happens is beyond your control or interest.. doesn't this slow things down a ton?

      Well, it's the concepts of "specialization" and "localization". You create an expert in the field of cookie jars and have that expert be the only person who knows how to handle cookie jars. That way, you can pretty much guarantee that no-one's going to screw up the cookie jar because they didn't know the correct way to get a cookie out while three other people are trying to do so as well.

      As for slowing things down ... which do you prefer - "slow and correct" or "fast and wrong"? Except, "fast and wrong" is usually "runs fast, is wrong, and took way too long to write", while "slow and correct" is more often than not "runs fast enough, is provably correct, and came in ahead of schedule". I know which one I prefer ...


      My criteria for good software:
      1. Does it work?
      2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
        very good points. thank you.