News for hackers. Stuff that matters.
Re:How (not) to write Factorial in Java by dspeyer on Wednesday January 26, 2011 @09:06PM (#2146258)
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?

There are no comments on this comment yet.