in reply to Re: Structural Elegance
in thread Structural Elegance

That is you propose to make the tramp data a member of the object? This is a bit similar to making it a global variable - that is you make it here global in the object (dynamic scope, instead of global in the module - lexical scope).

Replies are listed 'Best First'.
Re^3: Structural Elegance
by BrowserUk (Patriarch) on Apr 20, 2005 at 20:26 UTC

    But if you give it a fancy name, "Singleton", then the global is acceptable...to some.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco.
    Rule 1 has a caveat! -- Who broke the cabal?
      And if you call it a "monad", a different group of people gets excited. But wait, monads are threaded through, which makes them tramp data instead, I guess... :-)

        :)

        Maybe you could re-term "side-effects" as "concurrent behaviours" and start a whole new fad for another old idea? If you do it, it just might work!


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        Lingua non convalesco, consenesco et abolesco.
        Rule 1 has a caveat! -- Who broke the cabal?
Re^3: Structural Elegance
by Ovid (Cardinal) on Apr 20, 2005 at 23:29 UTC

    Well, in this particular case, I showed a non-OO way of handling this, so it's not really a data member of an object, but it can be (in this case, it would be class data.)

    The particular point, though, is that extraneous arguments should not be passed through a call chain. Providing an access method is merely one step in a refactoring. Perhaps it's all that's needed. Perhaps a greater refactoring is needed. Who knows? It's much cleaner than tramp data, though.

    Cheers,
    Ovid

    New address of my CGI Course.