Engineering

Effective APIs

Points to remember in order to build robust APIs. 1. Validate date exists, not just the format. Most date format validators only verify the structure of a date, but not the validity of the date itself. In other words, the date 1989-02-29 would pass validation even 1989 is not a leap year. Therefore, it’s a good idea to parse the date string into a date type and respond with a descriptive error in case an Exception is thrown.

Understanding WSDLs

I’ve integrated with a number of systems through SOAP Services. SOAP Services are described using WSDL files (Web Service Description Language). I felt it was worth taking the time to understand the structure of these files. I drew this diagram to summarise the structure: A WSDL is an XML file that defines one or more Services. Each service can have one or more endpoints, where each endpoint is a remote procedure call.

Why is this codebase such a mess?

When I first started working professionally as a Software Engineer (an Android developer, to be specific), I worked on a codebase that would read configurations from an XML file. I would say that 90% of the crashes in the app were because of the optimistic way the XML file was parsed. I asked my team lead, “Who wrote this? I’m always fixing this,” to which he replied, “He was a talented guy.

order_id PRIMARY KEY AUTO INCREMENT

Some time back, I had a system design interview. One of the questions that I was asked was: “How would you assign unique IDs in a distributed event processing system.” I proposed UUIDv7, however the interviewer didn’t agree. Then I suggested Snowflakes but nah, he didn’t like that either. After the interview, I did a deep dive in Distributed Sequencers and: 1. I discovered the correct answer is Vector Clocks.