Saturday, June 27, 2009

It's groundhog day for Haruhi!

Finally! The moment I've been waiting for, for nearly 600 years: The time loop episode, yay!

Being a die-hard fan of the Suzumiya Haruhi Light Novels, finally we could experience Endless Eight in all its glory.

What's more, we can finally see Nagato ACTUALLY showing emotions. Who can NOT feel compassion for this poor girl?


Nagato! Don't despair! We love you!!!

Sunday, June 7, 2009

The depression is over!


NEW LIFE, HERE I COME!


A week ago I joined okcupid.com, an online dating site based on questionaires so that you can find your match based on politics, moral, hygiene, religion, common interests, sexual tastes, attitudes towards life and whatnot. Answering over 1000 multiple-choice questions has helped me know myself and boost my self-esteem. I no longer feel lonely or doomed to die abandoned by everyone. I go to bed with hope instead of pain, and wake up with joy instead of the burden of having to live another day.

FINALLY, I am free!!

If a nerd girl (otaku preferred) wants to become my girlfriend and lives in Mexico City, feel free to visit my dating profile.

Anyway. My current job is still going to be very demanding for the next two weeks. Maybe then I'll be able to resume work on my open source projects.

Until then, so long!

Monday, June 1, 2009

The Front Controller Pattern: Removing redundancy in web applications

Hello, everyone! I'm here posting from my new job. In my frist day I've been given a series of documents to study. Turns out that we'll be using a front-controller architecture.

In my previous job, I used an MVC approach to design our web applications. But I noticed that there was a lot of redundancy in the "main" scripts. Basically, I did the following:

  1. Define the used variables
  2. Access session data
  3. Call the appropriate method based on the current action
  4. Process the results


The only necessary part for each script is step 3. Call the appropriate method based on the current action. So what am I doing with a bunch of nearly identical scripts that have to be customized?

This is where the Front Controller pattern comes in.

The Front Controller Pattern

In a nutshell, a Front Controller is a single script that serves as a front-end for all your applications. All the other scripts are called through some parameter (usually defined in the URL as a query string variable, or some path to a "script").

The trick is that the front controller already handles authentication, session, etc. If you want to add, for example, a traffic control routine to limit the number of calls per second, you can do it in the front controller.

For more information about the Front Controller pattern, check out these links:

http://java.sun.com/blueprints/patterns/FrontController.html

http://w3style.co.uk/a-lightweight-and-flexible-front-controller-for-php-5

http://www.ibm.com/developerworks/library/os-php-designptrns/

http://evolucionphp.blogspot.com/2007/09/front-controller-pattern.html (spanish)