News for hackers. Stuff that matters.
Re:How (not) to write Factorial in Java by dkarl on Wednesday January 26, 2011 @03:32PM (#2145006)
You're right; convoluted architecture has as much to do with Java as polar bears have to do with the arctic. They're two completely different things.
Re:How (not) to write Factorial in Java by lukesandberg on Wednesday January 26, 2011 @07:23PM (#2145959)
Fun fact: its called the arctic because of the bears. The word arctic comes from a greek word meaning northern bears. http://en.m.wikipedia.org/wiki?search=Arctic

And that is also why the antarctic has its name...because there are no bears there, just penguins.

Re:How (not) to write Factorial in Java by al-king on Thursday January 27, 2011 @12:22AM (#2146700)
While it's certainly named for bears, that appears to be be a folk etymology: as the Wikipedia article you link suggests, the Arctic is named for the northern bear constellations Ursa Major and Ursa Minor, so called since the time of Homer. The word Antarctic has been in English since the C14th ( http://www.etymonline.com/index.php?term=Antarctic ); a continent opposite to the Arctic was hypothesised long before Antarctica was discovered in the 17th century. Antarctic, then, means "opposite of north" rather than "no bears" - though I suppose the Ursa constellations were also not in the north :) and it's a nice mnemonic.
Re:How (not) to write Factorial in Java by Retric on Wednesday January 26, 2011 @08:33PM (#2146159)
I think there is a correlation between limitations of Java and how people use it. If functions where a first class operator a lot of the architectural fluff would be truly pointless. However, because of language limitations people start to think of "flexibility" as a feature and try and make a an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp
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?