I love to write code. Unfortunately so many of my projects are VAST (see Huge Honkin Console for a taste) that it's tough to make meaningful progressive steps in the very short term. Projects like that also keep me out of new technology land because they tend to be such behemoths that I write them in something wonderful and stable. (i.e. C++) rather than farting around with other stuff I want to learn.
So in the interest of keeping my chops and my sense of discipline up I'm going to start writing little bits of code that are functionally complete, even if that function isn't particularly useful.
Here's my first little code of the day:
tell application "Palm Desktop"
set addressCount to count addresses
repeat with addressIndex from 1 to addressCount
set blurb to first name of name info of address addressIndex
It's an AppleScript that does almost nothing. It activates the Palm Desktop application, and iterates across the entire list of addresses, and just logs the first name from each one.
Why bother? Well I don't speak AppleScript and I really would love crossover between my OS X Address book application and the address book on my clie'. So this is the beginning of a script that will allow me to merge and dedupe the entries from both sources (there's about 20% overlap at the moment.) It illustrates:
- basic access of the Palm Desktop application
- Retrieving fields from the address records
- and the logging calls to dump them out.
It's vitally important when learning a new technology to create atomic, well documented examples for yourself to refer back to. In essence, this becomes your own reference book. As you build it up, you can create for yourself a cookbook of sorts.
It's an interesting and (at the risk of sounding as cheesy as usual) rewarding practice to actually bind these things in a notebook. I find my distributed OO architecture notebook to be worth far more than it's weight in gold.