Skip to main content
12 events
when toggle format what by license comment
Nov 25, 2018 at 22:33 answer added Fuhrmanator timeline score: 1
Nov 25, 2018 at 9:00 history tweeted twitter.com/StackSoftEng/status/1066617585838510080
Nov 17, 2018 at 16:26 comment added Telastyn Dude, I have been programming for 30 years. Your application needs to choose between SQL and Test. Somewhere there is a decision being made. Maybe you wrap that in a class and call it a Factory. Maybe you wrap that in a smaller class and call it a Strategy. Maybe your build does it when it sets config variables. Maybe you just have two consumers that inject different things. But again, this is missing the point. Programming isn’t patterns and uml. Certainly not for this sort of thing, which shows up thousands or millions of times in a program.
Nov 17, 2018 at 15:17 answer added Filip Milovanović timeline score: 4
Nov 17, 2018 at 15:15 vote accept Corey P
Nov 17, 2018 at 15:11 comment added Corey P @Telastyn Read the question a little closer and you'll find that it is not a decision between two databases. The problem is what class creates the database object. I don't think you understand the point of a design pattern. It's so much more than a simple if statement. Think of the IDatabase, SQL, and Test being packaged together by your programming team. You might want Test to be created, but it should have to be explicitly created by the client. Also, I can't go through every reason why something is insufficient. There are just too many answers that are wrong, to explain why each is wrong.
Nov 17, 2018 at 14:40 answer added amon timeline score: 3
Nov 17, 2018 at 8:43 answer added Jesus Alonso Abad timeline score: 4
Nov 17, 2018 at 8:05 answer added Paul timeline score: 3
Nov 17, 2018 at 6:13 comment added Telastyn Sorry about that, I was (and am) worried about running afoul of our code of conduct. But you’re right, I could at the very least provide feedback. This question... misses the point. I mean, how do you choose between one database or another? That is an if-statement, not a uml driven design pattern. Sure, an if-statement is usually a bad solution to this sort of problem, but it is the simplest thing that works. You don’t explain why this obvious simple solution is insufficient. Or why a basic config value would be insufficient. Or why dependency injection is insufficient. Or...
Nov 17, 2018 at 4:02 history edited Corey P CC BY-SA 4.0
Improved title
Nov 17, 2018 at 3:39 history asked Corey P CC BY-SA 4.0