Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

No, it's a lot like saying that composition of objects (using a basic feature called "properties") is a design pattern - which it is: GoF call it Composite. The idea that design patterns have to be large and possibly overwrought elements is untrue. Composing functions _is_ a design pattern. Consider how it makes parsec different to bison.


The idea that design patterns have to be large and possibly overwrought elements is untrue

They everything is design pattern. Except it is not.

I don't interested in what the GoF says, but in the FP world this is not pattern. It's just an another function actually

  (.) :: (b -> c) -> (a -> b) -> a -> c

(And referential transparency, lambda calculus, higher-order functions and HM type inference are not design patterns)


You are just deliberately misrepresenting what they called the composite pattern to make it sound simpler than it is. Nobody said anything about things being large or overwrought, that is you bringing your bias to the discussion. Just proclaiming "function composition is a design pattern" is useless, support your claim. Parsec being different from yacc doesn't in any way provide support for the notion that function composition is a design pattern. In a language where function composition is possible, but isn't available directly in the language, then function composition could be a design pattern. And the pattern would be describing how to implement the composition operator. Given that I do not need to implement it, it is clearly not a design pattern.


> Given that I do not need to implement it, it is clearly not a design pattern.

We have a definitional disagreement: this is a bad definition. Here's what I think, straight off page 3 of GoF:

> A design pattern names, abstracts and identifies the key aspects of a common design structure that make it useful for creating a reusable [object-oriented] design.

Composite is a great counter example to your definition of a design pattern, because it is an example of an important pattern (IMO the most important in GoF) in which no special implementation is required.

PS. Calm down and stop accusing people on the internet of bad faith


The definition you quoted matches the one I gave. And as I already said, composite does require an actual design pattern. It isn't just "use properties", I think you might want to re-read the book.

P.S. If you want people to think you are making a good faith attempt at discussion, making passive aggressive douche notes like this is counter productive.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: