View this site in English Ver este site em português

Archive September, 2010

QCONSP – 2010

18 September, 14:47, by zehzinho Tags:

Hi, last weekend I went to São Paulo to attend the QCON São Paulo Conference (www.qconsp.com), an event of INFOQ. I had lots of expectations about this conference and I can tell you in advance they were all met. Since almost everybody is going to write about the conference in portuguese, I’m writing only the english version of this post.

I’m not going to talk about all talks, but only about the (IMHO) most interesting ones, ok? :)

The first day

The first talk of the event was “Data Architecture at Twitter Scale” by Nick Kallen, from twitter. The presentation was very similiar (if not the same) as this one. As you can notice from the presentation, only a few important topics were discussed and it made glad to see that all of them had simple solutions. Nothing very tricky. It’s sad that only a few privileged people have to face these kind of problems in their daily work. You can see a nice review (in Portuguese) of the talk here.

The second interesting talk was “The State and Future of JavaScript” by Douglas Crockford, the father of JSON and member of the ECMAScript Committee. Mr Crockford presented the history of JS and the some stuff from the new 5th version of the standard and how the standardization process was handled. Many things called my attention, specially the weird facts about floating points. It made me think “gosh, I have to study JS seriously”. I’m really considering buying his book. Mr Crockford has many interesting stuff in his website and many videos spread out on the web. You should really consider spending some time reading or listening to some things he has been saying.

Then, in the afternoon, I attended some talks in the Agile Track. All the presentations were very interesting and I could extract some patterns, “Stick yourself to the Agile Manifesto” was the most recurrent one. It remembered me a quote from Ralph Waldo Emerson:

“As to methods there may be a million then some, but principles are few. The man who grasps principles can successfully select his own methods. The man who tries methods, ignoring principles, is sure to have trouble”.

The second day

The second day really started with the talk “Best Practices for Large-Scale Web Sites — Lessons from eBay” by Randy Shoup. Very interesting to know how big monsters handle 10 bi requests/day.

Then came Mr. Scott Ambler talking about “Scaling Agile: Strategies for Taking an Agile Approach in Complex Situations”. I expected more from this talk, but it had some interesting numbers about the real effects of Agile practices in projects. Mr Ambler has collected data from lots of projects, which is not a common practice in the Agile community. You can find more at his blog.

In the afternoon I decided to attend some ruby (on rails) talks. I didn’t find them very interesting, very probably because I’m not a ruby guy. I was starting to get tired and thinking that that afternoon was lost. But then came the last two talks of the day.

The “first” talk was titled “NoSQL: acertos e erros” (or “NoSQL: hits and mistakes”) by Gleicon Moraes e Alexandre Porcelli. Those two guys were very funny, specially Gleicon, an the content of the presentation was just great. This talk alone made me think the day had been saved.

But then came Mr. Klaus Wuestefeld talking about his proposal for a new Agile methodology: “Learning and Coolness“. I’m not going to write about it, since you can read the important stuff directly from Klaus itself.

Final Considerations

Friends. I'm the first one right to left

QCONSP was not one of those events where you go and see a bunch of talks about specific topics in a class style. The great achievement of many talks were to make me review some concepts and open my mind to new ones. Thank you very much guys. QCONSP surely was a very good time and money investment.

Finally, I’m leaving you with some photos I’ve taken during the event. You can also find photos from many different people here.

[Cake on Steroids] Overcoming the redirect() problem using testAction

15 September, 17:09, by zehzinho Tags: ,

Hi, one problem which is faced by people trying to use the testAction method in their controller’s tests is the occurence of redirects in the actions. There are some solutions on the web for this problem. For example, some people like to call the methods directly from an instance of the controller.

Anyway, for those like me, who find the testAction method useful and  still want to use it, I’m using a simple solution for this problem (perhaps I borrowed something from the web, but I sincerely don’t remember from where). The nice part is that you can check the flash messages defined in the controller, which I think is useful.

The  first step is to define a constant in the WEBROOT/test.php file. I use the following sentence:

define('CAKEPHP_UNIT_TEST_EXECUTION', true);

Then, in my (app_)controller I overwrite the redirect method to check if I’m running tests:

function redirect($url=NULL, $code=NULL) {
    if (defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
      $this->set('TEST_REDIRECTED_URL', $url);
      $flash = $this->Session->read('Message.flash');
      $this->set('TEST_REDIRECTED_FLASH', $flash);
 
      if (isset($flash['message'])) {
        $this->set('TEST_REDIRECTED_MESSAGE', $flash['message']);
      }
    } else {
      parent::redirect($url, $code);
    }
  }

That’s all guys. Now you can go check your flash messages writing tests like this:

 function testMyControllerAction() {      
      $result = $this->testAction('/mycontroller/action',
        array(
           'return' => 'vars'
        )
      );
 
      $this->assertTrue($result['TEST_REDIRECTED_MESSAGE'] ,"The flash message I'm expecting");
    }

Nice? What do you think? I don’t know. Any flaws? I’m waiting for your comments :P

This blog now has a Portuguese version

04 September, 11:30, by zehzinho Tags:

Hey, I finally decided to write posts also in portuguese (my native language). The main reason for doing it is that there are some topics which concern only people who speak portuguese or live in Brazil:

www.josericardo.eti.br/pt

For the other topics, I will keep writing in english and perhaps also in portuguese, ok?

You can always switch the language by clicking on the flags on the right top corner of this page.

See ya.