Skip to main content
20 events
when toggle format what by license comment
Mar 22, 2017 at 2:53 comment added Pharap This does not appear to be is not the sort of problem function objects were introduced to solve. Function objects are about delayed execution (something is hard to compute or not needed yet, so don't compute until you have to), not throwing function objects in as arguments because you can.
Mar 22, 2017 at 1:33 answer added Sophie Swett timeline score: -1
Mar 21, 2017 at 19:47 vote accept NightWatchman
Mar 21, 2017 at 16:22 comment added Nathan I like DI, I think the problem here is just that it would have been better to inject something like a IRateProvider and IRateFormatter, or maybe just a IRateProvider, rather than messing around with Funcs. I don't think strategy pattern is required here.
Mar 21, 2017 at 16:20 comment added cat @Jules dependency injection cancer
Mar 21, 2017 at 16:12 vote accept NightWatchman
Mar 21, 2017 at 16:14
Mar 21, 2017 at 13:26 comment added Jules @IdanArye DI cancer?
Mar 21, 2017 at 12:43 comment added Machado Related Article on Joel's, by BenjiSmith: Why I hate frameworks
Mar 21, 2017 at 12:39 history tweeted twitter.com/StackSoftEng/status/844166644171784192
Mar 21, 2017 at 11:52 answer added ratchet freak timeline score: 18
Mar 21, 2017 at 11:51 comment added patchandthat I think this is really just the strategy pattern in disguise, instead of passing objects which contain your functionality, you're passing delegates. Although seeing both functional-programming and C# tags simultaneously makes me think I might be misunderstanding completely.
Mar 21, 2017 at 7:49 comment added Thomas Junk A better way is making use of closures where you pass the parameter itself to a function, which in return gives you a function referring to that specical parameter. This "configured" function would be passed as a parameter to the function, which uses it.
Mar 21, 2017 at 7:11 comment added Christian Sauer If you have to pass in a function with arguments (say because you want to set some options in advance, but others have to be computed by the inner function), I would recommend function currying. I have never attempted to do it in C#, but it'S easy in F# and Python and feels perfectly natural.
Mar 21, 2017 at 2:25 comment added aroth I struggle to see why this structure would be used in the first place. Surely it's more convenient (and clear) for GetFormattedRate() to accept the rate to format as a parameter, as opposed to having it accept a function that returns the rate to format as a parameter?
Mar 20, 2017 at 23:30 comment added Idan Arye The DI cancer has spread so far...
Mar 20, 2017 at 23:29 answer added Jack timeline score: 41
Mar 20, 2017 at 23:22 answer added Stack Exchange Broke The Law timeline score: 106
Mar 20, 2017 at 23:19 history edited NightWatchman CC BY-SA 3.0
added 33 characters in body
Mar 20, 2017 at 23:15 review First posts
Mar 21, 2017 at 12:06
Mar 20, 2017 at 23:11 history asked NightWatchman CC BY-SA 3.0