RailsConf 2011 - My Personal Recap
RailsConf 2011 - My Personal Recap
Join the DZone community and get the full member experience.Join For Free
RailsConf2011 is my first Rails conference. Held in Baltimore, MD, in the Baltimore Convention Center, there were five tracks, including one unconference (bohconf) that ran concurrent to the main conference. As we are preparing to offer our first Intro to Rails course with Engine Yard in the summer, I wanted to start getting involved in the Rails community a bit more and see where it is heading.
Attendance was very strong - and so were the pleas from companies that are hiring. The job message board spanned three full corkboards, and was full of writing from various companies pleading for Ruby and Rails talent. Just about everyone was saying "we're hiring," even to the point of wearing it on their shirts.
Clearly, the Rails community is growing and currently has lots of need for additional talent as the market increases faster than the number of experts in the field. A good problem for rails experts, I'd say.
I attended two half-day tutorials on Monday. Those tutorial sessions were very instructive.Building WebApps with HTML 5
The HTML 5 tutorial by Mike Subelsky of OtherInbox left me with a ton of resources, a good set of labs and solutions, and lots to research.
I learned about the HTML 5 Boilerplate Project, where you can download a template of a fully HTML 5 compliant document with tons of comments. I also learned all about drawing, text and image rendering, extra forms hints such as types of fields (phone #), default focus, and more. The local storage API is quite easy to use, and he talked about the issue of the socket API and Firefox. So all in all, a great talk and very valuable to me.
The second one was a Rails Best Practices talk from Gregg Pollack of Envy Labs. Gregg stopped by and said hello, as he is a friend of ETE and Chariot and really helped us out in 2009 (there's even a Viddler video somewhere on the 2009 ETE conference that he did).
Rails Best Practices - Gregg Pollack of CodeSchool
Gregg Pollack has a good website, if you're into self-paced training, called CodeSchool. They have a number of classes online, including one called Rails Best Practices. This was the in-person version of that course, and he kept it entertaining. I really like his Web IDE and the "challenges" he puts you through. Great concepts, and an approach for us education people to think about, especially with delivering online training. He also has this penchant for doing mashups of old 8-bit video games, complete with his voice for all sound effects.
Fat Models Aren't Enough
Jeff Casimir from Jumpstart Lab gave a talk on further refactoring of Rails applications called Fat Models aren't Enough, stating on the record that he feels that some controllers do too much even today. For example, he suggested using a Presenter (think of it as a controller helper that is responsible for representing the view data to the view object). The refactor is to pull the unrelated objects into the presenter, intialize the presenter which then loads the view objects, and only expose the presenter to the view.
He then told us to take that further - maybe instead of delegating things like reports to the models themselves, polluting them with code really that is a representation artifact, write the code in the presenter to handle that data processing. You can even call helpers in the presenter, since they are also part of the view and you are just helping to represent the data to the view. I hope I'm presenting the presenter the right way here, but anyway it was great food for thought.
He then got into a good discussion of the Single Responsibility Principal and how many objects do more than one thing - if your model handles processing of its children to do things for them, or some type of other thingness (think of printing, ordering, etc) maybe you need to extract that and make it another model. He was big on having methods be less than 8 lines of code. Also, he really hated scopes and prefers the new Ruby class method approach (so do I).
Bryan Liles of Smarticus gave a talk on Active Support, which went into the history of Ruby's Facets library, and how the Active Support library was created to give features from that library that were useful to rails programmers, without having to load the relatively large Facets library.
There are a lot of things in Active Support, such as module and class accessors, constantizing and pluralization, a benchmarking API, configurables, callbacks, instrumentation (sending and processing events), even gzip and various types of randoms. His comment to all of us was READ THE SOURCE! I agree. Now if I can just get Chapter 9 of Roo in Action sorted out I'll have a little time to do that...
Another talk, this one by Avdi Grimm of ShipRise discussed how to write Confident Code. He urged everybody to read Code Complete (yet another book on my Kindle now, I can't believe I've never read it). Discussed that every method should have four parts - gather input, perform work, deliver results, and handle failure. That's pretty straight-forward in concept to most of us, however he then went on to show how people do bad things in each of these areas, and how to try to write better code.
For example, a confident input handler in a method is sure of the type of object coming in. You should treat the object, with duck typing perhaps, the way you expect it to be. He says one of the "code smells" in this area is when you do switches to process various input types, or check for nils. I have a ton of notes to go over for his talk. Great stuff.
Sass - CSS meets code
I didn't get a seat for the Sass talk either. You'll see a theme here. See, I'm not 24 so I can't run to the talks as fast as some of these other guys. Ok, it's an excuse. By the time I got to the sass talk, the best I could do is stand in the back for a bit and write down some URLs. So I sat down and also took a look at that as well. Again, nifty pre-processing DSL for CSS. If you thought it would be a good idea to put your palette RGB numbers in variables and re-use them throughout your CSS file, this is easy in Sass. There are a lot more cool things, like blocks for nested items such as table rows of tables within divs. So, again, something on my short list.
Legacy Code - In Rails?
As we well know at Chariot, and Noel Rappin of Obtiva points out, at some point, you'll have to deal with a legacy Rails app. If you've ever been on a rescue project, you know what I'm talking about. Noel points out that your first job is to make everything better incrementally. He brings up the Boy Scout Rule (quick, what is it? I remembered the Cub Scout one, Always Do Your Best, but it's "Leave the campsite in better shape than you found it").
Lots of tips here, after showing us the modern version of Goofus and Gallant (which still exists apparently) and how you can really harm your effort by rushing to push or rewrite the something without testing. He strongly suggests using Git to make cheap branches (an idea I highly agree with) and pressed us to learn git bisect if we haven't already. A tool that helps you figure out when things started to change in your history so you can figure out what commit changed the world on you.
He suggests things like using Cucumber first for outside in testing - that way you can cover a lot of the application early on. Many other suggestions including things like test driven exploration. Lots of notes to review, lots of food for thought.
Building Rich Applications in Rails
Yehuda Katz was on this morning talking about how you may think about writing your own rack-based Restful platform to serve data for RIAs, using something like Sinatra, but that Rails gives you so much that you should take pause and really think about it. He suggests building Rich Applications in Rails.
He had tons of details on how to approach writing restful APIs, especially on returning predicatable results in JSON, so that your programs can consistently call the API in a safe way. He discussed the Bulk_API project, which lets you do things like POST /api/bulk?posts=1,5,6,34 so that you can get them back with one hit, etc...
I also saw a talk on the Engine Yard sponsored Trinidad project. This is a server that hosts rack-based applications on JRuby using Tomcat behind the scenes. You can configure tomcat using YAML, deploy multiple applications, and it's now on my short list of new engines to take a look at. More on that project at the gitub site, https://github.com/trinidad/trinidad.
All-in-all, I see a lot of activity in the Rails community and a lot of life. There is an energy here and tons of people deeply committed to the platform and language. Rails 3 seems to be "growing up" into the enterprise a bit more, and DHH seems committed to opinionated development and dependency injection (take bundler for example), and to not just improving rails, but delighting developers with very well thought out and meaningful improvements.
Published at DZone with permission of Ken Rimple , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.