When writing object oriented code, a pretty useful technique is delegation–letting one object figure things out by sending messages to another object.
You must log in or register to comment.
- 11 days
First of all, I don’t know what language this example is written in, but am I crazy for thinking that the bad imperative example is shorter and easier to read then the delegation?
I would go a step further and say you don’t need a VideoService class, just make that a function
- 11 days
It’s Ruby. And yes, it could be simpler as a plain, pure function. There is nothing that warrants having the temporary objects, no tricky long-lived state, no leased/shared resource, etc

