Why use tuples instead of objects?

后端 未结 10 1983
别那么骄傲
别那么骄傲 2020-12-24 05:29

The codebase where I work has an object called Pair where A and B are the types of the first and second values in the Pair. I find this object to be offensive, because it g

10条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-24 05:35

    This is just prototype-quality code that likely was smashed together and has never been refactored. Not fixing it is just laziness.

    The real use for tuples is for generic functionality that really doesn't care what the component parts are, but just operates at the tuple level.

提交回复
热议问题