No Clever Code

Read this first

Professionalism ∝ Passion-¹

In the 1990s, we were all searching for passion. Passion leads to Excellence, and we were all in search of that. In the 2000s, geeks took over, and geeks are just people who show their passion. The passionate, geeky software developer is a cliché, albeit a common reality. Many businesses and thought-leaders welcome that passion, and even try and motivate it

They enjoy the benefits of the drive and attention passion incites in software developers. They love the passion-fired momentum geeks have for “their” features. Build and support engineers can get passionate about their parts in a process even if customers never see it. But businesses also call on a different aspect of their workers from time to time: their professionalism

Compare the meanings of professional and its antonym amateur. The latter term might mean less-skilled (than a professional) or a dilettante. but originally it...

Continue reading →


Technical Debt Is Cholera, not Quicksand

Technical debt (TD) – the compromises we make to get stuff out the door – is more often acknowledged and occasionally quantified. We categorize the inefficiency and difficulty working with it—the “interest” on the debt—as an unfortunate cost. Fixing technical debt (paying down the “principle”) competes for resources with new development and tangible defects

The common TD horror story is changing the behaviour of badly-coded modules1. For example, spending hours adding a simple variation to an existing implementation, which has never worked consistently (and never been fully tested – let alone built for extension or reuse), is dangerous as well as frustrating. Without tests or clear documentation, we are never sure what good behaviour is, so extending that behaviour is often an exercise in faith2

In analyzing technical debt, we tend to mythologize it:

  • Technical debt is something...

Continue reading →


Python Decorators (and Digressions)

Decorators are a bit of meta-programming that allows one to add behaviour to functions and classes. The original function or class is wrapped in another function or class, and its name is pointed to that wrapper. Any use of that name will refer to the wrapper, not the original. This happens at “compile” time, not at runtime

The mechanics finds the function or class name prefixed by an “@”1 and applies it to the following function, class, or method definition. The compiler takes the completed definition and passes it to the decorator. The decorator returns a function or class

@a_decorator
class Foo(object):    "Foo" = a_decorator(class formerly-known-as Foo)
    ...

@a_decorator          "Bar" = a_decorator(function fka Bar)
def Bar:
    ...

rab = Bar()           rab is pointing to something created by a_decorator
                      that both wraps and acts like a Bar function
...

Continue reading →


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 →