UG> it isn't about knowing phone numbers or styles, it is a basic
UG> simple parsing question that any decent perl hacker should be
UG> able to do.
PJH> The problem is that there are way too many programmers which then take
PJH> their solution to your "toy problem" and apply it to the real world.
PJH> There are a lot of registration forms which require a phone number as a
PJH> mandatory field but don't accept my phone number because it it has too
PJH> few or too many digits or I have formatted it differently than the
PJH> programmer expected (and of course he doesn't tell me what he expects -
PJH> he just tells me "please enter a valid phone number" and deletes the
PJH> other 20 fields I have already entered. There are also forms which don't
PJH> accept email addresses with a "+" in the local part, or punctuation in a
PJH> house number. And so on.
you are missing the point. it is NOT a real world problem. it is just an
exercise given during an interview. it is meant to see HOW the candidate
solves a problem and thinks about it.
Right. What we disagree about is what answers we expect. You and Wilbur
expect the interviewee to say "All right, that's easy. A phone number is
always 10 digits and the first three are the area code. Plus there may
be some interpunctation characters (dash, blank, parentheses), so I'll
just hack together a regex for that". I expect the interviewee to say
"That's hard. A phone number could be local, long distance or
international. Both country and area prefixes can be variable length and
there seem to be no generic rules. Plus, those rules change over time,
so even if we get it right now, it's probably wrong next year. So we
have to think about how we can maintain them. And anyway what do you
want with an area code when most people are using cellphones?" Or
something like that. If an interviewee assumes that his local phone
number scheme is all there is and immediately start coding, I'd flunk
him for not thinking things through.
Of course you can always turn it into a simple programming question by
adding restrictions. For example something like this:
We have phone numbers from several sources. We know all of them are
US numbers (or at least they should be), but they are formatted
differently [list of possible formats here or ask the interviewee to
provide one]. We want to get them all into a common format
[description here]. Write a program which converts them all into
this format and writes those which cannot be converted to a
different file for later inspection.
good questions about formats are a plus.
IMO they aren't a plus, they are absolutely required.
not even being able to code up a basic simple parser for a basic
number is bad.
The problem which you refuse to see is that outside of the US there is
no "simple parser for a basic number". And implicitely assuming that
local conventions are universal is a very bad trait in a programmer. The
examples I provided were real, and they were not from the website of a
grocery store somewhere in the midwest - they were from large,
international companies, who apparently employed programmers who
couldn't think beyond their own nose - programmers who would answer
Wilburs question the way you and Wilbur want, but who are utterly
incompetent for their job.
this thread is crazy. charlton knows the difference between real world
and interview.
Maybe he does but I think he filters for the wrong skills. But maybe
he's looking for code monkeys, not programmers.
hp