Re:Never Use toString() for Behaviour
by Bartweiss on Wednesday December 04, 2019 @05:45PM
(#21708015)
This also goes for logging and even string-ification in a lot of popular Java libraries. It's certainly good to write methods like getName() if you foresee an issue with changes down the line, but precisely because toString is universal, it may well be invoked somewhere outside what you're writing.
[ Parent
| on HN ]
There are no comments on this comment yet.