DEV Community

Discussion on: I am a mediocre developer

Collapse
 
sinewalker profile image
Mike Lockhart • Edited

I have noticed a pattern in web development when integrating web services: there is an unreasonable faith in the data returned by APIs.

Especially if that API was written or managed by the customer. Web Dev's appear to have forgotten about GIGO (Garbage In, Garbage Out)

So I would add to this post: assume the input is broken

XML will be malformed. Check for it.

Do your own maths, don't rely on a calculated sum

Dates will be American instead of ISO. In fact, use a date picker for user input. Type check input on the front end.

Customer data need to be uploaded to your server? Ok then, zero-bytes files are a Thing.

There will be characters that are non-UTF-8.

There are so many ways to fail. Check your input and handle bad data gracefully and loudly. Don't assume your input will never be bad