Replacing variable with function/class indicating dynamic value
<p>In my program, I draw some quads. I want to add the functionality for them to scale up, then down, then go back to being static (to draw attention). In the quads I have:</p>

<pre><code>self.scale = 10
</code></pre>

<p>Making scale change according to sin would be nice. But adding frequency, amplitude and logic to my already bloated quad class is something I take as a challenge to avoid.</p>

<p>Something like this:</p>

<pre><code>class mysin:
    def __init__(self):
     self.tick = 0.0
     self.freq = 1.0
     self.ampl = 1.0

    def update(self, amount):
     self.tick += amount

    def value(self):
     return math.sin(self.tick)
</code></pre>

<p>That class would also add itself to the logic system (getting update calls every frame). I would then do:</p>

<pre><code>quad.scale = 10 # for static quad
quad.scale = mysin() # for cool scaling quad
</code></pre>

<p>The problem is that some calculations expect scale to hold a value. I could of course add another class where value() returns a (previously saved) constant value and adapt all the calculations.</p>

<p>What I want to know now is... does this have a name, is it a valid technique? I read the wiki article on functional programming and this idea sprung to mind as a wacky implementation (although Im not sure it qualifies as FP). I could very well have been driven mad by that article. Put me back in line fellow coders.</p>
