Create a routine that creates a Google data session and an Outlook data session
Retrieve each calendar (is-a or has-a array of events)
Merge the two calendars into a single (new) calendar
GoogleCalendar = mergedCalendar
OutlookCalendar = mergedCalendar
GoogleCalendar.persist
OutlookCalendar.persist
One could argue that a simple translation of the above into code would be grossly inefficient. However, I prefer to design as if complex data structures were simple structures with cheap operations, and optimize later, where necessary. This ensures that my design is simple, and as we know, premature optimization is a leading cause of program failure.
if synchCalendars(googleCredentials, outlookCredentials) is successful then
print 'happiness'
else
print 'unhappiness'
end
I'll need a mock object for each session:
def createGoogleSession(googleCredentials) returns a GoogleSession object
def createOutlookSession(googleCredentials) returns a GoogleSession object
I'll need a Calendar object, with a class method for merging two calendars:
class CalendarClass
class-method Merge(calendar1, calendar2) returns calendar3
I'm getting ahead of myself. I don't need all these to test the call to synchCalendars. What I need for that is a Credentials object:
def createCredentialsObject(id, password) returns Credentials object
Next installment: Bake-off Code 12
Add new comment