Maybe this is just me. I'm a huge fan of working on things in a larger context, but I know that that's not everybody's cup of tea. It has been argued that some people like to read the abstract theory associated with things before encountering examples in context. If you're one of these people please do get in touch and let me know. I'd like to learn more about your thought processes.
Anyhow, just as an example of some mixed routine practices from things I was programming today, I created one short routine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function processForm(params) { | |
var ss = SpreadsheetApp.openById(csc3211fall2012_ss); | |
var email_sheet = ss.getSheetByName('Week '+(parseInt(params['week'],10)+1)+' Assignments'); | |
var range = colName(parseInt(params['assignment'],10)+1) + (parseInt(params['match'],10)+1); | |
var existing_val = email_sheet.getRange(range).getValue() | |
email_sheet.getRange(range).setValue(existing_val+ params['submission']); | |
} |
http://stackoverflow.com/questions/8240637/javascript-convert-numbers-to-letters-beyond-the-26-character-alphabet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function colName(n) { | |
var s = ""; | |
while(n >= 0) { | |
s = String.fromCharCode(n % 26 + 97) + s; | |
n = Math.floor(n / 26) - 1; | |
} | |
return s; | |
} |
http://stackoverflow.com/questions/13086880/can-i-mix-jqueryui-and-google-app-script-form-submissions
At least I can be pleased that both routines are relatively short and have a very small number of input parameters. I think that both could be improved with refactoring. I'll present that in a future blog post, but right now I know I and my students are going to be using this code every week to support assignment submissions, and getting a feel for getting this working in Google App Scripts was the top priority that trumped every other consideration. Not the best programming practice perhaps, but let's see how I can iterate and improve this over the next few weeks.
Google App Scripts really rocks, but I'm still trying to work out how to version and share all this stuff effectively so we can see the software engineering and systems analysis issues in the context of this larger project, as described in this other SO post:
http://stackoverflow.com/questions/12712593/should-google-app-scripts-be-stored-in-version-control-like-github