Re:I’m Adam, and i’m a recovering Singleton addict.
by demallien on Monday May 02, 2011 @10:33AM
(#2506369)
Well, that is a workable solution, but then, I'm sure you're already aware of that, seeing as you use it already ;) Personally I prefer having the object appear in the published interface, it helps highlight the existence of a dependency, but your way doesn't seem horrible either. I suspect that it depends a lot the language you're using. I'm a C programmer, and optional parameters are quite verbose in C, so I would never choose your solution, but in Ruby or Javascript your solution could be quite clean.
[ Parent
| on HN ]
Re:I’m Adam, and i’m a recovering Singleton addict.
by jasonlotito on Monday May 02, 2011 @01:46PM
(#2507128)
My big concern is always implementing a solution and not seeing an otherwise obvious problem. Hence the question. =)
As a PHP guy, setting up optional params are easy, so I like the solution.