3 ms·
The problem with this is that best can change over time as languages evolve. For instance, formatting a date in Java: https://www.programming-idioms.org/idiom
by jdmichal 7y ago
The problem with this is that best can change over time as languages evolve. For instance, formatting a date in Java:
https://www.programming-idioms.org/idiom/99/format-date-yyyy-mm-dd/1112/java https://www.programming-idioms.org/idiom/99/format-date-yyyy...
The first listing was using a `SimpleDateFormat`, which for a long time really was the best way to do this. But now I would never recommend that over `String.format`, especially with the potential threading problems in the former. But the latter was not available until Java 1.5.
- skellera 7y agoAnd that’s fine. It would get voted down when it was no longer the best case.
- jdmichal 7y agoRealistically it would just sit there. At least that's what places like StackOverflow evidence. Meaning that whatever momentum it built up over the potential years of being the "right" answer would need to be overcome. Downvotes are typically reserved for wrong, not merely suboptimal. Especially since optimal and thereby suboptimal can change based on circumstance.