10 ms·
>One of the main benefits of OOP is of course "polymorphism" (abstract base classes, interfaces), so naming any concrete class a "strategy" does seem a bit redu
by qwertyuiop924 10y ago
>One of the main benefits of OOP is of course "polymorphism" (abstract base classes, interfaces), so naming any concrete class a "strategy" does seem a bit redundant.
There are no abstract classes in JS: there doesn't need to be.
Anyways, that's not what I mean: I was talking about the Strategy design pattern, which is actually a way of implementing higher order functions in languages that don't have them: thus, implementing classes for it in JS would be very silly indeed.
As for Kay's vision of OO, it involves not only everything being an object, but extreme late binding. Java has neither.
- Roboprog 10y agoOK, gotcha. Somehow, I thought "strategy" was more general than just a single method/function to plug in. (confession: I have the GoF book, but don't remember every section) I think one of the best points PG (of YC) ever made was about programmers thinking in a particular language. "If Blub doesn't do it, you don't need it" (paraphrasing). Convincing the C++/Java/C# fans they need other features sometimes is quite hard.