Another loop bites the dust
-
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')
-
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')
when you found that did you get a metal image of the guys from the Guiness commercials saying "BRILLIANT!!", I have yet to find a use for a do..while loop, and continue to wonder what you really need them for.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
-
when you found that did you get a metal image of the guys from the Guiness commercials saying "BRILLIANT!!", I have yet to find a use for a do..while loop, and continue to wonder what you really need them for.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
Well, maybe a mental image. Would that we had Guinness commercials in this land of Aus! Oh - and it was a Do..Until loop And they're very useful when you want to do something at least once, and possibly more than once, but never never.
Take a chill pill, Daddy-o .\\axxx (That's an 'M')
-
Well, maybe a mental image. Would that we had Guinness commercials in this land of Aus! Oh - and it was a Do..Until loop And they're very useful when you want to do something at least once, and possibly more than once, but never never.
Take a chill pill, Daddy-o .\\axxx (That's an 'M')
maxxx# wrote:
they're very useful when you want to do something at least once
Yet the above code is not such a situation.
-
maxxx# wrote:
they're very useful when you want to do something at least once
Yet the above code is not such a situation.
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')
-
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')
Or just a for loop?
-
when you found that did you get a metal image of the guys from the Guiness commercials saying "BRILLIANT!!", I have yet to find a use for a do..while loop, and continue to wonder what you really need them for.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
I use do...while on occasion. It's actually a useful loop that ensures code is performed at least once. Certainly you can always do the same loop using a standard while loop, but often it increases readability and comprehension.
-
Well, maybe a mental image. Would that we had Guinness commercials in this land of Aus! Oh - and it was a Do..Until loop And they're very useful when you want to do something at least once, and possibly more than once, but never never.
Take a chill pill, Daddy-o .\\axxx (That's an 'M')
personally i dont think you're missing much by not having Guiness, but why not just do while copies > 0 no other validation needed, except to ensure the value entered was a number.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
-
when you found that did you get a metal image of the guys from the Guiness commercials saying "BRILLIANT!!", I have yet to find a use for a do..while loop, and continue to wonder what you really need them for.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
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
-
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
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.
-
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.
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 awhile
(which correlates almost exactly to the number of times I have had to write a TCP server, and then it still has agoto
or 2!).xacc.ide - now with TabsToSpaces support
IronScheme - 1.0 alpha 4a out now (29 May 2008) -
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')
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.
-
Or just a for loop?
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')
-
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.
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')
-
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')
-
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
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')
-
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')
Ah, tech support just isn't as much fun as it used to be. :laugh:
-
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')
maxxx# wrote:
extremely poor UI
Yeah, well the system was developed in Roswell, New Mexico, so all bets are off. :-D
-
Ah, tech support just isn't as much fun as it used to be. :laugh:
-
maxxx# wrote:
extremely poor UI
Yeah, well the system was developed in Roswell, New Mexico, so all bets are off. :-D