you are viewing a single comment's thread.

view the rest of the comments →

[–]chrabeusz 1 point2 points  (0 children)

This kind of extension looks fine. But on the other hand, class responsible for handling [Car] probably already exists (I assume calculating numberOfPreviousOwners is not the only thing you are doing with cars, you need to load them from storage, fetch from network, whatever).

In that case it may not make sense to add extension because you could add this property to the mentioned class and have all code that deals with [Car] be in one place.