4 ms·
Some pretty darn good advice in here. This might be slightly embarrassing, but it actually makes me appreciate the value of Factories; something I always thoug
by DannoHung 17y ago
Some pretty darn good advice in here. This might be slightly embarrassing, but it actually makes me appreciate the value of Factories; something I always thought was a little overkill for anything but GUI code.
- viraptor 17y agoThey are overkill. They're java man's substitute for lambdas. But if all you have is java, everything looks like an object.
- tjpick 17y agoexcept ints, chars and bools.
- jrockway 17y agoFurther 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.)
- _sh 17y agoI 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.
- viraptor 17y agoThey 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