Shared State and Customer Confusion
Let’s go back to the good old days of writing web applications in PHP for a paragraph or two. When running PHP under Apache or nginx, every HTTP request resulted in a clean interpreter with completely new state. Developers had to explicitly ask for state to be shared - through the $_SESSION
global, by persisting state on disk, or by saving state to some backing data store. This made developing applications amazingly simple. A PHP page was something like a pure function, producing consistent, predictable output based on the state of the underlying data store.
Now, consider this little bit of Python code:
class PatternRemixer(Remixer):
_samplecache = {}
def remix(song):
do some stuff
for key in song:
if key not in self._samplecache:
self._samplecache[key] = self.render_audio()
self.output(self._samplecache[key])
Any...