No Clever Code

Page 2


The Detail-Backfill Pattern or DataLoader Before It Was Cool

While optimization is often premature and, therefore, the root of all evil1, using an efficient design for data access is choosing a good path rather than paving a bad one. A common task for APIs is to retrieve a “page” of master rows and their detail rows (e.g. Invoice and Items), as well as a total count of the master rows that match the given criteria. Here are three ways to get the data from a standard SQL database:

Option 1: for each row of the master table query result, execute a query per detail table to get the detail rows for that master row (also known, derisively, as N+1)

Pro

  • initiative design
  • allows easy pagination of master rows

Con

  • slow
  • lots of little queries burden SQL server and network
  • data might change during the process if the option does not include a potentially huge transaction (because the last query returns long after the first one)

Option 2: join

...

Continue reading →


The Words of the Seven Percent

“… a landmark UCLA study showed that gestures count for a whopping 55% of the impact you have on an audience, while your tone of voice makes up 38%. Your words? A measly 7%” –Forbes

Words, then, are the minority player in presentations. Indeed, to help detect falsehood, one should ask for a written summary to remove the 93% of the demagoguery and hand-waving. Seven percent is not zero, however, and some audiences do pay attention to some of the words: the words that annoy them. If the words are also on visuals (like slides1), they count for more than seven percent

The word impact as a verb (e.g. “This will impact sales”) makes me twitch. I prefer the verb affect, and I accept that this is a lonely preference. Likewise, performant, value proposition, upskilling, etc., will break my undivided attention

Important, perhaps, to an engineering or scientific audience: theory vs. hypothesi...

Continue reading →