News for hackers. Stuff that matters.
Re:Going Beyond Code to Become a Better Programmer by koevet on Wednesday June 10, 2015 @03:47AM (#9690568)
How do you test the code that needs to send an email, if your "SendEmail" function is not in a separate class that can be mocked?

(ok, you can use a fake smtp server, but it makes tests more complex, imo)

Re:Going Beyond Code to Become a Better Programmer by spinningarrow on Wednesday June 10, 2015 @04:15AM (#9690629)
Why can't you mock the function? Mocks aren't specific to classes.
Re:Going Beyond Code to Become a Better Programmer by MichaelGG on Wednesday June 10, 2015 @05:50AM (#9690889)
If you're passing an object in, you can just as easily pass in a function.

Though I was explicitly referring to the case where the code is literally rewriting static functions into objects without using any actual OO features - just adding extra noise.