Matt Knox did a stand-up presentation for the second day keynote, as Giles Bowkett was not able to make it to the conference. Matt was telling us about the great stuff he’s learned at conferences. Smalltalk is the coolest language ever. Unit Testing is not the greatest thing ever. Damien Katz’ great story of success. DHH wrote some framework, we’re not the fringe any more. (I believe this talk is available on IT Conversations, search for RailsConf). Giles, in a picture, bowling and archery at the same time. Giles (in words): an epic tale of adventure, fail, music, rebar, LSD, VC, parking-ticket evasion, and pet monkeys (that’s be us).
Followed an informal Smack-Down session: one yellow sheet, one blue sheet, Obie Fernandez pops up slides and we get to vote, vim vs. emacs, Agile Dev w/ Rails vs. The Ruby Way. svn vs. git broke out into a debate, Brian argued that svn is for maintaining versions of files, not for collaboration, and is fundamentally broken and people need to get over it. jQuery vs. Prototype? Chad from Thoughtbot uses Prototype, and says currently the pain of switching outweighs the pain of sticking with Prototype. grid960 (http://960.gs/) versus… I missed it, Sinatra v. Camping? Few if any cards, all for Sinatra. Blueprint v. YUI, empty? v. blank?, system gems v, frozen gems, Vlad v. Capistraro, Mocha v. Flexmock, FactoryGirl v. ObjectDaddy, resource_controller v. make_resourceful, HAML v. ERB: interesting debate: HAML “Beautiful but astere”, ERB parses like HTML. HAML less typing & faster, ERB has too many close-tags, Obie argues that HAML maps well to CSS – I need to check this out!, Redcloth v. Bluecloth (no one), RMagick v. ImageScience (nobody’s sure) , Tiny MCE v. FCKEditor, restful_authentication v. clearance, Test::Unit v. RSpec (RSpec 3:1). Very informative!
Payment Processing with Active Merchant, Cody Fauser, Shopify
Why? Get money from your customers. Originally http://www.snowdevil.ca/ integrated with Moneris, a single payment processor. Expanding to support multiple processing options, everyone has their unique API, glossaries, , “unique snowflakes,” etc. Simple Uniform API to dozens and dozens of payment processor back ends in over a dozen countries. Components follow the normal flow of Customer data entry, Authorization, Payment and Settlement. Includes extensions for the Address Verification System and Card Security Code (CID, CVC or CW2). Cody jumps into the code. It’s simple. And it’s the same for three processors he shows — that’s the point, after all. The code for settlement is drop-dead simple as well, and for collecting the results.
Rock Solid Ruby Deployments,
Addison Wesley Shortcuts, Troubleshooting Ruby Processes, free chapter available on line at InformIT. How to troubleshoot problems with with threads. An http request gets the attention of the Rails handler, which gets the lock, goes to the dispatch, which might go to the database. While waiting on the I/O, a new request gets a new handler spawned which… goes to get the lock, which is busy, and… goes to sleep waiting. Ouch! This drove the need for caller_for_all_threads, which can be used to dump the state of all threads. This is a patch, not a gem, but will be included in next version of Ruby Enterprise Edition and Passenger. Another good tool for troubleshooting is DTrace “a comprehensive, dynamic troubleshooting tool” or in Brian-talk “a freaking awesome tool for debugging all the fracking stack.” DTrace runs within the kernel and so it can see all the hangups from the Ruby interpreter to the networking calls to the database processes to the raw I/O. However, DTrace is not running on Linux. “How many of you deploy on Solaris? Open Solaris OS X Server?” Not a single hand. “We all deploy in Linux.” A DTrace is not Linux-friendly. And SystemTap, while venerable is not DTrace. Paul Fox, www.crisp.demon.co.uk, is trying to port. Had a demo of DTrace running on Ubuntu in a VM. PID Provider is a wrapper that can intercept calls from an application that’s not instrumented for DTrace. Until then, we talk about what we can troubleshoot now. Ruby Probes, Joyent, good wy to get started. Ben Rockwood has a good presentation on MySQL and DTrace from the MySQL Conference 2008, find on the web. There’s also a ruby plug-in for DTrace: gem ruby-dtrace ‘Tracer”
Blaine Cook, formerly of Twitter
A short story about messages… things we do every day: postal mail, telephones, etc. Synchronous v. asychronous. Clustering, hadoop documentation, Google MapReduce. Reduce latency. Messaging: has a sender and a recipient. Synchronous: bad. Options: RabbitMQ, ActiveMQ, Spread, beanstalkd, Starling (Blaine wrote for Twitter), Gearman/TheSchwartz, Delayed::Job, cron. Each has their own protocols, some share a few like AMQP. Does queue need durability? What kind of guarantee can you get on delivery? Beanstalk doesn’t have a durability guaranty, and Spread only under certain configurations. Reliability? Atomicity? If a job is sent off into a queue and no success or failure message is received, how should the messaging system behave? Restart the job? What if the job has a cost (example: sending SMS) whose cost is incurred, but completion fails later? Recently released ActiveQueue, some similarities to Nanite. Others: Workling talks to Sterling, Rabbit, ActiveMQ, etc. Paraphrasing, if email worked the way the internet works now, you’d have to check individually to see if each of your friends had sent you email.
Eastmedia) was to talk “Rails Scales” but instead talk about “Mobile Developments” taken a great interest in the mobile sphere, business has grown out of web-only focus. Global PC stats: 280 million PC sales/year. Phones sold: 1.3 BILLION, more in a single quarter than all computer sales. “Smart” phones have small share of that market, admittedly, but growing. Technologies: Voice, SMS, MMS, Mobile Data Services. Voice: regular calls, robo calls, automated voice services (airlines), VOIP, Voice XML, Asterisk/Adhearsion. SMS, finally exceeding voice in US, has been the situtation in Far East for a while: Mobile Terminated (MT), Mobile Originated (MO), Shortcode vs. Phone number, No friggin’ metadata, Project: Mobile Commons (launched 2006, worked with civic organizations). MMS: “Total Shit Show,” Carrier Specific, Event Apple said screw it, use email instead. What’s up with viewmymessages.com???? Mobile Data Services: WAP, the “Real” internet, Apps. WAP 1.0 complete disaster, WAP 2.0 is basically trimmed down Web. Project: New York Jets Mobile. Page caching rocks. Brett Farve signed, 4 million page views in a couple of hours, cached through Akamai. The “Real” Internet: as long as you exclude Flash, Real browsers with Js/AJAX support, marketing heating up, MobileSafari, Android Browser (WebKit based), Fennec (FireFox), Opera, Skyfire. Apps: used to be controlled by the carriers in the US, Qualcom’s BREW, Apple iPhone via App Store, Google Android offers Marketplace. App Technology: (most of these folks are too young to remember OS/2 v. Windows) too many OSes, entrenched. Interesting stats on numbers of smart phones sold (Apple #2 to Nokia), as of Q4 more messages that voice calls in US. What are people doing on their phones? Watching videos, accessing social sites, Matt said “boring but played out” but I’m not sure of the context. Up and coming: Geo-related apps: directions, find a restaurant. GPS is still really slow, AGPS (tower triangulation) much faster, less accurate, Skyhook Wireless FTW, “I want to know exacly where I am, in motion” – makes trouble playing games that are exacly location-dependent. New product, RSN, – “tell us what you saw and where you saw it.” iPhone development… feels like the Rails community, sort of: searching sparse domain knowledge; Objective-C ain’t Ruby; iPhone SDK ain’t Rails. “But STFU, it’s pretty badass for 6 months in.” A decent coder can get going… it’s fun and excitig. For Spot.io we wanted the photos off the camers and quick entry.(CTO,
HashRocket, Communications to support Client Development
Pivotal Tracker: we don’t write a line of code that doesn’t support a user story. Current iteration gets its own page listing ongoing stories, amount of effort. Let’s clients view velocity and acceleration, where stories are in the process, etc. Stories need to be full (BAD: “admin interface”) so any dev can sit down and start coding. Direct capture to Tracker, slowly train customers to write their own. Moving toward standard forms, ideally, Cucumber forms As a
David Berube, Surviving as a Windows-based Ruby developer
Windows is a difficult platform to develop Ruby on, since it lacks many of the POSIX tools (natively, there are add-ons) and running Apache is less well-known. David’s pretty frank: he recommended a Windows dev look seriously at Ubuntu (Disclaimer David was my predecessor as “Fearless Leader” of the Greater New Hampshire Linux User Group, and I think we’re both equally, correctly prejudiced). Intrinsic pitfalls: automatic binary conversions (LF->CRLF) can corrupt binaries. No Kernel#fork; this won’t work. No GNU out of the box. No compiler out of the box. There are some good options: Editor: Visual Studio: Ruby in Steel, Net Beans, gvim (recommended) cream, Emacs, “E Text Editor” – Textmate clone (bundles can be work, slashes are the wrong way, someone has a patch bundle for those, too) Cygwin, UNXtils (preferred). Misc tools: Safari for Windows, FireFox, Tortoise for SNC, LDE(x) windows desktop replacement, PuTTY, FileZilla, SmartFTP
Rails AntiPatterns, Chad Pytel and Tammer Saleh, Thoughtbot
Moving code from controllers to the models: ‘create’ method, 14 lines is too long. Smells funny: there’s a transaction that wraps a single call create_version!() Eliminate DRY code in create new version and create first version, use defaults to set default/initial values of version, use created_at and id functionality built into ActiveRecord design. Slide entitled “Minor Law of Demeter Violation” where they short-circuit the redundant code that references an object and drills into its properties.; better to expose that property/attribute/structure as an explicit method in one place and use the new method to free multiple dependencies on an internal structure. Simplified the create version method to half-dozen lines, removed a related trigger as a callback rather than explicit code. Lessons learned: even a 15 line controller action is too long. Exceptions should be exceptional, Your models should use callbacks to add complex behavior. 2nd example: way too much code in update. Solution: use a constant with a hash to create a set of methods. Lessions: tackle large refactors iteratively. push as much business logic into the model as possible. In lots of code, dimple DRY principles will lead to a lot of refactorings. Common problem domain: user and roles. “Thoughtless Code” Methods like Role, Roles, CanEdit, CanPublish, CanDoSomethingElse…. Solution: Remove the whole shebang, add boolean columns to User: Admin, Edit, Publish, and Active Record automatically gives you the elegant User.Edit?, User.Publish? User.Admin? Lessons: Refactoring! Bug Fixing, Always Be Refactoring, didn’t cover testing; there was a test suite, so regressions were avoided.
Battle Royale, Foy Savas, author “The Merb Way”
Merb’s Role in the MVC Holy Wars
Merb is Rails rewritten with Django and Pylons influences. Created by Ezra in 120 LOC Mongrel _ ERB. Now: high performance, quick to deploy, easy to scale. Sounds like Rails. It isl Awesome. Rails vs. Merb in a fight cage? Point by point comparison. “No code is faster than no code.” “A micro-second saved is a micro-second earned” Background processes, run_later block. Built on Rack Rack allows ou to string together apps using Rack::Cascade. Example, just serving RSS feeds don’t have to invoke entire Merb framework. ActiveSupport is a kitchen sink, ExLib isn’t. DataMapper destroys ActiveRecord. Authomigrations are what your developers always needed. Lazy Loading DataSets. Strategic Eager Loading. Plugins are Gems. Merb Parts. Arguably one of the slickest presentations at the conference, Foy’s rendering of the Dao De Jing, which he read in what I presume is the original dialect, “A way that can be taken rarely stays the way. A name that can be named rarely stays the name.” Not just dramatic, but the theme of his presentation. Perhaps Merb will be the next way.