RubyConf 2008: Better Hacking With Training Wheels
I'd like to do a talk on a library I'm developing called Training Wheels. The idea is to bridge the gap between junior developers who understand the syntax but may not use OO or common idioms properly up to advanced rubyist level, and do it in ruby to boot!
Training Wheels is a ruby library that can be run against your own scripts, libraries or applications that looks for common problems in ruby, like:
- repetitive code
- pretty poorly performing patterns (alliteration not included)
- fat methods
- deprecated methods in libraries it has plugins loaded for
- all manner of wickedness
Training Wheels works by converting your ruby to s-expressions using ParseTree and performing analysis on the resulting tree.
It can be used as a development aide in conjunction with rstakeout(and growl for extra zen factor) to get instant suggestions on better practices in your code.
As a Rails plugin it runs in development mode and slings all sorts of insults via the log file.
It's also configureable via a yaml config file or command like switches. Merb hacker who thinks 'returning' is a bug? Let the Training Wheels make sure you don't commit such a grievous error. Rails hacker who thinks alias_method_chain is the bees knees? Let Training Wheels watch out for: alias_method :foo_without_feature, :foo; alias_method :foo, :foo_with_feature
Training Wheels is extendable so developers can write plugins that train on proper usage of their DSL's or business layer. So the default ruby wheels would be loaded by default. The Rails plugin would include the Rails wheels, the Merb plugin the Merb wheels and so on.
New wheels wouldn't just be limited to web frameworks. Any ruby library could include a set of training wheels that are loaded by anyone riding with Training Wheels.
If you're already an expert developer and you don't need no stinkin' training wheels, let Training Wheels train your underlings so you don't have to.
FULL DISCLOSURE: This library is pre-alpha. If there's sufficient interest in Training Wheels as a talk it'd light a fire under me to get this published. Once this is working it'll be posted to GitHub for all to extend and I'd predict we'd see it in many ruby performance oriented services as an ever vigilant watchman against the jackal, sloppy code, that tears at the very underbelly of our fair community.
I read somewhere(and google can't tell me where(and I don't have any twitter followers to use lazy web)) that teaching is essentially encouragement plus the suggestion that something is possible. I feel that's what the Training Wheels are supposed to do.
About Joe Martinez
I am a 26 year old ruby hacker from Tallahassee.
I work for an online payments company called eLayaway as the VP of IT.
I heart ruby and have been hacking at it for about 5 years.
I am the deputy organizer of NoFlaRB - the North Florida Ruby Brigade.