Skip to main content
App Management Individual Blog Image

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

Last Updated May 18, 2011 — App Management expert

Patterns in Programming: Part I

App Management

Just so I don't mislead you, this is not about Adapter, Bridge, Abstract factory, and other dry (yet important) software design ideas.

Instead we will discuss patterns of the programming process and their relationships to musical expressions. This is, more or less, a personal exposé into one of my approaches to writing software.

Like many people engaged in a solitary activity, it often helps to incorporate music as part of the sonic landscape. It is typical to place my multi-GB collection into shuffle-by-track mode; this keeps me just enough on edge so I don't fall into a whispy, dreamy state of mind... I wouldn't want to end up in some error-prone alpha state while typing out, for example, a business-critical algorithm!

Exposition Comes Before Development
 

    if __name__ == '__main__':
        main()
        sys.exit(0)
 
Sister Rosetta Goes Before Us, Alison Kraus

Ok, I'm writing a python script, just getting started, and this wonderful tune appears inside my head. The beautiful melody is far more interesting than our mundane main() statement.
 

    def get_options():
        version_info = 'checkipa: version %s' % (VERSION_NUMBER)
        p = optparse.OptionParser(version=version_info)
 
Fuge Nr. 20 in A minor - WTC Book II, Bach (Glenn Gould)

Yikes! At breakneck speed the script's form emerges as Bach's contrapuntal explorations threaten to overwhelm my concentration. (Did I just hear an implied Neapolitan Sixth?) Anyway, Gould's performance of this mini masterpiece is astounding. Nonetheless, you need to keep your options open, right?
 

    self.plist_file_RX = re.compile(r'bInfo.plist$')
 
Robot Poetry, Penta - Give Me Five!

What's going on here? Well, we're setting up a regex in the constructor to scan the IPA package's file list. Then if we find it, we'll extract this important file for parsing. Oh yeah, I almost forgot: the frenetic pace doesn't let up one bit as Penta's Nikita Tselovalnikov rocks the psy trance party.
 

    def checkBundleID(self):
        if 'CFBundleIdentifier' in self.data:
            if self.data['CFBundleIdentifier'].strip() == "":
                self.errors['bundleid'] = True
            else: # key missing
                self.errors['bundleid'] = True
 
Oleo, Pat Martino - Live at Yoshi's

The CFBundleIdentifier, as any iOS developer will tell you, is fundamental — and critical. Thus the script makes sure that the key exists and its value is a non blank string. If the CFBundleIdentifier doesn't meet this basic criteria, then we mark it as an error. Pat Martino, however, couldn't care less about iOS development details; but he obviously cares about creating an exciting guitar solo over Oleo's rhythm changes. And I am grateful for that.

Recapitulation

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

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
May 19, 2019

Sneak Peek: How Are IT Leaders Driving Mobile App Adoption?

App Management
Apperian conducted the The Mobile Enterprise Application Survey to fin ...
Read More
Jan 30, 2019

Part 1: App Security Should Be an Integral Part of Your DevSecOps Process — Not an Afterthought

Application Security
What are the key considerations and components of DevSecOps? The in ...
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
Contact Us