News for hackers. Stuff that matters.
Re:Am I Doing it Wrong? by aphyr on Friday June 22, 2012 @06:49PM (#4149280)
As a note, I think this particular variant of SRP is adopted from Java, where there is no concept of a function not bound to an object. You might be tempted to use static methods for plain-old namespaced functions, but there's a second quandary: it is really difficult to manipulate anything but instances in Java. Since there are no first-class functions, you can't very well pass these functions around to configure other objects, etc. So you wind up with layers of OOP scar tissue around the problem: DI frameworks, Handlers, Managers, Strategies, Factories, etc.
Re:Am I Doing it Wrong? by wonderzombie on Friday June 22, 2012 @07:08PM (#4149357)
"OOP scar tissue" is my new favorite phrase.

To add some real value, by this I mean that I've run into this crap a lot. In Java, sometimes I want the ability to have a function which returns other functions based on an input. This is doable in a variety of languages other than Java.

In Java, I didn't call it such, but I ended up writing a FactoryFactory. (I am not proud.) I had one layer of abstraction to produce Foo objects with a certain configuration, and a layer above that to parameterize the creation of a Foo-creator. sigh. Scar tissue indeed.

Re:Am I Doing it Wrong? by ToastOpt on Saturday June 23, 2012 @02:00AM (#4150175)
Yup, I've seen this as well, way too often. Rather than a function, you get a class, rather than arguments you get constructor parameters, and then the get stuck at what to name the method that actually does anything.