It is indeed oop, and thats a method that i've played with!
In that case, if you're still finding that you're creating lots of instances of your validation object in different places, I'd suspect that there is a layer of abstraction that's being missed somewhere.
Are their other arguments that are similar between multiple instances? Would it make sense to make a factory object of some kind for creating similar validation objects?
I'd tend to want to keep passing in the ref somewhere because it keeps everything decoupled and makes testing easier.
|