
Where Are All the Qualified Programmers? - nickb
http://blog.slickedit.com/?p=180
======
nradov
I don't understand complaints about a shortage of developers. In a free market
economy there is no such thing as a shortage, by definition. There may be
occasional, temporary imbalances between supply and demand. But over several
years the market will equalize at the natural clearing price. If there was
really a shortage then labor prices would increase sharply, and that would
cause more smart people to get educated and enter the market.

Of course, when most industry executives complain about a programmer shortage
what they really mean is they are having trouble finding smart, experienced
people who will work long hours on boring projects for low pay. Imagine that.

~~~
Tichy
That seems incorrect to me. Sure the market will find the right price for a
programmer, but that doesn't mean the economy as a whole could not be better
off with more programmers.

As an example, imagine that Web Development was so difficult that only one
programmer on earth could pull it off. Maybe that programmer would get paid
millions or even billions, but there sure as hell would not be as many useful
web applications around as there are today.

~~~
geebee
True - lots more talented people would benefit the world. But you have to
consider opportunity cost as well. If web application development required
genius level knowledge, then you'd have to convince one of the best minds in
some other critical field to switch over to it. Suppose the only person who
could write webapps is also capable of engineering a sustainable and pollution
free source of energy. The world might be better off with _no_ webapps at all.

A lot of people have pointed this out - it actually takes quite a bit of
talent to write reasonably unbuggy code that updates payroll from the eight
different departmental database systems. It's just terribly boring, and not
especially well paid, so the people with this kind of talent either do other
things in the software world, or don't work in software at all.

~~~
Tichy
Sure, I was only taking issue with the claim "In a free market economy there
is no such thing as a shortage, by definition". Let's take food as another
example: if there is not enough food to feed all people it doesn't help much
that the market will establish a fair price for the food. Some people are
still going to starve.

In the long run the market might try to provide more food, but perhaps there
simply is a limit to the amount of food that can be provided.

Likewise for good programmers - maybe the amount of people who are intelligent
enough is severely limited? Although I suppose woith 6 billion people, there
should be the one or other with sufficient brains...

~~~
nradov
Your food shortage example isn't relevant to programmer shortages. Food
shortages typically only occur when governments impose price controls that
artificially force prices below the market price. Then farmers stop growing
and distributors hoard supplies. Total worldwide food production is far in
excess of what it would take to adequately nourish all 6.5B+ people; for
practical purposes food production capacity is unlimited. Major famines now
are typically caused by breakdowns in the distribution system due to wars,
natural disasters, or active governmental malice (c.f. North Korea and
Zimbabwe); this is not a market issue.

The fundamental point is that if there really were a shortage of programmers
then programmer compensation would be rapidly increasing. However, industry
data shows that average compensation is increasing at only slightly more than
the rate of inflation. Therefore, there can't possibly be a shortage right
now.

~~~
Tichy
I am thinking in more abstract terms, not making any claims about todays
actual food production. Historically, I think most of the time food shortage
was caused by climate problems (bad weather, eroding soils, etc). I just
wanted to make the point that the market will not always be able to provide
what everybody needs, simply because the market can not provide more than what
is available.

Interesting point about the compensation rates, but I'd like to think more
about the issue before accepting the argument (note that I don't claim that
there is a shortage of programmers).

~~~
nradov
No, historically most food shortages have been caused by bad government.

------
dpapathanasiou
The point about H1-Bs and lower salaries has some merit, but the author fails
to mention perhaps the most significant reason.

Good programmers don't want to work at dull jobs in large companies (though
there are some exceptions, e.g. for i-banks, hedge funds, etc., since people
_will_ tolerate dull tasks for substantially better than average pay).

------
downer
> _like "How do your reverse an array without a temporary variable?"_

You hard-code it using XOR. Note you can't even do a for-loop, as that's using
an extra variable. Of course hand-unrolling a loop takes extra memory because
it's so many extra lines so there's no point.

    
    
     a ^= b
     b ^= a
     a ^= b
    

This is very unlikely to be something that occurs to programmers who haven't
had to XOR recently; if you aren't writing your own hash or crypto or codec
functions then you probably haven't used it in a while. Now that you've seen
this, you'll remember it and so if anyone asks, you won't be figuring it out
again, just recalling.

IMO it's a pretty useless way to weed people out, kind of like testing people
on chess by random arrangements of pieces. Chess experts remember actual legal
positions that occur in games much better than non-players, but they are no
better at remembering positions that never occur -- a bunch of kings on a
chessboard, some in adjacent squares, for example.

Likewise, this kind of pattern NEVER occurs in what most people program; it's
just implausible.

~~~
neilc
You can use a for loop, if you step through the array with pointer arithmetic.
On the assumption that you're given the array length (or else that the array
is of fixed size), you don't need to hand-unroll the loop, which wouldn't
handle a variably-sized array anyway.

But I agree that it's a bad interview question.

~~~
downer
Doing p++, len-- uses two temporary variables.

~~~
neilc
You don't need a temporary variable for "p" -- if the task is to write a
function, you must have a pointer with the address of the start of the array,
not an array variable as such. And yeah, you need some way to tell the length.

~~~
downer
... _and_ where you are in the array, hence the temp variable.

Write it out to see.

So it still doesn't work, even if you use a function to "cheat" and get a
"free" pointer (which, by the way, wasn't what the task said).

~~~
neilc
Yeah, I suppose you'd need 1 temporary variable. Your solution doesn't work
either, though: doing the freshman XOR trick some arbitrary fixed number of
times just reduces to the XOR trick, which is plainly not what the task asked.

~~~
downer
It does work, you do the 3-step XOR with a[0] and a[last], then a[1] and
a[last-1], etc. The 3-step XOR from the OP swaps the data.

Here it is with a 4-element array, a[0] through a[3]:

    
    
     a=[100,200,300,400]
    
     a[0] ^= a[3]
     a[3] ^= a[0]
     a[0] ^= a[3]
    
     a[1] ^= a[2]
     a[2] ^= a[1]
     a[1] ^= a[2]
    
     a
     [400, 300, 200, 100]
    

(Pretend this list is an array, it's just for illustrative purposes)

~~~
neilc
Well, obviously the XOR swap works. But how do you use that to reverse an
array of variable size? (i.e. where "last" isn't known at compile-time, so the
number of swaps isn't known in advance).

~~~
downer
You don't; it's basically, "here's an array, now reverse it" (keep in mind a
pointer is not an array).

<http://www.lysator.liu.se/faq/c-faq/c-2.html>

The general point is that interviews of this type are counterproductive.

~~~
neilc
An array can be variably-sized in C (C99, that is). And thank you, I know the
difference between an array and a pointer. You just seem to have arbitrarily
interpreted the question to limit it to C89 and a fixed-size array in order to
make your solution work.

~~~
downer
This has nothing to do with it being statically sized or variably sized. You
have to know what size it is when you are going to reverse it. The solution
presented works as long as the programmer knows what the size is.

If you want to posit any kind of _sane_ question, then you can have a sane
solution.

~~~
neilc
Well, suppose I have an array `A' of size `len'. How would you write an
algorithm that reverses that array in place, without using any temporary
variables, and that works for arbitrary values of A and len? I think the
answer is "you can't". You can't claim to have a solution for the problem if
it only works for a fixed input, and if the solution itself would be different
for different inputs.

~~~
downer
> I think the answer is "you can't".

That's what I said a few posts ago.

> You can't claim to have a solution for the problem if it only works for a

> fixed input, and if the solution itself would be different for different

> inputs.

"Reverse _this_ array". Done. "Reverse an _unspecified_ array of arbitrary
length" is a different problem :)

