SPOILER Re: SPUG: scalar swap challenge

Lee Wilson devnull at devnullsoftware.com
Thu Oct 9 13:36:17 CDT 2003


On Thu, 9 Oct 2003, Colin Meyer wrote:

> Actually, I quite enjoy interviews with silly puzzles. I assume that
> Lee would eschew this sort of thing in real code. It is fun (and
> probably good brain exercise) to think about code puzzles, and play
> with them *in a non production context*.

	If I actually saw someone programming something my example in
production code, I would be annoyed because it's not at all readable or
clear what it's doing.  In fact, it's pretty ugly code =)  I would then 
try to figure out what it's doing, rewrite it to be readable (even if the 
new way might be slightly less efficient - code readability is, in most 
cases, more important than a saved instruction cycle or two), and go talk 
to the original coder (if they were still around).  Probably in that order 
=)
	The reason I ask the question in interviews is to see how the
person's brain works - not necessarily if they're smart, but more how they
go about solving a problem where the answer is not immediately obvious.
	Other questions I ask tend to be much more practical: given a
database schema, give SQL to find various bits of info; grok this section
of code and tell me what the output will be; code a function to look up an
element in a multi-bucket hash; program a function to give the maximum
depth of a binary tree; write a perl sub that accepts as input a string, 2 
scalars, an array, a hash, a filehandle, and a string, then write the 
calling line; etc.
	The obfuscated code sample I showed here is more of a "fun"
question, in all honesty (as you suspected).

==============================================================================
Lee Wilson - INTP                               http://www.devnullsoftware.com
Software Developer / RealNetworks                    http://www.realarcade.com
Home:425-895-9868          Cell:425-890-5463              Office: 206-892-6410
==============================================================================
              There are 10 kinds of people in the world: 
                the people who understand ternary, 
                  the people who dont, but care, 
            and the people who don't understand or care.
==============================================================================




More information about the spug-list mailing list