Re: Had an interview



On Fri, 02 May 2008 11:23:13 -0700, Andrey Tarasevich
<andreytarasevich@xxxxxxxxxxx> wrote:

andrew.nesterov@xxxxxxxxxxxx wrote:
...
Once I've read a following joke in a programming errs and traps book:

Implement a block that inputs either 1 or 2 and outputs the opposite:
1 -> 2, 2 -> 1
The author continue with three hypotetical solutions:
1. A programming class instructor:
if ( x == 1) x = 2;
if ( x == 2) x = 1;

I don't know why you call it "solution", since it's obviously incorrect.

2. A programmer:
if ( x == 1) x = 2;
else if ( x == 2) x = 1;

That would be a beginner/inexperienced programmer.

A "programmer" would most likely opt for the '?:' operator in this case.

3. A mathematitian:
x = 3 - x;

In reality that would the solution for a _good_ programmer.

x^=3; // explain wtf this is doing right here
Best regards,
Spehro Pefhany
--
"it's the network..." "The Journey is the reward"
speff@xxxxxxxxxxxx Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog Info for designers: http://www.speff.com
.



Relevant Pages

  • Re: Controlling COBOL DDs named SYSOUT
    ... Our primary software vendor once 'fixed' a problem with a console ... I have to confess I once was a programmer myself. ... a joke about a 'fuzzy' bit, but the joke lit a fuse. ... to all logged on production control / "help desk" users (their TSO ...
    (bit.listserv.ibm-main)
  • Re: Your mindset about Forth?
    ... http://howto-pages.org/shootfoot.php (BTW: the Unix joke is very funny, ... This means no garbage collection, ... programmer can be productive with such a system, ... more clean than Forth, has garbage collection, a type system, but still ...
    (comp.lang.forth)
  • Re: kernel stack challenge
    ... to me the combination of lazy programmer ... not successful in making a joke - sorry. ... Do you Yahoo!? ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: OT: Job description humor
    ... >get) for a programmer who could code based on actually recieving specs? ... Haven't you ever heard the old joke, "You start coding, I'll go find ...
    (comp.lang.cobol)
  • Re: Had an interview
    ... Once I've read a following joke in a programming errs and traps book: ... A "programmer" would most likely opt for the '?:' operator in this case. ...
    (comp.arch.embedded)