Thread: the three mutually exclusive goals of programming

  1. #1
    Registered User
    Join Date
    Mar 2011
    Posts
    596

    the three mutually exclusive goals of programming

    Long ago I used to hear often that you can accomplish three things in programming:

    small code size
    fast code
    short developement time

    And that you could always accomplish any two of those but not all three.

    Is that still true today?

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Nope. Probably never was...

    A decent programmer acquires a set of skills that contribute to both development speed and well written code, good compilers provide automatic production of highly optimized code...

  3. #3
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    These are just soundbites meant to impress and give some sort of romantic notion to programming. They are hardly verifiable, do not under any circumstance constitute a universal truth to such a complex and heterogenous task as programming, and can in fact, under most circumstances, be easily proven wrong. Because they are usually given in the shape of some sort of unquestionable truth, they tend to restrain critical thinking.

    Ignore those and many other sayings.
    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.

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    You can always accomplish all three simultaneously by changing your notion of "small", "fast" and "short". However, if you ignore these relative notions and understand the saying as just being about trade-off, then it becomes obvious that some trade-off between time and improvements of different kinds will always be present, and not only in programming.
    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

  5. #5
    Registered User
    Join Date
    Mar 2011
    Posts
    596
    Interesting answers.

    The time I was referring to had very little hardware to perform things like video or even
    audio.

    Speed was needed in the code itself. So that has definitely changed and may not be
    a factor, at least for certain applications.

    But assuming there was no hardware to handle the speed problem, Would it still be true?

  6. #6
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    Being defeatist in many areas of my life, I refuse to accept further notions of failure in programming.

  7. #7
    Registered User
    Join Date
    May 2011
    Location
    Around 8.3 light-minutes from the Sun
    Posts
    1,949
    Quote Originally Posted by megafiddle View Post
    Interesting answers.

    The time I was referring to had very little hardware to perform things like video or even
    audio.

    Speed was needed in the code itself. So that has definitely changed and may not be
    a factor, at least for certain applications.

    But assuming there was no hardware to handle the speed problem, Would it still be true?
    I think Laser summed this up quite well.
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

  8. #8
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Quote Originally Posted by megafiddle View Post
    But assuming there was no hardware to handle the speed problem, Would it still be true?
    I don't understand what you mean by "no hardware". But does it matter if I don't? What can possibly exist in every software development project ever written that makes it true that no code can be both simple, fast and quick to write? If we are ready to accept this, we need to identify the causes. Otherwise we are dealing with an unproven statement.

    Laserlight makes an interesting point about trade-offs. It's a well known problem in programming. But these don't exist everywhere, or are always relevant if they do (in which case the terms "fast", "simple" and "quick" assume different meanings). So the simple matter of fact is that the way the saying on your OP is constructed makes it very easy to write it off as being false.

    Quote Originally Posted by whiteflags View Post
    Being defeatist in many areas of my life, I refuse to accept further notions of failure in programming.
    Oh boy, I couldn't empathize more!
    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.

  9. #9
    Registered User
    Join Date
    Mar 2011
    Posts
    596
    It does seem difficult to achieve all three at once, though. I remember writing a graphics library for the
    Commodore 64, which had none. The computer was so slow, that assembler was only way to do it.
    I came up with a very small code size of very fast graphics functions, callable from BASIC. But I really
    can't say if it could have been done in less time. I couldn't. And I don't know if some else could have
    either. That graphics library was not an easy project.

  10. #10
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by megafiddle View Post
    Interesting answers.

    The time I was referring to had very little hardware to perform things like video or even
    audio.

    Speed was needed in the code itself. So that has definitely changed and may not be
    a factor, at least for certain applications.

    But assuming there was no hardware to handle the speed problem, Would it still be true?
    How far back in history did you have to go to dig that up... 25 years? maybe more...
    Back to days when MS-DOS was king, I'm betting...
    Heck, even a 386 machine could play videos at TV resolution with full stereo sound.

  11. #11
    Registered User
    Join Date
    May 2011
    Location
    Around 8.3 light-minutes from the Sun
    Posts
    1,949
    Well, at least this is in the GD forum.....
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

  12. #12
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by AndrewHunter View Post
    Well, at least this is in the GD forum.....
    Oh my... what a nice double ententre!

  13. #13
    Registered User
    Join Date
    Mar 2011
    Posts
    596
    Oh, yes, I am talking about the 80's.

    But now, is speed coming from speed efficient code or hardware?

  14. #14
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by megafiddle View Post
    Oh, yes, I am talking about the 80's.

    But now, is speed coming from speed efficient code or hardware?
    Ummmm... lets see... 16 mhz, 16 bit IAPX86 vs 3 ghz 64 bit AMD64x2 .... What do you think?

    Round here you can't even buy a machine under 1.6ghz and the "entry level" desktop system is a dual core 64 bit processor running 2.8ghz.
    Last edited by CommonTater; 08-23-2011 at 10:22 AM.

  15. #15
    Registered User
    Join Date
    Mar 2011
    Posts
    596
    Indeed.

    How much incredibly sluggish code might be out there, and no one notices?

    Fast machines do free up a programmer to concentrate on things other than speed.

    Sometimes.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. including headers mutually?
    By nacho4d in forum C++ Programming
    Replies: 6
    Last Post: 02-21-2010, 06:09 AM
  2. Mutually dependent classes
    By MacNilly in forum C++ Programming
    Replies: 9
    Last Post: 03-17-2009, 03:39 AM
  3. Exclusive or in if statement?
    By Quantum1024 in forum C Programming
    Replies: 3
    Last Post: 03-26-2005, 02:10 PM
  4. GUI Programming :: C++ Exclusive
    By kuphryn in forum C++ Programming
    Replies: 5
    Last Post: 01-25-2002, 03:22 PM
  5. bitwise-exclusive-OR operator: ^
    By mikebrewsj in forum C++ Programming
    Replies: 2
    Last Post: 01-15-2002, 11:52 PM