Skip to main content
App management icon

This post is from the Apperian blog and has not been updated since the original publish date.

Last Updated May 26, 2011 — App Management expert

Patterns in Programming: Part II

App Management

Last week, in Part I, we began our audio excursion. In Part II, we resume our patterns of discovery in the parallel universes of software and music.

Software contains a meaningful purpose, realized during run-time execution; likewise, music's raison d'être achieves its ultimate goal when performed and heard.

Iteration and Passacaglia

  filenames = z.namelist()
  filename = ''
  for fname in filenames:
          filename = fname
Passacaglia and Fugue in C minor, Bach

We attempt to find a specific file contained in the IPA archive with our match pattern (variable rx), one file after the other, step by step, check by check. This repeated process happens blazingly fast, thanks to the advanced microcircuitry in contemporary CPUs. When a match occurs, we break out of the loop; it's done before we know it!

The repeated process in music can be presented in many different ways, with correspondingly different terms: rondo, theme and variations, canon, chaconne, passacaglia, etc.

The great conception of Bach's Passacaglia and Fugue (BWV 582) does not play itself out in a few milliseconds, like our python loop. Instead, the repeated bass line, over which continually shifting harmonic progressions are set, takes 600,000 milliseconds to complete. Admittedly, there's more going on in Bach's mind than in our simplistic iterator!

In the final analysis, I have to say that I really dig this organ piece.

Is the Tempo Just Right?

  expire_date = self.profile['ExpirationDate']
  diff_date = expire_date -
  days_until_exp = diff_date.days + 1
  if days_until_exp <= WARN_PERIOD_DAYS:
      self.warnings['expire_soon'] = True
Peaches en Regalia, Hot Rats, Zappa

Sometimes business rules involve time, schedules, and dates. And then you need to perform date calculations. We're not in base 10 anymore. Or base 2. We're actually in that weird place that I like to call date math.

Lucky for us python provides the flexible datetime module. It makes solving date calculation problems almost fun. Sort of.

What does this have to do with Frank Zappa's little masterpiece, recorded way back in the previous millennium in 1969? Peaches en Regalia has no expiration date!


Our python script is not yet done, insofar as this post is concerned. So please come back next week to join the conclusion of our musical journey in Part III.



More from the Blog

View more
Apr 30, 2020

Mobile Application Management: A Forward View

App Management
  IT Is Adapting in the Midst of the COVID-19 Pandemic The Coron ...
Read More
Nov 19, 2018

Breaking Down the New California IoT Law

Application Security
Recently California passed legislation regarding the security of all I ...
Read More
Nov 14, 2018

Securing mobile apps against reverse engineering and hacking [Podcast]

Application Security
Listen to Alissa Knight interview Ken Jochims about Arxan Technologies ...
Read More
Oct 25, 2018

Securing Connected Medical Device Apps [Infographic]

Application Security
Contact Us