Chariot Training Classes

Training Courses

I run Chariot's training and mentoring services. We provide training in AngularJS, HTML5, Spring, Hibernate, Maven, Scala, and more.

Chariot Education Services

Technology

Chariot Emerging Tech

Learn about upcoming technologies and trends from my colleagues at Chariot Solutions.

Resources

Chariot Conferences

Podcasts

« Testing Entity Validations with a Mock Entity - Roo in Action Corner | Main | It's a comin' - Philly Emerging Tech »
Thursday
May192011

RailsConf 2011 - My Personal Recap

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.

Tutorials

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.

DHH Keynote

DHH gave a keynote on the first day (Tuesday) of the conference where he announced the RC release of Rails 3.1 this week.  In 3.1 will be several significant changes, including the default scaffolding now using Sass and CoffeeScript by default instead of CSS and Javascript.  

Also, they're including a refactored application resources approach to deliver Javascript libraries as modules, and bring more organization to that area.  Rails can then aggregate those into something like a /resources URL, very similar in concept to what Spring MVC does today.  All-in-all a needed feature and something that will make it easier to start organizing the way your applications script.

He also mentioned that jQuery will be the default Javascript library going forward, rather than prototype.  

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).

Active Support

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...

Confident Code

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.

Coffee Script?

Ok, I never heard of this before now.  Yes, I've been hiding under a rock.  Think of a simple language like a Groovy for Javascript, and a pre-compilation process to turn it into Javascript.  Bingo, that's Coffee Script.  I had really wanted to see that talk, but it was super-over-full and so I just sat down and hacked with Coffee Script itself.  VERY cool idea.  I have to see how it works in practice, and how to integrate things like jQuery with it, but wow.  You should just take a few minutes and hack around with it. 

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...

He mentioned some Javascript templating engines, something I have to check out (echo, handlebars /moustache, etc..)  So much detail in that talk!

Trinidad

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.

Wrap-up

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.

 

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments (1)

Very nice coverage of the Rails Conf 2011 sessions.

As always a lot to take back and a lot to learn.

May 19, 2011 | Unregistered CommenterManik Juneja

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>