Notes from NH Ruby presentation, 30-April-2009

Fourteen attendees made it to the NH Ruby / Rails group meeting on Thursday, April 30th. We met on the 5th Thursday of the month, unlike our regular third Thursday (note that the next meeting is on May 21st, our regular night) at RMC Research in Portsmouth, thanks to host Tim Golden.

We did the usual round of introductions. NH Ruby attracts a great mix of people: beginners, experts, professionals, hobbyists, computer people, engineers. We had two presentations — Russ Jones on state machines, and Nick Quaranto on Git — as well as pizza provided by organizer Nick Plante and announcements and discussions from all.

Russ Jones is an independent contractor (as “codeofficer“) and has been working in Rails for some time. His presentation was on state machines. Russ has presented before, speaking on Design Patterns in Portland for the Maine Ruby User Group. Russ admits he was a more of a skript kiddie in PHP, getting code to work, but is taking a more serious engineering angle to his work on Ruby. See Russ’s slides here. We reviewed the definition of state machine from wikipedia, formal and correct, but Russ prefers a simpler one: a machine serves as a container for states, and supports the events and transitions between states. Typically implemented as the supporting structure for a single attribute of an object, ex: states could be “draft,” “reviewed,” “approved,” published,” “destroyed.” Attributes are most often a string. Events are often exposed as methods and have “guards” that could be used to validate and/or nullify an event, log it, or trigger afterwards. Two most common implementations are State Machine and Acts As State Machine — the first is a Ruby plugin, the second originally Rails code, migrated into a gem. Russ showed us an example code of a class “Light” that has a state machine to store “intensity” and an event “switch.” Showed another example from the State Machine docs of an auto transmission.

Russ switched to Safari and TextMate at this point, and showed us a hand-coded CMS used for publishing items to the web. The Admin module has the ability to change the state (submitted, reviewed, approved, published, rejected, spam) of submitted articles. Digging into the code, he shows us he was using two Listable and Statusable mixins as separate modules as his primary posting entities – Jobs, Events, Classifieds, etc. — share these behaviors, but not all their attributes. State Machine also includes a link into graphviz that generates diagrams of state transitions, great for documentation. His final example was a command-line driven simulation of the states of his motorcyle, from off to idle to 1st, 2nd, 3rd, crash and repair states! An excellent presentation with clear examples!

Nick Quaranto is in a 5-year Software Engineering program at RIT and is interning this semester at Boston-based Thoughtbot. He blogs at http://litanyagainstfear.com and can be found on twitter and github as qrush. Nick’s slides can be viewed and download at drop.io/gitstarted. While Nick’s presentation was all-slides, it wasn’t fluff: he packed a lot of heavy concepts and pushed through a lot of material pretty quickly and clearly. I think Nick made a fair assumption that most of the people in the room should have the basic concepts of source code control down, and dove right into the material. So, we got a brief introduction to the basics followed by some intensive work on forking, branches and rebasing. I found this to be a very useful presentation and took lots of great notes for future reference. Also, note there is a “Learn More” slide near the end of Nick’s presentation with a couple of very useful links.

Thanks to Russ and Nick for great presentations, to (the other) Nick for organizing and publicizing the meeting, to Tim and RMC Research for hosting and to all for attending and participating. Next meeting is scheduled for May 21st, same location, topic TBA. Hope to see you there!

Powered by WordPress. Designed by Woo Themes

This work by Ted Roche is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States.