Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. Another loop bites the dust

Another loop bites the dust

Scheduled Pinned Locked Moved The Weird and The Wonderful
testingbeta-testingcareer
21 Posts 9 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q QuiJohn

    SomeGuyThatIsMe wrote:

    I have yet to find a use for a do..while loop, and continue to wonder what you really need them for.

    That's a bit of a horror right there.


    Faith is a fine invention For gentlemen who see; But microscopes are prudent In an emergency!            -Emily Dickinson

    S Offline
    S Offline
    SomeGuyThatIsMe
    wrote on last edited by
    #10

    i've just found other loops more usefull, i understand what they're for, just never found a situtation nwhere they're the best fit, in the above i would have use while copies > 0, and not had to check what the value of copies was as long as i checked the user input to make sure its a number, depending on how they were allowed to enter it. i've known people who have been doing thise for 15 - 20+ years and they have to go out of their way to use one. maybe it got ingrained in my head at some point to not think using post checks, and to always use prechecks..i dont know.

    Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

    L 1 Reply Last reply
    0
    • S SomeGuyThatIsMe

      i've just found other loops more usefull, i understand what they're for, just never found a situtation nwhere they're the best fit, in the above i would have use while copies > 0, and not had to check what the value of copies was as long as i checked the user input to make sure its a number, depending on how they were allowed to enter it. i've known people who have been doing thise for 15 - 20+ years and they have to go out of their way to use one. maybe it got ingrained in my head at some point to not think using post checks, and to always use prechecks..i dont know.

      Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

      L Offline
      L Offline
      leppie
      wrote on last edited by
      #11

      I can probably count on one hand the number of times I have had to use do/while, and probably on all fingers and toes the number of times I used just a while (which correlates almost exactly to the number of times I have had to write a TCP server, and then it still has a goto or 2!).

      xacc.ide - now with TabsToSpaces support
      IronScheme - 1.0 alpha 4a out now (29 May 2008)

      1 Reply Last reply
      0
      • L Lost User

        Weeeelll - it was meant to be - the programmer assumed that if they were printing they would want one or more copies - what was really missing was some validation in the GUI to prevent them selecting zero copies (I mean, why would you want to select to print zero copies?)

        Take a chill pill, Daddy-o .\\axxx (That's an 'M')

        P Offline
        P Offline
        PIEBALDconsult
        wrote on last edited by
        #12

        maxxx# wrote:

        the programmer assumed

        See, there's the problem. :-D But if the spec says to do that, then it's OK and you can blame it on the monkey who wrote the spec. Ideally, the programmer would ask for clarification (in an email), and then take a break awaiting a response, however long that takes. But this is clearly a case in which while is the proper construct. Oh...

        maxxx# wrote:

        why would you want to select to print zero copies

        To just save the file on disk. I seem to recall this in a system I had to support a bunch of years ago. The PRINT program would generate a report file, which it could then print. Oh, right, it was a VAX/VMS system, so the file got spooled to a print queue, not sent to the printer directly. As I recall, saying 0 for copies, or 0 for paper type would indicate that you didn't want to print it. Bonus: Even though VAX/VMS allows a print job to specify the number of copies as 1 to 255, this PRINT program only allowed up to 20 :wtf: . One of the users needed 80 copies of a particular report, so she ran it four times, each time having to get the input just right. Eventually I realized what she was doing. Because we had the source code (VAX BASIC X| ) I was able to change the program to allow the full 255 copies.

        L 1 Reply Last reply
        0
        • B Brady Kelly

          Or just a for loop?

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #13

          I seem to remember (it's been a while :-O ) that Cobol didn't have a For loop. In fact all loops used Perform... constructs. There was a Perform Varying - which is like a For In fact there wasn't a While.. or Do.. either - it was all Perform Until... or Perform ... Until.

          Take a chill pill, Daddy-o .\\axxx (That's an 'M')

          1 Reply Last reply
          0
          • P PIEBALDconsult

            maxxx# wrote:

            the programmer assumed

            See, there's the problem. :-D But if the spec says to do that, then it's OK and you can blame it on the monkey who wrote the spec. Ideally, the programmer would ask for clarification (in an email), and then take a break awaiting a response, however long that takes. But this is clearly a case in which while is the proper construct. Oh...

            maxxx# wrote:

            why would you want to select to print zero copies

            To just save the file on disk. I seem to recall this in a system I had to support a bunch of years ago. The PRINT program would generate a report file, which it could then print. Oh, right, it was a VAX/VMS system, so the file got spooled to a print queue, not sent to the printer directly. As I recall, saying 0 for copies, or 0 for paper type would indicate that you didn't want to print it. Bonus: Even though VAX/VMS allows a print job to specify the number of copies as 1 to 255, this PRINT program only allowed up to 20 :wtf: . One of the users needed 80 copies of a particular report, so she ran it four times, each time having to get the input just right. Eventually I realized what she was doing. Because we had the source code (VAX BASIC X| ) I was able to change the program to allow the full 255 copies.

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #14

            PIEBALDconsult wrote:

            you can blame it on the monkey who wrote the spec.

            How did you know it was the monkey?

            PIEBALDconsult wrote:

            Ideally, the programmer would ask for clarification (in an email), and then take a break awaiting a response, however long that takes.

            This was in the days before email! Indeed, in the days before taking breaks!

            PIEBALDconsult wrote:

            To just save the file on disk. I seem to recall this in a system I had to support a bunch of years ago. The PRINT program would generate a report file, which it could then print. Oh, right, it was a VAX/VMS system, so the file got spooled to a print queue, not sent to the printer directly. As I recall, saying 0 for copies, or 0 for paper type would indicate that you didn't want to print it.

            That's just a case of extremely poor UI - why not have a Save and Save and Print option - or something more obvious to show theuser what is happening - selecting zero copies isn't really intuitive to save a file! Oh - and on the system this was written on (TI 990) you could select the number of copies in the spooler - so in fact there was no need for a loop at all!

            Take a chill pill, Daddy-o .\\axxx (That's an 'M')

            P 1 Reply Last reply
            0
            • L Lost User

              I just remembered this one: Programmer had job of writing report output - and the user could select the number of copies. Do PrintReport(); numberOfCopies = numberOfCopies - 1; Until numberOfCopies = 0; Worked fine in his testing, even passed system testing. Then a user decided they didn't want to print after all and, instead of cancelling, selected 0 copies... They replaced the paper in the printer twice before realising the same report was still printing.

              Take a chill pill, Daddy-o .\\axxx (That's an 'M')

              Y Offline
              Y Offline
              Yusuf
              wrote on last edited by
              #15

              I don't know which one is more horror. The code or the user who replaced paper twice :omg: :wtf: :omg: :wtf: :wtf: :omg: :wtf: :omg: :wtf:

              Yusuf

              L 1 Reply Last reply
              0
              • Y Yusuf

                I don't know which one is more horror. The code or the user who replaced paper twice :omg: :wtf: :omg: :wtf: :wtf: :omg: :wtf: :omg: :wtf:

                Yusuf

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #16

                Yeah - I once had a user backing up their data, every day, to floppy for six months. Then they had a crash and needed to restore and the restore didn't work. I had to go over to see what the issue was... I Start restore "Insert Disk 1" I ask for the first floppy, and insert it... "Disk 20 of 20: Please insert disk 1 of 20" I ask for the first floppy.. "Oh, there's only one." says the user. "But this is disk 20" quoth I. "So," i calmly stated "when the backup program said 'Insert Disk 2 then press Enter to continue.' you pressed Enter. Then when the message **Warning disk will be Formatted - All data will be lost**', you just pressed Enter again?" "Yes." replied the user, in a tone which suggested that only a fool would do anthing else. "and the same for disk 3, and 4 ... We thought it was clever to fit all that data onto one disk! Isn't that what formatting means?" I suppose I should have realised they weren't the smartest bunch on the planet when, in previous years, they had folded an old 5 1/4" diskette in half to send through the post (and stapled a with-compliments slip to it) and seemed surprised that I couldn't read it!

                Take a chill pill, Daddy-o .\\axxx (That's an 'M')

                P 1 Reply Last reply
                0
                • L Lost User

                  Yeah - I once had a user backing up their data, every day, to floppy for six months. Then they had a crash and needed to restore and the restore didn't work. I had to go over to see what the issue was... I Start restore "Insert Disk 1" I ask for the first floppy, and insert it... "Disk 20 of 20: Please insert disk 1 of 20" I ask for the first floppy.. "Oh, there's only one." says the user. "But this is disk 20" quoth I. "So," i calmly stated "when the backup program said 'Insert Disk 2 then press Enter to continue.' you pressed Enter. Then when the message **Warning disk will be Formatted - All data will be lost**', you just pressed Enter again?" "Yes." replied the user, in a tone which suggested that only a fool would do anthing else. "and the same for disk 3, and 4 ... We thought it was clever to fit all that data onto one disk! Isn't that what formatting means?" I suppose I should have realised they weren't the smartest bunch on the planet when, in previous years, they had folded an old 5 1/4" diskette in half to send through the post (and stapled a with-compliments slip to it) and seemed surprised that I couldn't read it!

                  Take a chill pill, Daddy-o .\\axxx (That's an 'M')

                  P Offline
                  P Offline
                  PIEBALDconsult
                  wrote on last edited by
                  #17

                  Ah, tech support just isn't as much fun as it used to be. :laugh:

                  L 1 Reply Last reply
                  0
                  • L Lost User

                    PIEBALDconsult wrote:

                    you can blame it on the monkey who wrote the spec.

                    How did you know it was the monkey?

                    PIEBALDconsult wrote:

                    Ideally, the programmer would ask for clarification (in an email), and then take a break awaiting a response, however long that takes.

                    This was in the days before email! Indeed, in the days before taking breaks!

                    PIEBALDconsult wrote:

                    To just save the file on disk. I seem to recall this in a system I had to support a bunch of years ago. The PRINT program would generate a report file, which it could then print. Oh, right, it was a VAX/VMS system, so the file got spooled to a print queue, not sent to the printer directly. As I recall, saying 0 for copies, or 0 for paper type would indicate that you didn't want to print it.

                    That's just a case of extremely poor UI - why not have a Save and Save and Print option - or something more obvious to show theuser what is happening - selecting zero copies isn't really intuitive to save a file! Oh - and on the system this was written on (TI 990) you could select the number of copies in the spooler - so in fact there was no need for a loop at all!

                    Take a chill pill, Daddy-o .\\axxx (That's an 'M')

                    P Offline
                    P Offline
                    PIEBALDconsult
                    wrote on last edited by
                    #18

                    maxxx# wrote:

                    extremely poor UI

                    Yeah, well the system was developed in Roswell, New Mexico, so all bets are off. :-D

                    L 1 Reply Last reply
                    0
                    • P PIEBALDconsult

                      Ah, tech support just isn't as much fun as it used to be. :laugh:

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #19

                      Nope - but we still use the "Have you tried switching it off and back on again" trick ;)

                      Take a chill pill, Daddy-o .\\axxx (That's an 'M')

                      1 Reply Last reply
                      0
                      • P PIEBALDconsult

                        maxxx# wrote:

                        extremely poor UI

                        Yeah, well the system was developed in Roswell, New Mexico, so all bets are off. :-D

                        L Offline
                        L Offline
                        Lost User
                        wrote on last edited by
                        #20

                        PIEBALDconsult wrote:

                        Yeah, well the system was developed in Roswell, New Mexico, so all bets are off

                        So it was an UFO GUI?

                        Take a chill pill, Daddy-o .\\axxx (That's an 'M')

                        1 Reply Last reply
                        0
                        • L Lost User

                          I just remembered this one: Programmer had job of writing report output - and the user could select the number of copies. Do PrintReport(); numberOfCopies = numberOfCopies - 1; Until numberOfCopies = 0; Worked fine in his testing, even passed system testing. Then a user decided they didn't want to print after all and, instead of cancelling, selected 0 copies... They replaced the paper in the printer twice before realising the same report was still printing.

                          Take a chill pill, Daddy-o .\\axxx (That's an 'M')

                          S Offline
                          S Offline
                          Spacix One
                          wrote on last edited by
                          #21

                          you mean they didn't want 4294967294 copies??? (till it reached zero again)


                          -Spacix All your skynet questions[^] belong to solved


                          I dislike the black-and-white voting system on questions/answers. X|


                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups