When writing object oriented code, a pretty useful technique is delegation–letting one object figure things out by sending messages to another object.

you are viewing a single comment's thread
view the rest of the comments
[–] 1 point 1 month ago (1 child)

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

  • source
  • hideshow 1 child comment
  • [–] 1 point 1 month ago*

    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

  • source
  • parent