27 May '13, 1am

Muito bom o Refactoring, bem parecido com o sugerido no livro Clean Code.

While working on AwesomeResource , I needed to implement functionality that would make the following test pass: it "creates readers and writers for any attributes passed in during initialization" do article_class = Class.new do include AwesomeResource end article = article_class.new("title" => "Fun") article.title.should == "Fun" article.title = 'Fun Times!' article.title.should == 'Fun Times!' expect { article.unknown_attribute }.to raise_exception end Simple enough. If you initialize an instance of a class that includes AwesomeResource, then you get attribute readers and writers for any hash keys passed in during initialization. My first attempt at implementation looked something like this: module AwesomeResource attr_reader :awesome_attributes def initialize(attributes={}) @awesome_attributes = AwesomeResource::Attributes.new attributes end def method_missing(method_nam...

Full article: http://pivotallabs.com/method-modeling-a-refactoring/

Comments

  1. 27 May '13, 5am

    Nike Dunks - Your Shoes With Comfort and Fashion http://www.nikeschuheonlinebestellen.eu/

    • See on:

Tweets

My latest blab: Why Pivotal

pivotallabs.com 26 May '13, 9pm

It is a time-honored tradition for Pivots to blog about their first few months at Pivotal. A typical day at Pivotal is str...

@PreedePriscila #coffee #coffeelovers #illy #mo...

illy.com 27 May '13, 12am

A máquina moka é fácil de utilizar e produz um café com corpo e rico em aromas. A máquina mais conhecida tem a forma de um...

Tim O’Donnell, Amanda Stevens Earn First Ironman Titles In Brazil: Photo: Ironman.comTim O’Donnell narrowly mi...

Tim O’Donnell, Amanda Stevens Earn First Ironma...

triathlon.competitor.com 26 May '13, 8pm

By the 40K mark of the bike, O’Donnell had built a lead of five minutes over the closest pursuer, Francisco. By 80K that l...

New method to pull MtGox trade data #bitcoin

bitcointalk.org 29 May '13, 6am

* These fields represent the app ID when an app is being used to make the trade. Currently, these are null for all but 4% ...

“Don't do a refactoring in the middle of making...

blog.hasmanythrough.com 31 May '13, 12pm

The illustrious Chris Eppstein recently tweeted : If some code should be refactored, stop what you are doing and refactor ...

Pairing at @pivotallabs, illustrated

Pairing at @pivotallabs, illustrated

pivotallabs.com 28 May '13, 1pm

There are particular tropes that come up again and again when pairing. I’ve decided to canonize a few as comics. Enjoy!

Finding Pivotal

pivotallabs.com 21 May '13, 4am

The year is 2005. I’m one year out of school, and a year into a job doing PHP web development at a small development firm ...