Thread: Today's XKCD

  1. #1
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445

    Today's XKCD

    Submitted without comment:

    xkcd: Optimization
    What can this strange device be?
    When I touch it, it gives forth a sound
    It's got wires that vibrate and give music
    What can this thing be that I found?

  2. #2
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    It's funny. I've been preparing for a few days a post in here about the relationship between green code and premature optimization. Juts being lazy about it and taking my time to finish.

    This XKCD however reminds me of something else: We all are guilty of premature optimization to one extent or another. I find it funny that even on languages like Python which are specifically designed to put explicit, flat and simple code above other considerations, you go to a python group and all people want to ask is how much faster a map function is over list comprehension when function calls are involved. Or how people compete for performance on Project Euler solutions.

    Reminds me... you know the amount of times you have heard, or said so yourself, that stateful global variables are bad? Millions of times, spread maybe around a couple of hundreds different people. Me too. And him over there too. And her. Everyone in fact. Everyone always hears that advice by everyone else. You would think that no one in the world uses stateful global variables and everyone is just making sure it stays that way...
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by Mario F.
    Reminds me... you know the amount of times you have heard, or said so yourself, that stateful global variables are bad? Millions of times, spread maybe around a couple of hundreds different people. Me too. And him over there too. And her. Everyone in fact. Everyone always hears that advice by everyone else. You would think that no one in the world uses stateful global variables and everyone is just making sure it stays that way...
    Well, maybe it is a bit of a mixed message since one of the first things C++ beginners learn is the stateful global variable named std::cout, and then one of the first things C beginners learn is to use printf, which is equivalent to a form of fprintf with the stateful global variable (or rather expression amounting to a global variable) stdout...
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  4. #4
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    I like to be positive and assume that people eventually understand global variables need to be justified, instead of just never used. After all, people seem to prefer global variables to singletons. The more people understand about scope, the less likely they are to abuse it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Good xkcd today
    By Fordy in forum General Discussions
    Replies: 3
    Last Post: 09-20-2012, 09:34 AM
  2. I'm 30 today
    By Salem in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 05-16-2008, 06:36 AM
  3. Programming today...
    By robid1 in forum C Programming
    Replies: 4
    Last Post: 05-23-2003, 05:39 AM
  4. What are you doing today?
    By Carlos in forum A Brief History of Cprogramming.com
    Replies: 10
    Last Post: 01-23-2002, 06:57 PM
  5. Today is...
    By Betazep in forum A Brief History of Cprogramming.com
    Replies: 6
    Last Post: 10-06-2001, 02:50 PM

Tags for this Thread