[UPHPU] Coding Correctness

Daniel C. dcrookston at gmail.com
Wed Oct 8 15:31:00 MDT 2008


On Wed, Oct 8, 2008 at 2:54 PM, Justin Giboney <jgiboney at gmail.com> wrote:
> I went to a job interview last Thursday in which I felt I did well except
> for one question that he asked me. He asked me to create a PHP function that
> takes an input and outputs even if a number is even and odd if a number is
> odd.* Below are the function that I wrote in the interview, and the function
> that I would have liked to have written in the interview. Now here are some
> questions for you:
> 1) is there a big difference in the two functions?
> 2) if you could grade these on completeness, how would you score them?
> 3) what would be your perfect answer?

I think that Antoine de Saint-Exupery said it best:

"A designer knows he has achieved perfection not when there is nothing
left to add, but when there is nothing left to take away."

Your first function was better.


More information about the UPHPU mailing list