Skip to main content
15 events
when toggle format what by license comment
Jul 12, 2017 at 17:22 comment added Frank Hileman @DocBrown you are correct.
Jul 12, 2017 at 6:27 comment added Doc Brown @FrankHileman: you are correct about what patterns are, nevertheless your logic is flawed. The fact a pattern is a high-level solution, or the fact the same pattern can be implemented in different variants does not prevent one to implement a pattern in a wrong way. For example, the strategy pattern has a clear desciption in the GoF book, and it has the purpose of decoupling the "context" from a concrete strategy. If I make an attempt implementation but introduce something which invalidates the decoupling, it is IMHO sensible to say "I violate the (purpose of) the pattern".
Jul 12, 2017 at 1:37 vote accept ÁEDÁN
Jul 11, 2017 at 23:08 comment added Frank Hileman @DocBrown patterns are supposed to be higher level structures than specific code implementations, to express things that limitations in the language etc make difficult to reuse as library constructs. So one pattern implementation is never more correct than another. That is all I meant.
Jul 11, 2017 at 19:58 history tweeted twitter.com/StackSoftEng/status/884864615053639680
Jul 11, 2017 at 14:30 comment added Doc Brown @FrankHileman: honestly, this sounds nitty. To my understanding, it is perfectly possible to violate the "strategy pattern by the book". I guess what you really meant is "violating a pattern is not necessarily a bad thing" (if the own solution is still a good one). However, in this case, by implementing the code for picking the right strategy subclass directly in the ConfigurationParser, not the strategy pattern itself would be "violated", but the SRP. The solution for this was already mentioned by T.C. below, namely injecting a factory into the parser.
Jul 10, 2017 at 22:43 comment added Frank Hileman You cannot "violate a pattern", since patterns are simply ideas for creating your own custom solution.
Jul 10, 2017 at 18:23 answer added Tulains Córdova timeline score: 4
Jul 10, 2017 at 17:37 comment added Fuhrmanator You can encapsulate the details in a simple factory. It's often used with strategy to insulate clients.
Jul 10, 2017 at 16:40 comment added Robert Harvey You might consider weighing the pros and cons, instead of just relying on your gut. High decoupling does you no good if the system can't perform its essential functions. I consider "correctness" of secondary importance.
Jul 10, 2017 at 16:39 comment added ÁEDÁN Haven't gotten that far.
Jul 10, 2017 at 16:33 comment added Robert Harvey Cool. So how will you solve the problem of processing the stream properly? Or is that largely irrelevant?
Jul 10, 2017 at 16:26 comment added ÁEDÁN My gut reaction is the need for a higher degree of decoupling.
Jul 10, 2017 at 16:23 comment added Robert Harvey Which is more important to you: the ability to know what kind of stream it is so that you can process it properly, or the need for a higher degree of decoupling?
Jul 10, 2017 at 15:44 history asked ÁEDÁN CC BY-SA 3.0