Why I chose to build a framework at a 3-hour interview

I encourage the use of known frameworks over custom ones, but I decided not to use one when, at an interview, I had 3 hours to prove the technical aspects I’ve been talking about at the first encounter with the employer.

The task was simple: build a REST web service (using PHP and MySQL) and make some operations on a resource, and a small JavaScript client to interact with the service.

I felt that using a known framework for a basic task like this I couldn’t show too many principles I use when developing. It wasn’t the moment to build a production ready app, it was just to show I can DO what I KNOW.

So my 3-hour journey building a framework from scratch started. It had basic components like:

  • front controller
  • bootstrap
  • config file with a service for it
  • autoloading
  • router
  • dependency injection container based on a trait
  • main service to handle a request, execute the appropriate resource controller method with a global error handler, and return the JSON response
  • resource controller
  • multiple database driver factory with a MySql implementation
  • database repository
  • service between the controller and the repository
  • exception for each service and for each situation
  • some sanity checks

Although everything was written fast, with only the basic needs, I focused on some aspects:

  • it was clean
  • most of things decoupled
  • where I wanted to point out further needs, I just left a comment, so they now I’m aware about the situation
  • it was built as I’ve previously told them I see an implementation like
  • services based on contracts
  • types enforced by hinting

And they loved it.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.