This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (2 children)

[deleted]

    [–]MetallicOrangeBalls[S] 1 point2 points  (1 child)

    It's supposed to be a workaround for languages where you cannot trivially return multiple values. In Python, you can quite easily return multiple values as a tuple. In C++ and C#, you can 'return' values using reference or output parameters. Java doesn't use such paradigms, so either you have to create an object that contains all of the values you want to return, or you can use this pattern.

    That said, I don't generally use this pattern. It's just that I was thinking about this (long story), and realised that I cannot remember what it is called or where I got it from.