The Particular Finest

Presented by aurynn shaw

Delightful Shiny New

Over the past few months, I’ve gotten the wonderful opportunity to expand my programming language horizons.

For those who don’t know, I’ve been a Python hacker for years. I love the things you can achieve with Python, I love the way the language flows across the screen; the metaprogramming joy that it brings.

Even Twisted, with all its mindfuck asynchronous nature, is a pleasure to use.

ObjC

I was feeling a bit stale, though. I hadn’t done anything new in Python lately, lacking much time for personal projects.

I did, however, want to write an iOS app. I’ve wanted to learn ObjC and iOS development, and the stale feeling seemed like a good excuse.

I’ve been writing code for a long time; maybe not at the level of C, but I should be versed in the process. Unfortunately, getting my head around XCode and the initial systems of iOS development was hard.

The worst feeling in the world is knowing that in Python, I could figure out what I needed to know. My skills right there, will translate if I could just find that one little bit of context I’m missing.

Finding that context was difficult; All my research had turned up resources for entry-level programmers, not seasoned folk trying to get their head in the space.

Fortunately, once I dropped the external resources and went to the official docs, Apple’s tutorial Here’s how to write an app”1 was excellent in terms of getting me the pieces I knew to drive XCode

Now, I’m struck by Python’s similarities to ObjC, as well as enjoying the freshness of the experience.

Learning about type safety and proper casting and the retain/release cycle has been a bit of a challenge, but not significantly so. Since learning Perl, I’ve always been acutely aware of the lifecycles of my data, and what scope means. Extending that slightly to account for memory retention wasn’t a huge stretch.

For type safety, Python had gone a long way in teaching me what I need to know; needing to cast between base types and set up assertions around protocol implementations makes the process of allocation and casting trivial, if verbose.

I’m having fun. I need to read more API docs, but it’s a lovely language.

Ruby

The second major language I’ve picked up is Ruby; Python-esque in the loosest meaning of the word, Ruby is very similar to the language I’ve been picking at for years.

Re-opening classes and modules; grafting functionality into existing systems. Extend from within, instead of subclassing and creating unnecessary taxonomies.

But, so often reading Ruby code is magical. A require statement doesn’t give you any context on what will be imported, unlike Python’s explicit import syntax.

Until you understand blocks, so much Ruby code is rather opaque. Even then, understanding where function names have come from inside of a block is confusing; you need to be aware of instance_eval and have the class open in front of you.

Lastly, there seems to be a culture of dropping unnecessary braces; () or {} will just be omitted, and it can be difficult to tell when a function call is being made.

On the other hand, the standard idiomatic style of Ruby is identical between non-event code and event code, allowing for programmers to learn the nuances of event-driven programming without the alpine learning curve of Twisted Python and deferreds.

Overall this is one of my favourite languages now, and I definitely enjoy writing it.

Puppet

Finally, the last piece of my new land of learning is Puppet, a declarative manifest language built around Ruby.

Puppet challenges everything that I know about programming; the declarative style forces me to think about the final state of things, instead of how to reach them.

The restrictions of the manifest style, the singular declarations make for a strict environment, preventing so many of my standard idioms.

But, but, for being so different it is so pleasing to work with; to run a command and have ones’ entire computer be reconfigured and kept reconfigured. To push changes out, to programmatically build out databases and configurations without custom, one-off code.

Enforcing dependencies for all ones’ components, ending in a provably correct system configuration.

It’s not all roses, though; declarative thinking was very difficult initially, with many early endeavours struggling against my imperative mental models.

Puppet also requires that every. single. thing. be laid out explicitly, leaving the whole feeling persnickety and somewhat verbose.

Overall, Puppet is a thing of dreams, and I <3 it immensely.

How about you? What are the newest tools in your toolbox? @aurynn on twitter, or @aurynn on App.net


  1. http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphone101/Articles/00_Introduction.html