Archive

Push Back Explored

Posted on Wed 28 Mar, 2007

‘Push Back’ is a simple concept succinctly explained in 37signals’ book, Getting Real. When translating requirements into code, issues often crop up that make implementation impractical. Something about the structure of your project resists a new feature.

Getting Real suggests ways to mitigate push back. I’m going to explain how to spot push back occurring in your code.

Methods or variables become hard to name

If you’re having issues naming things, perhaps you don’t fully understand the problem you’re trying to solve. If the concept is ill-defined,...

Continue reading → | Tagsprogramming, theory

Rails quality control tip: use verify in controllers

Posted on Wed 7 Mar, 2007

Have you found that any of your Rails projects get hits to controller methods that expect parameters? A neat way of handling this is the ActionController::Verification module.

By adding calls to verify in your controller, you can elegantly catch all kinds of unexpected but reasonable uses of your system: from mistyped URLs and browser history auto-complete to web crawlers blindly following links. This way, you can redirect people somewhere logical instead of flashing them with an error message.

You can even insert a message into the flash:

verify :params => “user”,
:only => ...

Continue reading → | Tagsruby, rails, tips, programming

Rails speed tip: link_tag caching

Posted on Tue 6 Mar, 2007

Have you ever tried concatenating your JavaScript and CSS files for performance improvements? The idea is that latency is a bigger issue than file size when loading web pages, so stuffing all your JavaScript into a monolithic file for deployment should improve performance.

I wrote a rake task to do this for some of my applications (such as tiktrac). This is slightly more cumbersome than a feature I spied in the ActionPack changelog:

Added caching option to AssetTagHelper#stylesheet_link_tag and
AssetTagHelper#javascript_include_tag [DHH]. Examples:

stylesheet_link_tag :all, :cache => ...

Continue reading → | Tagsrails, programming, tips