Skip to main content
10 events
when toggle format what by license comment
Oct 15, 2015 at 22:43 answer added cbojar timeline score: 1
Oct 15, 2015 at 22:22 comment added coredump Prototype inheritance
Oct 15, 2015 at 21:43 answer added Kasey Speakman timeline score: 1
Oct 15, 2015 at 9:51 comment added Spotted I would replace the ??? by Anti-.
Oct 15, 2015 at 6:04 comment added John Peters The GOF said this "Favor composition over inheritance" your 2nd example is what I call vertical inheritance, a term I coined when studying what composition is. In Composition your factory could take in an Interface of type fruit. Allowing the resulting object to be composed into what is desired from the outside. I call this horizontal inheritance because the container had a fruit property. That container then although not technically a fruit has the property or containment of a fruit.
Oct 15, 2015 at 0:38 comment added Robert Harvey Possibly the Strategy pattern? github.com/ochococo/Design-Patterns-In-Swift#-strategy
Oct 15, 2015 at 0:31 comment added Senseful I'm basing this loosely off of Swift.
Oct 15, 2015 at 0:27 review First posts
Oct 15, 2015 at 14:08
Oct 15, 2015 at 0:27 comment added Robert Harvey The first pattern looks like a variation on Abstract Factory, though with a decidedly functional bent. Something you might see in Javascript, which is probably the example language. It's obvious advantage is that it prefers composition over inheritance. Note that many of the GOF patterns are just workarounds for things that functional languages can do inherently.
Oct 15, 2015 at 0:24 history asked Senseful CC BY-SA 3.0