|
|
|
|
|
by Draiken
820 days ago
|
|
> If you prefer inheritance over composition That's not what this boils down to. These are procedures. OOP is generally about objects sending messages to each other. So this solution is all about executing procedural calls, which has nothing to do with inheritance/composition. You can very easily have OO code with composition without having to rely on everything having one single interface "call/run/execute". |
|
Pipeline steps are command objects (a pretty standard OO pattern), so they have a single entry point / public method. But they can still fully leverage any other OO pattern in their implementation. The more complex ones I use may instantiate other objects, pass messages between them, etc.
But the single-method #call API is what makes composition easy. See Rack, or any number of middleware-style designs, for other common uses of this in Ruby.