Wednesday, October 31, 2018

A tale of a software engineer - you vs. them


They write front-end apps hitting REST endpoints sitting on your server. They were tasked to show unique values in a drop-down list in the app.

They use a client library for their favorite language which calls your REST endpoints. There was no queryUnique method the library, so they ask the developer maintaining the library to add the method. 

The developer maintaining the library, The developer adds a new method queryUnique, which turns around and calls query with returnUnique boolean as clearly stated in your REST doc. 


You are the backend engineer. You maintain and tune the REST API, the server, the networking, and the database.

They write front-end apps hitting REST endpoints sitting on your server. One of their apps performs badly when retrieving unique values. You get to work.

You intercept the query in the database and you notice that their app is doing a full-table scan retrieving all rows and all from a table which has a million row.

"Why are they pulling all rows from the table, that is stupid." You said


"The app is doing a full table scan retrieving all rows that is why it taking a long time." You said confidently. "What are you trying to do?"

"That doesn't sound right", They said. "I mean we added a new method that returns unique rows for a column." 

"What a bunch of tools", You said to yourself. "Are you doing the filtering in the client? you really shouldn't, you should use returnUnique parameter in the REST API" 

"That's what we used, here is the code." Said the library developer proudly showing his code.

"That looks .. right.." You said after a nervous pause.