Hey again,
"I think 150 lines is huge, I want to do it in two. =D"
heh.
"Although, when would anyone want to switch variable values? Just use the
one that
already has the right value. Saves three lines of code!"
Good point. I just liked the question because it makes them think.
"My record is currently at 761 lines for a script including comments and
empty lines. I think 150 isn't huge.".
So what did you do in those 761L?
That script I showed is actually:
[EMAIL PROTECTED] dmiid]$ cat mine.php | wc -l
125
Only 125L of code. You can view it here:
http://www.projectskyline.com/phplist/mine.txt
Its a datamining script.
"I wish I could spend more time on learning PHP."
Me too. Right now I'm working through, 'PHP5 Objects, Patterns and
Practice",
& 'The PEAR Installer Manifesto'. <-- Is pretty neat so far...I'm curious
about
using phing and the pear channels for distributing applications and
application
updates. Oh, and not to mention 'Pro PHP Security'.
I should buy some stock in bookpool & Apress! heh.
- Ben
Ben Sgro, Chief Engineer
ProjectSkyLine - Defining New Horizons
+1 718.487.9368 (N.Y. Office)
Our company: www.projectskyline.com
Our products: www.project-contact.com
This e-mail is confidential information intended only for the use of the
individual to whom it is addressed.
----- Original Message -----
From: "David Krings" <[EMAIL PROTECTED]>
To: "NYPHP Talk" <talk@lists.nyphp.org>
Sent: Saturday, July 07, 2007 8:05 PM
Subject: Re: [nyphp-talk] Questions to ask at a job interview?
Ben Sgro (ProjectSkyLine) wrote:
Hey again,
So, I had a string of interviews over the last two weeks.
I have just hired one candidate that I believe will be a good addition to
our company.
I ended up using the Joel Spolsky (or whoever coined this) question:
I have two variables and I want to switch their values.
Some candidates totaly froze, and other's got it quickly.
I'd use a third variable to keep a copy of one variable before basically
making both the same first and then assigning the saved to copy to the
originally uncopied variable.
Did I get hired?
No! Well, unless you are desparate...
Thanks to Google I now know the answer:
$x = $x xor $y;
$y = $x xor $y;
$x = $x xor $y;
I guess this shows that I have no formal programming training. Although,
when would anyone want to switch variable values? Just use the one that
already has the right value. Saves three lines of code! Same amount of
lines is used with a helper variable, but the xor stuff uses less memory.
I also showed some source code, a *small* 150L script, and asked them
what it did.
Not only was it commented, but the function & variable names are
extremely obvious.
Mind sharing that test script with me (us)? I simply want to know how good
or bad I am.
Some looked in awe and said, "this is a small script?" while some took a
few minutes
and looked over the code, then attempted to explaint to me what it did.
My record is currently at 761 lines for a script including comments and
empty lines. I think 150 isn't huge.
Overall, it was a great experiance. I look forward to finding new talent
to add to our growing
company.
Thanks for all the responses and feedback!
- Ben
Thanks for asking and sharing with us. And for giving a PHP beginner an
awesome opportunity to pick up some more skill. I wish I could spend more
time on learning PHP.
David
David
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk
NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com
Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk
NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com
Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php