3 ms·
The design goal here is that you can get factorials by calling a function, but decide how to compute them (cached or not, with the ability to add new algorithms
by dspeyer 16y ago
The design goal here is that you can get factorials by calling a function, but decide how to compute them (cached or not, with the ability to add new algorithms) by changing state. A dubious goal, but not completely insane.
In python, it would be 15 lines, and simple. No utils, factories, algorithms or singletons.
I imagine it could be done in more reasonable java than this, but could it really be done cleanly and compactly?