Genocidal Refresh: A Software Antipattern

A Scorched-Earth Approach To Refreshing Your Model Or View

The Problem

Genocidal Refresh is the software development anti-pattern when all model or view objects are disposed of and rebuilt, when it’s just as easy and far less time-consuming to add, remove, or change the affected items.

The experience that inspired my coining this phrase came from a backup application that did this whenever a hard drive partition was mounted or unmounted.  The app also went to great pains to make sure any change was immediately visible, far more often than the time it took for the screen to refresh.  Most users don’t plug or unplug their devices every few seconds, so the average user would not see this, but during testing, or when a user plugs in a drive with multiple volumes in it, the refresh was so visible and distracting you’d think Zoom and The Flash were doing the jitterbug with each foot movement of a triple-step alternating between Earth-1 and Earth-2.

A similar gyrating refresh happened every second or so when the number of files backed up changed, albeit within the view representing a volume.  Nevertheless, the number of photos backed up might drop from 50 to zero, then jump to 100, then back to zero, then to 104, etc.

Such an effect might be entertaining if the app were a game called Whack-A-File.

Believe it or not, I actually had a prospective client in the mobile phone forensics industry want me to replicate this visual look-and-feel.

When a similar visual cacophony happened during a major refactoring of a prominent tax filing application running on the Mac, where the tab buttons across the top of the window changed their selected state multiple times each second, I jokingly called it a game of Flappy Tabs.  My team had a good laugh, but thankfully no one believed we shouldn’t fix the bug.

The Solution

Genocidal Refresh typically makes its way into software as an initial attempt to get something working, usually while prototyping for a demo or verifying how a service or framework functions, and that’s usually acceptable at that stage, but one must always make a conscious effort to refactor such code if the software moves to production quality.

More modern frameworks, methods, and changes in the languages available provide the ability to selectively reload views or cells rather than tearing down a complete view and rebuilding it, as well as provide a correct sequence of when changes should be made.  Also, with Core Animation now ubiquitous on all of Apple’s platforms, even when such a refresh may be necessary, its visible effect is more manageable.


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s