News for hackers. Stuff that matters.
Re:How to write untestable code by viraptor on Thursday November 05, 2009 @06:41PM (#925076)
They are overkill. They're java man's substitute for lambdas. But if all you have is java, everything looks like an object.
Re:How to write untestable code by _sh on Thursday November 05, 2009 @09:17PM (#925293)
I don't understand this. Are you using closures as types? If so, what can they offer that factories can't? Trying to understand, genuinely curious.
Re:How to write untestable code by viraptor on Friday November 06, 2009 @05:13AM (#925781)
They offer the same functionality (more or less)... Factory objects just feel like overkill - usually they carry no state of their own, so why are they objects? If you could pass around functions, you could just use them instead.

    x_factory_proto :: GlobalParams -> InitParams -> X
    ...
    x_factory = x_factory_proto some_params
Re:How to write untestable code by tjpick on Thursday November 05, 2009 @09:15PM (#925289)
except ints, chars and bools.
Re:How to write untestable code by jrockway on Friday November 06, 2009 @12:41PM (#926459)
Further proof that premature optimization is the root of all evil. (Compilers can automatically solve the performance issue of boxed native types now, so there is no reason to provide the programmer with unboxed types. But of course Java does because... it's Java.)