Thread: the three mutually exclusive goals of programming

  1. #16
    Registered User
    Join Date
    Mar 2011
    Posts
    596
    Quote Originally Posted by Mario F. View Post
    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.
    At one time almost everything was done in software. There were no graphics accelerators or sound chips.
    Machines were so slow and small, that some things could only be done in assemby language.

    Also, it wouln't apply to every program, of course.

    I imagine it applied to projects where all three considerations were either critical or very important.

  2. #17
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Quote Originally Posted by megafiddle View Post
    At one time almost everything was done in software. There were no graphics accelerators or sound chips.
    Machines were so slow and small, that some things could only be done in assemby language.
    So you mean almost everything was done in hardware.
    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. #18
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    You're not thinking of this are you?
    Project triangle - Wikipedia, the free encyclopedia
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #19
    Registered User
    Join Date
    Mar 2011
    Posts
    596
    No, but that does looks like the same type thing. One was likely derived from the other.

    Just something the software guys at one place I worked used to talk about.
    Their projects were fairly large, and the "triangle" seemed to be a constant consideration.

  5. #20
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Then, quite frankly, they were worried about all the wrong stuff.

  6. #21
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,909
    Code:
    #include <stdio.h>
    
    int main(void)
    {
        puts("Hello world!");
        return 0;
    }
    It's small (4 lines of code plus two lines with brackets).
    It's fast. You won't find anything too much quicker at outputting text than the stdio functions.
    It was quick to develop. It took much well under a minute to type.

  7. #22
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by megafiddle View Post
    Indeed.

    How much incredibly sluggish code might be out there, and no one notices?
    Quite literally ... tons of it.

    What passes for efficient code today --especially with 3rd party abstractions and object oriented programming-- isn't efficient at all. Software overhead (also called "bloat") has become an accepted fact of life, especially in "managed" languages like C# and Java... There was a time when people were refusing to install Visual Basic code because of all the DLLs that came with it, essentially duplicating functions already on their systems. These days we install monstrosities like .NET and Java runtimes that are 10 times as big without a second thought. Every CPU cycle uses time, but that's not even a consideration these days...

    Fast machines do free up a programmer to concentrate on things other than speed.
    Sometimes.
    Yes they do... but they also lead to "stuff we couldn't do before" which can be a good thing. Consider things like high definition video, multi-channel audio and enormously complex scientific code. But just as often they lead to crap like Borland's Delphi wich sucked up a full megabyte of memory just to play a single midi file in MCI... Bloatware is no joke, but we seem increasingly unlikely to even care how big our code gets. What the heck... memory is cheap and CPUs are fast, just pound it out and get it working in the shortest time possible.

    This triangle of yours is a balancing act...
    The goal is to get working code that is reasonably stable into the hands of users as quickly as possible...

  8. #23
    Registered User
    Join Date
    Mar 2011
    Posts
    596
    Yes, there new challanges with the new possibilities.

    Now if the programmers had to work within size and speed constraints,
    how quickly could they have delivered that stuff?

  9. #24
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    What does it matter?

    The entire programming industry is a whole different animal than it was in the 1980s... there have been large changes, even in the past 5 years we've seen new operating systems, 64 bit code becoming the norm, and even some talk of 128 bit processors on the drawing boards... 5 years from now it will be different again... The challenge is to keep up.

  10. #25
    Registered User
    Join Date
    Mar 2011
    Posts
    596
    I understand what everyone is saying, I just don't think that's what the "triangle" was originally
    intended to mean.

    Of course a tiny program can meet all three requirements. That was always true. Just as a large
    complex program can meet all three on a huge superfast computer.

    A question I should have asked first is, "what does it actually mean"? My interpretation is apparently
    different from many.

    If you use a large lookup table to reach an execution speed goal, I would say that you have not met
    the small size requirement, even if it fits on a typical machine. Now that itself is arguable, but I also
    think that it was part of the original thinking concerning the "triangle".

    The memory in an operating system like windows can shrink pretty fast if you are using other programs
    simultaneously. As can the effective processor speed.

  11. #26
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    Quote Originally Posted by anduril462 View Post
    Code:
    #include <stdio.h>
    
    int main(void)
    {
        puts("Hello world!");
        return 0;
    }
    It's small (4 lines of code plus two lines with brackets).
    It's fast. You won't find anything too much quicker at outputting text than the stdio functions.
    It was quick to develop. It took much well under a minute to type.
    There is actually a 4th goal or factor being traded off in your code: it does little of use.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

  12. #27
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,909
    Quote Originally Posted by grumpy View Post
    There is actually a 4th goal or factor being traded off in your code: it does little of use.
    It is of great use if the goal is to write a hello world application, which is a very common goal that almost every C programmer has had at least once in their life. Besides, usefulness is not in the OP's 3 criteria, and it's just as relative as small code size, fast code and short development time. Oh, and I was joking

  13. #28
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by grumpy View Post
    There is actually a 4th goal or factor being traded off in your code: it does little of use.
    Oh I don't know... Hello World comes in pretty handy for testing new compiler installations... It means it works at least well enough to successfully compile code.

  14. #29
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    A question I should have asked first is, "what does it actually mean"?
    I'd be willing to say it is an empty concept. Because:

    If you use a large lookup table to reach an execution speed goal, I would say that you have not met
    the small size requirement, even if it fits on a typical machine. Now that itself is arguable, but I also
    think that it was part of the original thinking concerning the "triangle"
    You're arbitrarily deciding what is an optimal amount of memory a program can use, and what programs are too slow. If your goal is to solve a complex problem, are you going to count the machine instructions and say that somehow the solution is inadequate even if it solves the problem on a desktop computer in five minutes? Not necessarily. You would have to know what the problem is and how urgently you need the information, as well as what device will give you the answer. If I wanted to run my planner on my wristwatch, that is a very different program than the one on my desktop. And the one on my wristwatch is not better than the one on my desktop, unless I'm using my wristwatch more.

    Not to mention I could postulate the existence of a programming team who do nothing but program wristwatches and wrote my planner in a matter of 90 days, or whatever you personally would find acceptable.
    Last edited by whiteflags; 08-23-2011 at 05:05 PM.

  15. #30
    Registered User
    Join Date
    Mar 2011
    Posts
    596
    I would agree that any standards are arbitrary.

    But I think the important point with the large lookup table example, is that small code size
    had to be sacrificed for speed.

    It does assume that faster code could have been written, given enough time. And that may or may not
    be true, depending on the program. But it is also usually unknown. So it is assumed that it could have
    been written smaller and faster.

    Hope that makes sense.

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