Better HN
topnewbestaskshowjobs
Log inSign up

arthurlewis

2 karma · joined Dec 1, 2014 (12y ago) · 4 submissions

Submissions

comment 1y ago · link · parent

Couldn’t get this idea out of my mind so I went back to the GoF text:

> Decorator subclasses are free to add operations for specific functionality. For example, ScrollDecorator’s ScrollTo operation lets other objects scroll the interface if they know there happens to be a ScrollDecorator object in the interface.

comment 1y ago · link · parent

Well, until you need different `colour_coded_availability` methods for different contexts. Helpers get a lot done, but there are absolutely use cases for a separate presentation layer.

comment 1y ago · link · parent

OH WAIT I SEE IT I'M THINKING OF THE FACADE PATTERN. Yes, the Ruby community does tend to conflate Decorator, Facade, and Presenter in very confusing ways.

comment 1y ago · link · parent

> It's not only that an actual Decorator should not introduce new methods

Maybe I'm misreading you, but I've never seen a definition of the Decorator pattern that doesn't involve new methods on the Decorator. If that's what you mean, can you say more? If not, what do you mean?