Subj : Re: puzzle To : comp.programming From : spinoza1111 Date : Sun Jul 10 2005 02:42 am karen wrote: > wrote in message > news:1120211926.453597.228690@z14g2000cwz.googlegroups.com... > > > > > > karen wrote: > >> wrote in message > >> news:1119341868.873117.107560@g44g2000cwa.googlegroups.com... > >> > >> ok here is a puzzle. > >> there is an integer array whose length is odd, and all the numbers in > >> the array appear exactly two times except one. Find the number in O(n) > >> time. Try to do it without using any other data structure. > >> > >> Note that word "INTEGER". It doesn't HAVE to work for floating point > >> systems! > > > > Real programming is not a matter of solutions isomorphic to problems, > > and responding to one problem as expressed "today" with a solution > > tuned to that problem. > > > > Instead, the real programmer recognizes, as an aura around the user's > > expression of the problem, a genuine class of problems to which today's > > problem will evolve. > > > > > Conducting itself as an Adult in relation to the user's Adult, real > > programming insists on joining the user and in many cases seeing > > further. > > > > Real programmers do indeed need to look past the original specs and see if > there is other data there to indicate that the problem is not completely > defined. But they should also be careful of going beyond specs when those > specs are set. The boss doesn't want you to make a rigid solution that has > to be rewritten when the specs stretch a bit. The boss also does not want > you to spend all of your time finding a solution that covers everything, > including things way outside the spec, and end up not producing everything. > The boss wants you to solve a problem well and completely and in a timely > manner. Does he, Karen? And who is this "boss"? Is he Ken Lay of Enron? Odds are that Ken Lay didn't want his network analysts and coders to solve the problem of divulging actual profits and actual predictions of Enron stock values to mere employees. In fact, he may have "wanted" an undocumented and unmaintainable system that would hide the reality of the debacle from its own designers, each of whom would have a partial view of the whole, and who were the midlevel employees victimized by being persuaded to hold Enron stock after it declined. Your "boss" above is an cartoon and an abstraction which indeed encapsulates what our society expects of front line managers. Do front line managers live up to this image? Many bosses, in fact, don't want a "good" solution even if it's "timely" and in many contexts, writing better code gets one in trouble, for it sticks out and may be unmaintainable, its practice being in fact unfamiliar to unqualified programmers. Practice in my experience has converged to a "timely" solution and a "happy" user, and the second requirement has two degrees of freedom, or more. The "user" may be "happy" because she knows the requirements cold and has herself tested and used the system thoroughly and is pleased with both its correctness and its user interface. Or, the "user" may be "happy" because he's a complete moron, and the system seems to run without crashing. Or, the "user" may be "happy" because one of the programmers is a drug dealer, who has sold him Viagra, cocaine, and ecstasy, and the user may be happily snorting coke in his black van in the parking lot on his lunch hour. I am not trying to be droll, although I am very droll if I do say so, myself. Instead I am pointing out the limits of a curiously American, curiously (in David Reisman's terms as found in Reisman's sociological analysis of the white collar, The Lonely Crowd) other-directed and curiously ready to DEFINE something hard, something mathematical, something scientific, in terms exclusively of a "happy" "user"...to whom we can like children turn over the key duty of an adult professional, which is to risk his life, his fortune, his sacred honor on his perception of truth, while of course continuing to demand a professional life in a nice suburb away from The Colored People. Reisman, in the 1950s, asked how long a society based on interpersonal transactions exclusively, based in fact on "happy" computer users, could stand and the answer seems to be "not long", as sherrif's deputies in California give people-pleasing programmers and their families 15 minutes to gather their belongings and leave in a foreclosure, because Daddy's VB-6 knowledge is out of date. Condoleeza Rice was probably a "happy" user at Stanford and as Provost when Stanford reassured her that the replacement of Stanford's long-standing, in-house-developed systems would work without a glitch when replaced by a commercial system, and she remained so because she was, like so many university administrators are, called away to work for the government at a high and happy level. Condi was probably happy when her information people including IT people not to worry her pretty little head about al-Qaeda in August 2001. It's left to the programmers, of course, to be sad when at 3:00 AM it turns out not to be so in very many interesting ways, each one of which means More Work for the Team, and never More Schnapps for the Band. It's left to the programmers and network analysts on September 11 who were to be sad when 9-11 dispatchers, never looking up from their goddamn computer screens, told them to stay put and Respect Authority. And just as your "boss" is an abstraction, the programmer who has to be guided between the Scylla of a slapdash solution and the Charybdis of a complicated system is another abstraction. He's a Child in relation to the idealized Parent boss, and this family romance simply doesn't fit reality in most if not all cases. Many programmers are MORE aware of software and its maintainability issues than a boss with an "MBA". I'm not saying all programmers are, of course, but I do claim that the practice of programming, not management homilies in staff meetings, teaches how to separate and to balance our concerns. Why is it, Karen, that in our society the white collar adult is so childish and why does he need this boss-parent abstraction? > > So, is there anything else besides the original spec to give us more > information? Why yes, there is. The subject line is "puzzle". A puzzle > means that they aren't looking for a complete, expandable, useful in all > cases piece of code. "Puzzle" means they are looking for a slick solution, > something that may not be useful anywhere at all, and something that fits > the specs as listed. Now, if the OP were looking for an actual solution to > a problem, that would have been different. Nobunny, in other words, wanted to "think"? Just asking, kid. > > And, if it's any consolation, I'm glad you requested more information on the > actual slick solution. I'm not so good of a programmer that I could have > figured it out with just clues. So some of us needed more. And if the OP > was trying to get his homework done, well at least he had to wade through a > lot of reading before the answer was handed to him. Thanks for this comment. > > -karen .