Saturday, October 16, 2010

Strangeloop Day 2

Opening Talk: NoSQL in the Enterprise (Billy Newport)


Came in halfway through this talk but really enjoyed what I heard. The talk pointed out how NoSQL datastores aren't a clean replacement for relational databases and that their use must be considered carefully because of inherent complexities that come with schema-less distributed data storage. This talk was video taped, look for it online when the conf talks are published.

Next talk: JavaScript Functions (Scott Bale)


Scott went through a number of function invocation patterns that Douglas Crockford describes in his book, "JavaScript, the Good Parts". This talk was also video taped, look for it. I am in the process of reading the book this talk is based on at the moment and I recommend it for anyone who has an interest in JavaScript.

He discussed the use of constructor functions to restrict scope and access to data as well as using modules to apply a namespace to JS functions.

Next talk: Classes are a Premature optimization (Justin Love)


What many people think of as object-oriented programming seems to be class-oriented programming.

Class-based inheritance introduces complexities because classes are objects that have metaclasses.

Prototypal inheritance is simpler because there isn't a distinction between concepts like classes vs. objects. With a prototypal system, nested contexts form chains of connected functions, where type identity is traded for extensible, inheritable behavior.

The lunch hour had a panel discussion on NoSQL was well moderated by Ken Sipe, but the discussion left me wanting more. This was followed by a "dream team" panel discussion that included Douglas Crockford, Alex Payne, Guy Steele, Josh Bloch, Bruce Tate and was expertly moderated by Ted Neward.


This was an often spirited discussion that ranged from topics like what languages new aspiring developers should learn, to whether programming languages will ever form to help make parallel problems more easy to address and understand.

Perl got a lot of hate in the languages panel. Bad show, panelists!

Next talk: Android Squared (Bob Lee & Eric Burke)


Eric explained how the Square reader decodes the wave form from the magnetic stripe on a credit card. They have to deal with peculiarities from different mobile devices interfering with the wave form from swiping a card as well as variations like swipe speed and other factors.

He also talked about how having a large database of swipe samples (containing phony numbers) allows them to write tests to examine holes in their decoding algorithms.

Square has released an open source library for Android that contains some Android and Java extensions (I believe):

Bob went into detail about how square queues metrics and server communication data on the device until it connects with the server. He also explained the API he wrote for reading and writing efficiently into flash file sectors on Android.

The queue file API and a shake API are included in retrofit. Bob later described a REST API that the android client uses to make network data exchanges.

Bob also shoed a POS app he wrote for Taste St. Louis in 2 hours that used the POS square API available for Android 3rd party apps. Very impressive!

Next talk: Dimensional Data in a distributed hash table (Mike Malone)


He spent the beginning of his talk describing CAP theorem and how at his company, their needs were better served by availability instead of consistency. They have implemented a distributed hash table implemented on top of Cassandra. The major points of his talk were: Integrity vs. Availability, Locality vs. Distributability, and Reductionism vs. Emergence.

Sadly, this talk was totally over my head.

Next talk: Outside-in TDD in Clojure (Brian Marick)


Brian contrasted Detroit-style TDD vs. London-style TDD (bottom-up vs top-down approach to designing systems guided by tests). He then played a pre-recorded coding example that showed the progressive implementation of an animal reservation system he previously created in Ruby.

Along the way, we got to see the mocking framework he is working on: Midje. In the coding example, we saw test definition, test execution result, and the code under test all within the same editor pane. This was interesting because it means that the eye doesn't have to move around the length and width of the monitor.

He explained why working with his mocking framework lets the course of development slice the problem domain into layers that can be tested totally independently.

Final Keynote: Douglas Crockford brought down the house



Strangeloop was an example of a brilliantly thought-out and executed conference. There was an excellent mix of well-known experts and new comers offering highly technical insight for a price within most developers reach. I'd say this was a conference that developers could ill-afford to miss and I can't wait to see what Alex Miller follows-up with next year.

Friday, October 15, 2010

Strangeloop day 1 (part 2)

After a great lunch with Jeff Barsciezski, Luigi Montanez, and Yehuda Katz, I listened to a standing room only talk on civic hacking which covered many examples of companies that build up around serving public (government collected) data.


Next talk: mobile HTML 5 (Michael Galpin)


Mobile browsing is being done on many different platforms (iOS, Android, Blackberry).

Frameworks like PhoneGap & Titanium are powerful ways to create apps for mobile platforms, but aren't what HTML5 is about.

Viewport, Geolocation, DOM storage (local storage vs session storage) became the replacement for the original proposal for database storage on the device. Web workers, and many other aspects of HTML5 were covered.

Next talk: nodeJS (Ryan Dahl)

At the start of this, it seemed to be the same talk Ryan gave at jsconf. Then he went into live coding examples, demonstrating dns resolution and streaming command-line apps.


Eventually, he started talking about scaling node deployment strategies, which included having node running in multiple processes communicating with each other via unix file handles (letting the kernel handle load balancing rather than using an explicit load balancing component). He also talked about clients using webworkers acting as actors for interacting with asynchronous node servers.

During Q&A, a question was asked about how node compared to other async servers (erlang). According to Ryan, they are comparable, but he didn't have numbers he could show.

Keynote: Guy Steele

(programming while the earth was still cooling, everyone knew math and was apparently insane)


He gave a long and detailed analysis of the worst code he ever wrote (card programming from 40 years ago). This had lots of humor and maddening complexity. But he transitioned well into Fortress, the research language he is designing for parallel execution problems. Heady stuff. I needed beer afterwards.

Thursday, October 14, 2010

Strangeloop talks day 1


Hilary Mason starts the day with a talk about machine learning and how the technology has evolved. Among the advances that have made machine learning accelerate:

  • Algorithms
  • On-demand (elastic) computing
  • Access to large amounts of data

Analyzing large amounts of data to find either patterns or to identify data trends requires algorithms to disambiguate data that is contextually unrelated.

Data classification through statistical modeling based on characteristics.


And then she went into math and Bayesian probability.

Bitly trick: <-- add a plus to the end of a link to see realtime metrics about a link (statistics about clicks and where they are coming from over time).

Next talk: Riak (Rusty Klophaus @rklophaus) Dynamo-inspired NoSQL key-value datastore

Nosql is being driven by narcissism, voyeurism, and materialism :)

  • Has same interface for single and multiple node deployment
  • Configurable replication for buckets
  • Data relationships can be defined for querying
  • Replicates data across nodes as they are added to a cluster
  • Supports map/reduce operations
  • Can have HTTP interface to introduce caching and streaming
  • Full-text search
  • Riak is slower in virtualized environments.
  • Multi-site replication is an enterprise feature

Upgrading instances doesn't support rolling upgrades, so non-multisite upgrades would mean bringing down the ring to change the software.

Next talk: supporting an open source community (Yahuda Katz)


Rails optimizes for developer happiness. The python community optimizes for explicitness. Focusing on happiness as a primary goal would draw developer attention faster than another more easily measurable metric. Performance or other kinds of optimizations can be attacked later.

Nothing beats adoption. Making your project easy to adopt (friendly licenses, support community) makes a big difference.

Business is good for the ecosystem; projects that allow independent businesses (training, consulting) to be built up around them will create the ecosystem that supports the viability of a project and the community involved in it.

Human beings underestimate the network effect.

MIT is a great license to promote a "network effect" for a project.

PDI (please do investigate): ask the community to fix a problem they care about and then incorporate the change if it makes sense for the larger community.

Market early with good propaganda.

Many, many other points (couldn't keep up). Outstanding talk! (Best talk of the day, actually.)

Saturday, October 02, 2010

Watchr is teh awesome

Autotest spoiled me for immediate feedback during the development cycle. So as I was going through the Relevance functional koans for Clojure, I had a little Watchr script continually re-running the tests from the exercise at every file save. This is what that script looked like:

There's barely anything there. All it does is run the "" script that comes with the koans whenever a ".clj" file in anywhere under the "src/koans" directory is saved. It's just a simple little thing, but so very useful.

I later discovered a fork of those koans (from David Laing) that adds JavaScript lessons. So I adapted my watchr script to start the KoansRunner file in Safari, reload the test page, and scroll to the bottom on every save of the JavaScript files.

I can't say enough about the value of rapid feedback from automated tests during the learning/development cycle. The absence of context switching to manually rerun the tests is great WIN.

Clojure sequence comprehensions

I am learning Clojure and I like it. Following the ThinkRelevance functional koans has given me a really good interactive playground for learning this language. Reading through examples in a book cannot compare to actually having to write code in order to solve a problem and in the process learn syntax and the rules of a language. What a concept!

I came across something in the sequence comprehensions section that I thought was interesting.

The "for" macro can loop over one (or more) groups of things and produce the vector combinations above. I was reminded while reading this of Ruby's Array#product method, which does the same thing (return the product of 2 or more arrays).

Sunday, September 19, 2010

Thoughts from Code Retreat - St. Louis

Yesterday was the St. Louis Code Retreat and I wanted to capture my experiences and observations. I hadn't heard of Game of Life before reading about Corey Haines' code retreats last year. My field of study in college was life sciences so I missed out on things like Conway's game of life that mathematicians and CS majors are probably exposed to. In prep for the event, I gave Game of Life a try for myself. It was a great experience! I felt totally sucked into the elegance and simplicity of the problem. But enough about that.

On organizing it

IMG_0007 DSC_0008

We were fortunate to have great sponsors. Microsoft provided the venue, a large space with ample capacity for the 40 people who were signed-up for the event. Oasis Digital funded the breakfast (fantastic pastries, fruit, and coffees) and Object Computing, Inc. (my employer) paid for the sumptuous buffet lunch from Mayuri.

The event was announced back in July and within a week of the free tickets becoming available, all were taken by eager developers from various technical backgrounds. However, of the 40 who signed up to attend, only 26 made it to the event. I had read accounts of previously held code retreats that warned to expect people signing up for the event but canceling at the last minute; given how hard it is to coordinate with a large group of people, this is not surprising. But to have only 65% attendance was, honestly, a disappointment. Given the size of the turn out, though, I was very happy with the range of technical interests among the folks that were there to learn, experiment, and enjoy programming.

Languages, Tools & Format

At the beginning of the day, I said a few words about how the day would be organized. We were to have 3 40-minute pair-programming sessions before lunch, with developers implementing the Game of Life problem in their preferred language or technology, and doing it test-first. Then switching pairs at the end of each session, deleting the last sessions effort and starting over.


The point of the event was practice. Through exploring new languages and experimenting with different approaches to a common problem, all those who made it that day would get a chance to improve on some skill they already had or work with someone who could teach them something they were interested in learning. Attendees took on the game of life problem using a number of different languages and tools.

  • Eclipse
  • Emacs
  • IntelliJ IDEA
  • TextMate
  • Visual Studio
  • C#
  • Clojure
  • F#
  • Java
  • JavaScript
  • Objective-C
  • Ruby
  • SQL

A common reaction to the 40 minute time limit was that it was far too short to get a working implementation of Game of Life. The time constraint led to some sessions that scrapped testing altogether in the interests of getting a working implementation as quickly as possible. For others, it meant only being able to implement a partial, test-backed solution. Personally, I appreciated peering into the lightning-like minds of some of St. Louis' most talented software professionals. I liked what I saw in the clojure implementations that I watched and paired on and found myself inspired to take clojure on as my next language of study.

Organizing this event was a learning experience for me. Several people asked whether there would be another one next year. I really hope so ;-) It wasn't a crazy level of effort to organize (nothing on the scale of a major conference). I am curious whether I'd set the date for the event too far in the future and whether that was why there were so many people that cancelled their tickets. Next year, if the stars align like they did this year for venue and food sponsors, St. Louis will see another Code Retreat.

Interesting implementations

I have found a number of Game of Life implementations on the web that I think are pretty cool. Here are just a few.

Sunday, July 18, 2010

module_function (where have you been all my life?)

I recently discovered a feature of Ruby that surprised me. Really, I was surprised that I hadn't heard of it before (for as long as I have been a fan of the language).

module_function can be used to make one or more Module methods accessible as type-scoped methods (in the same way that declaring them as self methods would). For example:

In this form, the methods of the module must be declared before the line containing module_function. You can pass one or more method names (as symbols) in the call. In fact, you can even re-write this as follows:

This form makes all methods declared after module_function behave as type-scoped functions (callable in the form of: or Foo::bar). You can "turn-off" the behavior of what is given type-scoped calling access by declaring a visibility modifier after the last method you want to expose in this way.

Now the Foo functions can be called either as type-scoped functions or Foo can be included in a class or added to an object.

One thing you now can't do, though, is refer to the module_function scoped methods as instance methods of classes or objects into which the Foo module is included. IOW, trying to call: in the above sample code blows up with a warning about trying to access a 'private' scoped variable.

Saturday, May 15, 2010

Regex riff (for words not containing a string)

I had the need to figure out how to parse a string and pull out any words that didn't contain "Foo" in them. After a lot of cursing, I came up with something that works. For the string "Which BarFoo Is It Foo Bar":

Yields: "Which", "Is", "It", "Bar"

Regular expressions are diabolical.