Skip to main content

Timeline for User class design

Current License: CC BY-SA 3.0

7 events
when toggle format what by license comment
Apr 19, 2012 at 14:52 comment added Konrad Rudolph @Paul You can’t but it’s horrible overkill. Unit testing isn’t problematic by the way, only mocking is. And I find that seriously overrated. Not because it’s not useful, but it makes the architecture much more complex and consequently has a very bad cost/benefit ratio so I only use it when it’s actually required.
Apr 19, 2012 at 14:47 comment added Paul @KonradRudolph If you can avoid tight coupling and can unit test easily with static methods then let me know. I am in the PHP chat room frequently.
Apr 19, 2012 at 13:14 comment added Konrad Rudolph Static methods don’t contradict OOP, and both can be used in conjunction. Having a static method here is totally fine. Saying that there is no place for static methods in OOP is simply wrong. This would preclude constructors which are just static methods in disguise. Put differently, OP’s getUsers is a constructor in disguise. Again: this is a totally valid pattern.
Apr 19, 2012 at 10:56 comment added Paul Thinking about it a bit more, maybe a Data Mapper class to retrieve all of the users is what you want. Search for Data Mapper pattern.
Apr 19, 2012 at 10:53 comment added Paul Yes, I think the one you just posted (your previous version) was good OO. Its a bit hard to know what will be best without knowing the full details of what you are trying to achieve. An important thing will be that you match the objects in your solution to the problem at hand. Also, staying clear of static will definitely be beneficial. Good luck!
Apr 19, 2012 at 10:40 comment added Anonymous Hey Paul, thanks for taking the time to answer. Please see the part I added to the bottom of the question in light of what you said.
Apr 19, 2012 at 10:32 history answered Paul CC BY-SA 3.0