3 ms·
I’m having flashbacks to some contract Java developers who were calling toString() on deserialized JSON objects and then parsing the output (old school index/su
by acdha 4y ago
I’m having flashbacks to some contract Java developers who were calling toString() on deserialized JSON objects and then parsing the output (old school index/substring, not even regex) because they insisted it was too hard to use the built-in accessors. Bonus points for then trying more kludges when they got a reminder that JSON does not guarantee object key order so they couldn’t write code assuming values would be adjacent.
They also did that exact same thing parsing dates, except that they flubbed the logic and IIRC had an off-by-one on the month for the constructed Date object.
- Waterluvian 4y agoLots of JSON libraries can be told to enforce key order. And you’ve gotta remember that if you’re going to do something so ghoulish!
- acdha 4y agoThese were definitely not the kind of developer who read the documentation looking for options like that. I've mostly avoided Java for years and still found myself going “this is like 20 lines of code [badly] re-implementing a built-in library function” on almost every code review.