Three of our software engineers attended the Scottish Ruby Conference in Edinburgh. The Scottish Ruby Conference took place from 26-27 March 2010 in Edinburgh, the capital of Scotland.
The twitter tag used for the conference was #scotconf, and photos can be found in the flickr group. I think the schedule, and the conference in general, was put together really well. All sessions were recorded, and should be online soon.
Here are some notes I took while attending the talks.
Keynote — Jim Weirich
Jim Weirich from EdgeCase really knows how to put together a keynote. Coming from an explanation of atom models he used the duality found there to show a similar duality in modeling software, comparing functional and object-oriented (or code and data) point-of-views.
He also praised an introductory programming book called “Structure and Interpretation of Computer Programs”, which seems to be an essential read. There is even a google group to discuss the assignments given in the book.
Stonepath: State-Based Workflows in Ruby — David Bock
David Bock presented a methodology and accompanying ruby library to model state-based workflows called “Stonepath”. I was really interested in this talk as workflow and state is a part of our app we usually have a hard time getting right. One of the nice features of the library is the possibility to render a diagram of the states and transitions of your model using “rake stonepath:diagrams”. There is a comprehensive documentation available, if you want to know more.
Along with Stonepath comes a new library called “StoneWall”, that allows you to define permissions for different states of your object. I will definitely try it out.
The Joy of Painting with Ruby — Jason Cale
This talk inspired me. I have been watching ruby-processing on GitHub for a long time, but never took the time to play with it — and I should change that. Especially since I could imagine creating animations for my gigs spinning house records.
Jason Cale showed some visualization examples of using a webcam and sound as input (using the Minim library). In another example he displayed random characters from the twitter feeds for the tag of the conference (#scotruby).
Getting the most out of ActiveRecord 3 with Arel — Carl Lerche
If you have been looking into Rails 3, chances are you have already read Pratik Naik’s post on ActiveRecord 3.0. Bringing Arel to ActiveRecord in 3.0 changes the API for queries significantly (for the better, I think). The new API is based on methods returning relations, so that they are lazy by default and can be chained to form complex queries. Example: Product.where(:name => ‘good’).where(:nice => true)
Notice also that the “named_scope” method will simply be called “scope” in AR 3.0.
An interesting fact is that by definition, the relational algebra provided by the API methods only creates relations, which are then taken by an engine that materializes them, using a simple CRUD API. This means an engine doesn’t have to be a RDBMS, but just something that implements the CRUD API. This can be a key-value store, an in-memory collection of Ruby objects, or objects coming from a different system, etc.
Breaking Things with Ruby — Rory McCune
Rory McCune showed examples of his work as a security consultant. He used the Metasploit framework (written in Ruby!) to show some common exploits. For example, he gained admin access to virtual machines using security holes in an unpatched Windows Server version or a security hole in Adobe Reader by sending a malformed PDF.
UNIX: Rediscovering the Wheel — John Leach
John Leach from Brightbox hosting based his talk on the impression that Ruby developers, especially Rails developers, tend to not know what is already available in UNIX. “And if you don’t know UNIX, you reinvent it, poorly.”
Here is a list of UNIX tools and features that he mentioned. They have been used and tested for many years, but may not be known well enough by Ruby or Rails developers. Most of the time they are a better choice than custom solutions.
- cron (execute scheduled commands)
- at, batch command (run jobs queued for later execution)
- syslog (logging)
- ulimit (enforce memory limits for processes)
- Example: ulimit -v 1024000
- nice commands (run a program with modified priority)
- Example: nice -n 19 rake:unimportant_task
- Example: ionice -c3 rake:unimportant_task
- atomic file renames
- find -delete (e.g. for file cache invalidation using a creation time comparison)
- signals (Using trap in Ruby)
- messaging via SMTP (yes, sometimes that’s good enough)
- local messaging via D-Bus
- modularized config files (e.g. cron.d directory)
Keynote: Where Ruby Isn’t– Tim Bray
A very well presented keynote. Tim Bray said: “Ruby makes me happy!”, and I think most of the attendees agreed. But he sees potential for Ruby to catch up in other areas than building Rails websites. (He mentioned that there is nothing wrong with Rails. Rails wins because it removes options — which just makes it not very interesting sometimes.)
According to him, Ruby is not strong in the following areas yet:
- Chips are not becoming much faster anymore
- Application programmers don’t understand threads
- Deadlocks etc. … It’s hard to get threads right
- Lower overhead of threads doesn’t matter anymore with current cpus (they switch in one cycle also for processes)
- Shared mutable state is bad
- Even Apple’s GCD (Grand Central Dispatch) is still only a thread-based solution
- Functional programming does it better
- Immutable state
- None of them will become mainstream
- Erlang seems too weird
- Clojure is lisp, which already had a chance to become mainstream
- “I want all the nice Ruby stuff plus concurrency, and I want it now!”
- Ravelry.com as an example for a big rails website: Built and maintained by only one developer! — Imagine how much an Accenture would take to build it?
- Doing It Wrong blog post on tbray.org
- Huge opportunity for Ruby solutions to build systems cheaper, faster, better
- Huge difference in programming environments of iPhone, Palm WebOS, Android, Blackberry
Tim Bray published his very own conference notes already.
RTW – WTF? — Makoto Inoue, Martyn Loughran
The New Bamboo guys shared their experience in working with real-time web apps. And by that, they mean more than just chat apps, but progressive enhancements for parts of existing apps.
- First try
- Nginx HTTP_Push_Module
- Using long polling
- Fiddly to setup
- Web sockets
- HTML5 substandard
- Available in current browsers
- Permanent connection to the server
- Fallback using Flash
- Server Side
- One solution: Asynchronous servers
- Non-blocking IO
- Single threaded
- Efficient CPU utilisation
- Examples: EventMachine, node.js, em-websocket, cramp, sunshowers
- Stale data
- Conflicting changes
- New Bamboo built PusherApp based on their experience
- Trigger event on server side
- Bind to event in js
Write Bad Code — Gwyn Morfey
A very funny presentation style with lots of special effects: Basically a dialogue between Gwyn and his colleague. They went through different situations where it could make sense to just get some code to work, even if it’s ugly. E.g. for presentations and prototypes.
Nice phrase: “Code with a bottle of wine — it suppresses the urge to get it perfect”.
10 Most Common Errors in Rails Apps — Darragh Curran, Wal McConnell
The Exceptional team presented their best-of in collecting Rails exceptions from apps worldwide. Not much of a surprise here for most of us I guess, but cool that they also offered solutions. Here are some of them:
- ActiveRecord#save! (Use save! only when you’re not expecting or cannot handle a failure)
- ActiveRecord.find_by_id (Handle/rescue case of nil being returned)
- ActionController::MethodNotAllowed (Hide urls you do not support for GET, remove rails default route)
- ActionView::TemplateError “undefined method XYZ for nil:NilClass”
An interesting side note (which I hope to remember correctly): About 20% of all errors being sent to Exceptional are caused by only three .NET apps!
Gittin Down to the Plumbing — Scott Chacon
Scott Chacon is a fast presenter. And a git expert. Not only is he working for GitHub, he also wrote the Pro Git book and maintaines the git-scm website. He used his very own presentation software to deliver a talk full of git wisdom, explaining how commands like git commit work under the hood. I could not take too many notes, so I recommend checking out the video once it’s available.
You’re Doing it Wrong — Tammer Saleh
I have been interested in clean code practices for some years now, so I am glad to see a book coming out to address common “smells” in rails projects. Tammer Saleh co-authors this book titled “Rails AntiPatterns“, and in his talk he presented some of his best practices to rescue a rails project and some examples of really bad code and how to refactor it. Strongly recommended!
Thanks for a great conference!
Please find more conference notes here: