To read all comments associated with this story, please click here.
ingraham,
I upvoted your post because I thought it was insightful. However...
"For example, after learning that add instructions are faster than multiply, a developer starts writing 'x+x+x' instead of '3*x' in their code. But adding is not TWICE as fast as multiplying, so he just slowed down his code."
It is silly to manipulate source code to optimise cases that can just as easily be handled by any respectable compiler, but I found your example ironically humorous because I performed this micro benchmark just now, and x+x+x was indeed faster than 3*x on my x86 processor. Only once I reached 4 did it become slower. The fastest solution by far was (x<<1)+x (this can be done in a single opcode on x86 btw).
Edit: Programers should be aware that the compiler already does these optimisations under the hood.
Edited 2012-09-30 04:47 UTC
Real programmers don't rely on nebulous optimization that are less optimum, as known from "The Story of Mel, a real programmer". :-)
http://www.pbm.com/~lindahl/mel.html
Thanks, Alfman; very interesting stuff. I must admit that I did not encounter the "x+x+x" issue myself. I *THINK* I heard that story from Herb Sutter and Bjarne Stroustrup at SD West about five years ago, but I could be misremembering. The point remains, however, that you can mis-apply knowledge, even if that knowledge is accurate.
This pretty much says it all. I don't think anyone would like to work with someone like you. Good companies not only care about making money, but also about retaining their staff by promoting learning and freedom of expression.
You seem to have a rather disrespectful opinion about those people who ocasionally "reinvent the wheel". If the existing solution has deficiencies, there is every reason for people to come up with their own implementations. The call whether to use the existing code or roll your own is not just for you to make, it should be made by the team and the individual developers who are responsible for delivery and maintenance of the final product.





Member since:
2006-05-20
You know, I had a discussion recently where my mother sent me a quote from circa 1965 about how terrible a job parents were doing raising their kids... and COMPLETELY missed the irony. I found especially hilarious that she said, "I really do think we're headed for a Fall of Rome scenario." Doesn't she remember what people thought of HER generation? My commie, free-love, drug-addled, flower-child mother, who now drives a mini-van in the suburbs, going on about how kids today have no moral compass!
Point by point:
1) "Old Programmers Had to be More Resourceful and Inventive"
Yes and no. Sure, they were far more resource constrained. But then, no one expected them to launch a social network site for millions of users... by Monday. Today, developers have lots of resources, but far more is asked of them.
2) "The Barriers were Higher Back in The Day"
Again, a plus and minus. How many really smart people didn't bother with programming because it was too difficult to get in to?
3) "CopyPasta is Rampant"
Eye of the beholder. If you write your own sort or search algorithm in production code you should be fired on the spot. I would NOT tolerate a coder who thinks he's better than everyone else out there, and thus leaves an unsupportable mess behind. True, copy-pasting won't get you to be the next Herb Sutter, but I'm in business to MAKE MONEY, not make better developers.
4) "People use Frameworks Too Much"
Same as point 3. If there's a framework out there, USE IT. If you're writing a C program, even "Hello, world!," you'd damn well better be using the APR or Glib. Don't you dare try to write your own XML parser. Again, fire-able offenses.
Final note) You can know a lot and still be an idiot. For example, after learning that add instructions are faster than multiply, a developer starts writing "x+x+x" instead of "3*x" in their code. But adding is not TWICE as fast as multiplying, so he just slowed down his code. And he may well have given up some optimization a later compiler might be able to do.
Bottom line: Everybody always claims it was better back in the day. You could call it "Rosy Retrospection" if you like. In Latin they called it "memoria praeteritorum bonorum." That's right, even in ancient Rome they thought back fondly on those times before indoor plumbing.