So its all over, if I learnt one thing from this conference, its how popular Rails is. Its has been spreading like wildfire for a while now and is not letting up. At least 3 other Rails/Ruby conferences in Europe were confirmed for next year, with rumours of many more events this side of the pond.
The official conference site promises to post video’s of the main presentations and a podcast featuring most of the other talks.
All this talking about Rails/Ruby at the conference, on blogs, irc and forums has lead me to realise i’m not proportionally spending enough time doing Rails compared to hearing about it. So less talk more action from now on – Anyway, to go against just that, I’ll sum up some notes I made from day 2;
Jim Weirich – Playing it safe with Ruby
Jim started off showing this excellent video from World of Warcraft, and proved that even if one person doesn’t ‘work well in a team’ then the whole thing can fall apart. Much like developers working on Ruby and extending existing Classes and Methods in their plugins or applications. A lot of tips on how to code defensively when using the power behind Ruby;
- if modifying existsing classes, if possible choose to ‘add behaviour’ – not take away or modify
- avoid top level constants and functions
- use namespaces – (hoping selector namespaces (with priority) come out soon in Ruby)
- overwrite const_missing to catch deprecated methods, but remember to hook
- take care to keep the hook chain in overwritten methods (grab aliases at the start)
- make use of method contracts, overwritten pre-conditions should be less forceful, and post-conditions more forceful
This talk was the best of the day and fetaured comedy, cartoons and a guy who hints at having a bit of a passion for Ruby. There’s no way I can sum this up so you’ll have to wait for the video, I do vaugely remember him talking about sandboxing Rails – and his love for ‘the splat’.
Rany – Turning your enterprise job into a Rails playground
A great insight into how a developer (Rany) working for a large German bank, managed to sneak Rails development in the door, impressing his boss and getting the application deployed past the uber Swedish Architect and DB Admin. Techniques involved;
- Lull management into a false sense of security
- Steal (or convince some developers to join you)
- Cheat (avoid some problems by not tackling them at all)
And since he is no longer at the Bank, he’s hiring Rails folk for his new startup company.
Jan Kneschke – Optimizing MySQL for Rails
Jan couldn’t make, but the talk went ahead with someone else from the MySQL team presenting. Confessing he didn’t know much about Rails or Ruby, he laid down some basic points for performance boosting in MySQL;
- avoid queries if possible (caching, coding around them)
- instead of Rails generated joins, code th MySQL for the joins manually
- always only select back the coloumns you want from a query (no select star)
- use smaller more selective indexes (e..g. index index_name (long_text_field(12))
- for max. performance, optimise for only one type of database (e.g. MySQL)
- myISAM preferred for Rails Session storage using ActiveRecord, use InnoDb for transaction based storage (useful in tests)
- make use of the MySQL slow query log
Dominic Mitchell – Unicode for Rails
What you can do to ‘improve’ Unicode support in your Rails app. Its still not 100% there yet, but there are some steps you can take with plugins. Proves effective enough for English and most European langauges.
- DB should be all in UTF-8 – just easier
- in database.yml just use encoding: UTF8
- serve HTTP with correct UTF8 header
- form should use correct encoding
- use Unicode wrapper methods from plugins around all string manipulation in code
- test using Rails, throw in strange chars and see what comes out
(the remaining talks of the day I didnt bother with notes, not that they were’nt deserved – they’ll be better covered in the vidcasts anyway)