Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
_sh
on Nov 6, 2009
|
parent
|
context
|
favorite
| on:
How to write untestable code
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.
viraptor
on Nov 6, 2009
[–]
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
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: