Slashdot Mirror


Not All Bugs Are Random

CowboyRobot writes "Andrew Koenig at Dr. Dobb's argues that by looking at a program's structure — as opposed to only looking at output — we can sometimes predict circumstances in which it is particularly likely to fail. 'For example, any time a program decides to use one or two (or more) algorithms depending on an aspect of its input such as size, we should verify that it works properly as close as possible to the decision boundary on both sides. I've seen quite a few programs that impose arbitrary length limits on, say, the size of an input line or the length of a name. I've also seen far too many such programs that fail when they are presented with input that fits the limit exactly, or is one greater (or less) than the limit. If you know by inspecting the code what those limits are, it is much easier to test for cases near the limits.'"

165 comments

  1. The 80's called... by Anonymous Coward · · Score: 1

    They want their structured programming back...

    1. Re:The 80's called... by Anonymous Coward · · Score: 0

      Use known-good libraries for everything you can. And always test for the null set. And if I could go back to the 80's, I'd do it in a heartbeat.

    2. Re:The 80's called... by Alain+Williams · · Score: 2

      And always test for the null set.

      I once tried to get the following into some coding standards, unfortunately I failed: Every program and function should do nothing correctly

    3. Re:The 80's called... by rvw · · Score: 2

      And always test for the null set.

      I once tried to get the following into some coding standards, unfortunately I failed: Every program and function should do nothing correctly

      You didn't fail, you just failed to notice that you correctly did nothing!

  2. Obvious, but worth restating. by Animats · · Score: 5, Informative

    Fairly obvious statement, but one some newer programmers don't know. Koenig is talking about white-box testing, which is well understood.

    1. Re:Obvious, but worth restating. by deconfliction · · Score: 2

      Yes, we can retitle from "Not All Bugs Are Random" to "White-Box Testing Is A Real Thing"

    2. Re:Obvious, but worth restating. by Anonymous Coward · · Score: 0

      Isn't this rudimentary CS101 intro stuff, or am I not understanding? For example, we need to worry about bounds testing input and not just leaving it up to the user to make the right input within the bounds and of the required type? I've learned bounds testing in even the most trivial of programming classes such as those Web 2.0 savvy interpreted language based intro courses.

    3. Re:Obvious, but worth restating. by Anonymous Coward · · Score: 3, Interesting

      Yep, fairly obvious, but where I work there's this whole class of people who hide their incompetence behind the phrase "black box testing". At first I didn't understand why they insisted so much on doing black box testing, until one day we basically ran into what the article describes: a subsystem behaved poorly when one of its inputs was exactly on the boundary that that very subsystem had defined. In that case I saw the black box bunch crash and burn because they weren't able to even design a good test case, much less diagnose the cause of the problem.

      To me Andrew's article basically says: if you want to be able to test code, you need to be able to read code. There is a whole breed of testers nowadays who are not able to do that.

    4. Re:Obvious, but worth restating. by plopez · · Score: 1

      It is not the ob of black box testers to diagnose a problem, just report the failure. Hence the term "black box testing". They are not debuggers, but rather testers.

      --
      putting the 'B' in LGBTQ+
    5. Re:Obvious, but worth restating. by uncqual · · Score: 4, Insightful

      I think in common usage, white box testing does not mean "debugging" or "diagnosing" the code - it means more like "testing that takes into account the internal design and implementation of the system under test rather than just the inputs and outputs".

      There's a need for both types of testing. However, as long as white box testers don't get too wrapped up in the details to step back and view the system as a whole (as developers sometimes do), they can do both. But there are so few good testers in the business, you don't want to waste a good white box tester on developing black box tests.

      Sadly, I suspect there are quite a few "average" developers out there who, had testing as a career been given more respect by the industry over the decades, would have been "great" white box testers. While there is significant overlap between the skills/personality attributes needed to be a great developer and those needed to be a great tester, there are a bunch of skills/personality attributes that are quite important in one field and not nearly as so in the other.

      --
      Why is there an "insightful" mod and why isn't it "-1"? If I wanted insight, I wouldn't be reading /.
    6. Re:Obvious, but worth restating. by icebike · · Score: 4, Insightful

      Yes, we can retitle from "Not All Bugs Are Random" to "White-Box Testing Is A Real Thing"

      It would make more sense, because there was never an assertion that bugs were random.
      Furthermore limit testing is not a new concept.

      We are so busy giving new names to old concepts, and barfing up new programming languages that we end up re-inventing and re-naming long known concepts with shiny new trendy names that we fail to notice this was well known decades ago.

      --
      Sig Battery depleted. Reverting to safe mode.
    7. Re:Obvious, but worth restating. by Joce640k · · Score: 3, Informative

      Are any bugs truly "random"? I always thought computers were deterministic machines.

      OK, maybe process scheduling bugs are fairly random...the point is that the headline makes it sound like bugs just happen all by themselves.

      --
      No sig today...
    8. Re:Obvious, but worth restating. by Lord+Crc · · Score: 2

      Are any bugs truly "random"? I always thought computers were deterministic machines.

      If your code contains a state machine and the code has a bug where it in some conditions references invalid or uninitialized memory to determine it's next state, then the bug may appear quite random. In fact, it may appear to be several different bugs.

      This is particularly fun when doing cross platform programming, where some platforms always zero initializes memory upon allocation causing programmers who develop on those platforms to think everything is peachy, only to have the code promptly crash or worse when run on platforms which does not zero initialize memory.

    9. Re:Obvious, but worth restating. by Anonymous Coward · · Score: 0

      There's a need for both types of testing.

      More specifically, they have different purposes.
      White box testing is only useful for code that already exists and is considered (temporarily) finished.
      A black box test can be written as long as a proper interface for a function is defined. The test can be created before the code that should be tested exists.
      When refactoring code a black box test can be useful for testing compatibility.

    10. Re:Obvious, but worth restating. by Anonymous Coward · · Score: 1

      Random is used here in the non-technical meaning of "difficult to predict".

    11. Re:Obvious, but worth restating. by ILongForDarkness · · Score: 1

      Exactly. What test your code with values on eitehr side of the branching points in the code. Wow never would have thought of that one.

    12. Re:Obvious, but worth restating. by Anonymous Coward · · Score: 0

      I am sorry but there is no Design Pattern called testing so, what the fuck are you old people talking about???

    13. Re:Obvious, but worth restating. by buchner.johannes · · Score: 2

      Yes, we can retitle from "Not All Bugs Are Random" to "White-Box Testing Is A Real Thing"

      It would make more sense, because there was never an assertion that bugs were random.
      Furthermore limit testing is not a new concept.

      I haven't read TFA, but the newer programming paradigms, such as agile/XP, are heavily test-based. Instead of writing a design, implementing it, and then testing it in production, we start with writing test cases (unit & integration tests, and hopefully some behaviour tests). When they are all fulfilled, we can stop programming.

      But how do you know which tests -- beyond functional ones -- to write? Writing and evaluating is already non-trivial for realistic quality tests (throughput, security). Surprisingly, random input tests work quite well (generated either completely random or from regular expressions).

      Maybe TFA is suggesting to consider the building blocks a test element is made from, and take into account their limitations to craft test cases (white-box testing when doing test-based programming). I'm not saying it's new, but it makes some sense to me to re-iterate from that point of view.

      --
      NB: The message above might reflect my opinion right now, but not necessarily tomorrow or next year.
    14. Re:Obvious, but worth restating. by mikael · · Score: 1

      If you are designing an API, there are dozens of different error codes (invalid value, invalid enumator, run out of memory, invalid handle). Sometimes one bad input could generate three or more errors. But it is the specification which states which error takes priority.
      To make sure everything works as expected, you do all sorts of things:

      Positive testing - making sure things do what they are supposed to do. You look up all the input parameters, work out which combinations are critical and need to be tested together.

      Negative testing - making sure things handle incorrect input. Test every single wrong input one at a time, then move onto pairs of wrong input, and finally all inputs bad.

      Then there are random code and data tests, which just generate random streams of commands. These can pick out things. That method was used to test network device drivers. You just blasted the poor device with a random stream of packets of all values and sizes, and investigate whenever something goes wrong. Unfortunately, randomly generated code usually ends up more like the entry of an obfuscated coding competition.

      Getting real-world data is the best test, especially when it is multi-threaded, then all sorts of weird stuff can appear.
      The

      --
      Vintage computer adverts: http://www.vintageadbrowser.com/computers-and-software-ads
    15. Re:Obvious, but worth restating. by kmoser · · Score: 1

      Cosmic rays can flip bits.

  3. Is this news for anyone? by JeffOwl · · Score: 4, Insightful

    We absolutely test all boundary conditions, on both sides. This is standard practice where I work, for just that reason.

    1. Re:Is this news for anyone? by Jane+Q.+Public · · Score: 2

      I don't even understand why this is being considered as news. If you don't know this already, you aren't the kind of programmer I've ever worked with.

      Now... there are exceptions, too. For example if you know your input will always be less than X characters, you have only one boundary condition to check (no characters). If you know it will always be exactly Y characters you have no boundary conditions. On length, that is... using the same kind of example OP was using.

    2. Re:Is this news for anyone? by mvpll · · Score: 1

      The whole point though is that you don't know your input. It should always be verified, no exceptions.

    3. Re:Is this news for anyone? by AuMatar · · Score: 1

      Yes, but if its supposed to be verified by class/module A, which calls class/module B with clean input, then you don't need to test B with bad input, only A.

      --
      I still have more fans than freaks. WTF is wrong with you people?
    4. Re:Is this news for anyone? by Sique · · Score: 1

      I made it a routine to always check for all boundaries, even for those I believed to be covered already, and to throw an exception if the check fails. Even so often there are other undiscovered bugs that allow the function to be called with invalid data, or someone (often me) later reuses the function at another place and forgets the boundary checks.

      --
      .sig: Sique *sigh*
    5. Re:Is this news for anyone? by Cley+Faye · · Score: 2

      Only if your very confident that B will never ever get it's input from anywhere else, or that if it happen, the "anywhere else" will also properly check it's input. Oh, and you should know for sure that A will never change and suddenly spit something that B won't accept. Better document your code, and hope that the future maintainer will actually read what you wrote.
      In large, long-lived project, these assumptions are all hard to make.

    6. Re:Is this news for anyone? by ChunderDownunder · · Score: 1

      A problem is, a fair % of programmers don't care for code maintenance and unit tests.

      Documenting expected behaviour (e.g. javadoc) as to what exceptions will be thrown and writing unit tests to verify these trivial cases may seem pedantic to some.

    7. Re: Is this news for anyone? by Anonymous Coward · · Score: 1

      though, it produces nice fireworks : http://en.wikipedia.org/wiki/Ariane_5#Notable_launches

    8. Re:Is this news for anyone? by AmiMoJo · · Score: 2, Insightful

      Even if you think you "know" the input will always be a certain length or less than x characters you had better check it anyway and test what happens if it isn't. Otherwise one day you can guarantee it won't match your expectation.

      About 60% of the random, occasional failure bugs I fix are people making these kinds of assumptions. Clocks never run backwards, sensors never fail, data never gets corrupted. In reality they do with alarming regularity.

      --
      const int one = 65536; (Silvermoon, Texture.cs)
      SJW, n: "Someone I don't like, and by the way I'm a fuckwit" - AC
    9. Re:Is this news for anyone? by LWATCDR · · Score: 1

      That is what I thought as well.

      --
      See my blog http://ilovecookes.blogspot.com/ for light hearted technical information.
    10. Re:Is this news for anyone? by plopez · · Score: 1

      It's called integration testing. That is why unit tests are considered insufficient.

      --
      putting the 'B' in LGBTQ+
    11. Re:Is this news for anyone? by uncqual · · Score: 2

      In many cases, the "data corruption" case is just impractical to test for very well unless every datum has a hash or something associated with it or another copy exists and every function verifies the hashes or for both copies matching on entry.

      Also, I've seen code that was so filled with validation of stuff that was already validated or produced by code we wrote that the bugs were mostly in the validation code not the logic associated with the core functionality.

      There is a happy medium. It's important that an appropriate point on the continuum is picked based on the type of task (such as controlling the engines on a commercial jetliner engine vs. making a smart recommendation on what other articles the viewer might want to look at on a news site) and the implementation environment (such as assembly vs. Java). It's also important the everyone on the team grok where that appropriate point is for the task.

      --
      Why is there an "insightful" mod and why isn't it "-1"? If I wanted insight, I wouldn't be reading /.
    12. Re: Is this news for anyone? by linearz69 · · Score: 1

      though, it produces nice fireworks : http://en.wikipedia.org/wiki/Ariane_5#Notable_launches

      "The software, written in Ada....."

      That says it all.

    13. Re:Is this news for anyone? by MikeBabcock · · Score: 1

      Data corruption in my books should be handled by ending execution cleanly so as to not cause further problems.

      --
      - Michael T. Babcock (Yes, I blog)
    14. Re:Is this news for anyone? by ShanghaiBill · · Score: 1

      Data corruption in my books should be handled by ending execution cleanly so as to not cause further problems.

      Just shutting down may be an option if you are writing an iPhone App. If your mission critical flight control system gets corrupt data off the ARINC-429 bus, you better have a plan to deal with it and continue.

    15. Re:Is this news for anyone? by johnsnails · · Score: 1

      My boss wont give me the budget to specifically test (I do stuff as I go along). Thankfully most of the stuff I write is pretty trivial. For more complex stuff I am using a framework (Yii). Buys me a bit of time to test because I get a full working CRUD pretty quickly that looks/is impressive.

    16. Re:Is this news for anyone? by uncqual · · Score: 1

      When it's easily detectable, I agree.

      I've developed in systems where a single data corruption problem that wasn't caught as such (for example, a triple bit error in memory that wasn't detected, let alone corrected, by ECC) would bring down millions of dollars worth of hardware. That quickly got the unwelcome notice of CIOs, and sometimes CEOs, of some large companies. And, I thought that was the best answer as, in those systems, the data integrity was more important than uptime (and we got a nice, if enormous, core dump from all the processors to try and figure out what happened if it hadn't been a hardware error). Obviously a different approach is appropriate for a central telephone switch where loss of data on an individual call once every month is much less important than keeping the system up.

      My main point about data corruption is, it's hard to detect much of it as being "data corruption" and hard to even test for most of it -- only redundancy allows you to detect it in most cases. You can put in hundreds of tests, each with the potential for its own bugs and with the potential to exclude what will, in the future, be a valid state and still miss most of it - SEGV is your friend in this case.

      --
      Why is there an "insightful" mod and why isn't it "-1"? If I wanted insight, I wouldn't be reading /.
    17. Re: Is this news for anyone? by cold+fjord · · Score: 1

      "The software, written in Ada....."

      That says it all.

      Not the important part, no. The problem was bad engineering practice, not Ada.

      Ariane 5 : Notable launches

      The software, written in Ada, was included in the Ariane 5 through the reuse of an entire Ariane 4 subsystem despite the fact that the particular software containing the bug, which was just a part of the subsystem, was not required by the Ariane 5 because it has a different preparation sequence[21] than the Ariane 4.

      Ada is well proven software engineering technology that can help you produce better software, but it isn't magic. You still have to follow sound procedures for it to help you.

      For anyone that is interested, there is more useful detail in these links:

      I heard tell that Ada was to blame for the Ariane V disaster. Is this true?
      Put it in the contract: The lessons of Ariane

      --
      much of left-wing thought is a kind of playing with fire by people who don't even know that fire is hot - George Orwell
    18. Re:Is this news for anyone? by leuk_he · · Score: 1

      or in other words:Let it be someone elses problem.....

    19. Re:Is this news for anyone? by gnasher719 · · Score: 1

      We absolutely test all boundary conditions, on both sides. This is standard practice where I work, for just that reason.

      How do your testers about those boundary conditions? And how do they know about all of them? And how do they know that they know about all of them?

    20. Re:Is this news for anyone? by Anonymous Coward · · Score: 1

      If it depends on class/module A in order to work properly, it shouldn't be an independent class/module.

    21. Re:Is this news for anyone? by ILongForDarkness · · Score: 1

      The only (albeit large) exception is text values I think. I think a lot of people don't write tests to see that FirstName can be 40 chars but not 41 if for no other reason then creating a 41 char test string is a pain. I think unit testing suites should provide easy ways to test bounds like this. Something like Assert.MustBe(Firstname = 40); no generating of random strings, or how is often done someone pounding on a keyboard and counting manually that the string matches the criteria they are trying to impose, just a expression of the actual constraint not an example of the constraint.

    22. Re:Is this news for anyone? by Man+Eating+Duck · · Score: 1

      We absolutely test all boundary conditions, on both sides. This is standard practice where I work, for just that reason.

      I remember an amusing one: user reported a print re-run registration page failing on a few particular orders among thousands during the history of the (subcontracted) application. I found the common factor to be that all failing orders were for 142 copies. It turns out that the handling code for some absurd reason assigned page*count/(amount-142) to the total_page_count (or whatever), and overwrote it with the proper "amount * page_count" in the next line*. The rest of the code worked fine for all positive integers in the relevant range, and it was of course not caught by the unit testing for invalid input. I tracked down the guy who checked in that particular piece of code years later, he had no idea why he originally put it there.

      * Yeah, it was done on a budget, the subcontractor obviously didn't have code reviews. I know there are many ways in which the bug could have been avoided. The application is still in production and works well.

      --
      Are you a grammar Nazi? I'm trying to improve my English; please correct my errors! :)
    23. Re: Is this news for anyone? by linearz69 · · Score: 1

      ADA is a language that was once forced upon large development projects by the government. NO programmer or software designer ever decides to use ADA by choice. The use of ADA points to deficiency in the design process, mainly an over-reach of the requirements into implementation.

      If one ever sees a program written in ADA, run. It will have problems.

    24. Re:Is this news for anyone? by MikeBabcock · · Score: 1

      That was essentially my point -- in cases where all of a sudden your processing realizes the data makes no sense at all, stop trying to parse it, you're going to end up doing more damage (and possibly create an attack vector). This is one of many reasons I still subscribe to the Unix-style "many small specific programs" concept. Let the piece that failed core dump, and with it the data that caused the error and let everything else move on if necessary.

      --
      - Michael T. Babcock (Yes, I blog)
    25. Re:Is this news for anyone? by cwsumner · · Score: 1

      ... Just shutting down may be an option if you are writing an iPhone App. If your mission critical flight control system gets corrupt data off the ARINC-429 bus, you better have a plan to deal with it and continue.

      This.
      Many programs do not have the option to shut down. They must at least try to correct the problem, diagnose enough to present a useful error message, or if all else fails shut down the machinery in a non-violent way. The "rule of thumb" is that 60% of a good program is error handling.
      Even in cell phones or pc's, the user is much happier if it is not always doing what appears as a crash.
      The Halt on Error is only for when you are in school, where the work does not matter...

    26. Re:Is this news for anyone? by rollingcalf · · Score: 1

      If you know the input will always be less than X characters, you have TWO boundary conditions, not one:
      1. No characters
      2. X-1 characters

      --
      ---------
      There is inferior bacteria on the interior of your posterior.
  4. This is not new by Anonymous Coward · · Score: 2, Informative

    http://en.wikipedia.org/wiki/Boundary-value_analysis

  5. Bounds test? by jklovanc · · Score: 4, Insightful

    Has testing degraded so far that people don't now what a bounds test is?

    1. Re:Bounds test? by msobkow · · Score: 1

      You're more likely to hear "What's testing?" from a lot of programmers nowadays.

      Testing was never even mentioned in my university courses, much less formalized.

      --
      I do not fail; I succeed at finding out what does not work.
    2. Re:Bounds test? by Anonymous Coward · · Score: 1

      Has programming degraded so far that people don't know how to write code that won't fail a bounds test ?

    3. Re:Bounds test? by jklovanc · · Score: 1

      With Software Engineering courses more prevalent so is testing. What is a much bigger problem is coder schools who teach languages but not methods.

    4. Re:Bounds test? by bob_jenkins · · Score: 0

      Has testing degraded so far that people don't now what a bounds test is?

      No, it's only slashdot which has degraded.

    5. Re:Bounds test? by Anonymous Coward · · Score: 0

      Testing and error handling both, I wish had been covered more in classes.

    6. Re:Bounds test? by dkf · · Score: 1

      What is a much bigger problem is coder schools who teach languages but not methods.

      They do teach methods! Classes and inheritance too...

      --
      "Little does he know, but there is no 'I' in 'Idiot'!"
    7. Re:Bounds test? by richlv · · Score: 1

      unfortunately... this.
      i'm not a programmer. i can't code anything. but when i see people wiring code and not bothering with any tests for it, i feel sad, because i am seeing way too many regressions in basic functionality that could be caught by a couple of simple tests.
      in addition to passing these problems to users, it is also demotivating for other participants of a project that does not do proper test development. and i do not see a solution to this problem.

      --
      Rich
    8. Re:Bounds test? by TheRealMindChild · · Score: 1

      Bah, bullshit. They teach templates! Templates EVERYWHERE!

      --

      "When life gives you lemons, don't make lemonade. Make life take the lemons back!" -- Cave Johnson
    9. Re:Bounds test? by girlintraining · · Score: 1, Insightful

      Has testing degraded so far that people don't now what a bounds test is?

      It's worse than that. They're using the word "random" to describe the behavior of a digitally based, computationally deterministic system. One. Zero. Off. On. Yes. No. This is all a computer understands. It cannot be "random" in any meaningful sense. It may be sufficiently complex so as to appear random, but it isn't. There's very little "random" about a computer, or a computer program. Every now and then a single bit error creeps into the I/O but the rate this occurs in computers not in space and thus subjected to extreme radiation is so low you could run most tests for many thousands of hours before encountering one.

      Hell, creating randomness is so problematic in a computer that they've had to create specialized circuits to create entropy; And at that, it's still been shown to fall short of being random enough for some cryptographic algorithms... If creating entropy is this hard in a computer, then why do people suddenly point at the sky and say "It was teh randomz!" whenever it crashes? It wasn't random: Something caused it. It just may be beyond your ability or comprehension to know what it was, but it's a deterministic system. It did not just up and decide to fail because it felt like it.

      --
      #fuckbeta #iamslashdot #dicemustdie
    10. Re:Bounds test? by Anonymous Coward · · Score: 0

      Each new generation of computer programmer is marked by a distinct lack of knowledge of classical software development problems that have already been solved. Degree programs tend not to cover this subject nearly as much as they should.

      So, each generation also brings with it a bunch of people who mistakenly believe they have solved a novel problem, and nobly share their solution with the rest of the world. It isn't arrogance that motivates their sensationalism when they do so, it is just a combination of altruism and ignorance.

    11. Re:Bounds test? by Anonymous Coward · · Score: 0

      I blame windows. Windows taught people that 'computers crash, now and then.' They believe that is how computers are. They all crash occationally, don't they? (We who use the alternatives knows better, of course.) And so they don't blame their faulty code, probably just another computer glitch. Computers are random in their crashes - aren't they?

      But glitches happen only due to sloppy programming and lack of testing. But that is not so obvious to the masses that grew up with windows - which were even worse before than it is today. They think computers crash, and it cannot really be prevented. It just happens. Similiar to how they occationally get a popup in the middle of their presentations. It just happens. A pro would turn off anything capable of popping up, but these people are so used that computers cannot be trusted...

    12. Re:Bounds test? by Cley+Faye · · Score: 1

      testing (noun): the action of releasing your program in the wild and cross fingers.

    13. Re:Bounds test? by penix1 · · Score: 1

      support (verb): The act of charging for fixes to the code you didn't do testing on... It is a win-win for both sides...lol

      --
      This is a sig. This is only a sig. Had this been an actual sig you would have been informed where to tune for more sigs.
    14. Re:Bounds test? by Anonymous Coward · · Score: 0

      Something is considered random until it can be predicted. Of course it's not truly random. The word "random" also includes the definition of "odd, unusual, or unexpected."

    15. Re:Bounds test? by Evil+Pete · · Score: 2

      I actually read the article. You know what it is? It is a simplified tutorial on white box testing for people who don't know, that is, amateur programmers. Yeah, that would have once been new and interesting to me, when I was learning to program. Not when I was doing it for a living though. Bad title and summary.

      --
      Bitter and proud of it.
    16. Re:Bounds test? by dbIII · · Score: 2

      It was one of the points of difference between the engineering programming classes and the maths department ones. On the engineering side we were expecting things to go wrong and out of bounds while on the maths side it was all just supposed to work first time.

    17. Re:Bounds test? by dbIII · · Score: 1

      It's worse than that. They're using the word "random" to describe

      The headline and article do not come close to matching.

      It's as bad as the one that makes you think that cheese was being spread on roads when it was really salty water.

    18. Re:Bounds test? by gnasher719 · · Score: 2

      It's worse than that. They're using the word "random" to describe the behavior of a digitally based, computationally deterministic system. One. Zero. Off. On. Yes. No. This is all a computer understands. It cannot be "random" in any meaningful sense.

      In the 68020 processor manual, it says that determining the exact execution time of an instruction is very difficult, even if you know all the details of the processor implementation. That was 20 years ago. Today, precise timing is basically unpredictable. Then you have multi-threading, where the order of operations is basically unpredictable. Then your code is waiting for external events that are totally unpredictable. Anything that has anything to do with timing is essentially random.

  6. No shit Sherlock by cruachan · · Score: 4, Insightful

    You know, I remember writing test plans to to test input that were one below, at, and one above, some arbitrary limit when I was a trainee programmer coding up COBOL on mainframes back in the mid 80s.

    How on earth does this drivel make it onto Slashdot? This is 30 year old news at least (which makes it straight out of the 17th C in internet years)

    1. Re:No shit Sherlock by geekoid · · Score: 1

      Sadly, I still see developers not testing, and are practically afraid of writing test scripts.
      It's not news to you or me, but these reminders are important for newer generations, especially to the 'I want to do it because it makes money and I couldn't care less about computers otherwise' programmers. AKA webmasters!

      --
      The Kruger Dunning explains most post on /. http://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect
    2. Re:No shit Sherlock by Tanuki64 · · Score: 3, Insightful

      Sadly, I still see developers not testing, and are practically afraid of writing test scripts.

      Afraid? Less afraid than not paid for. 'Write your code correctly, then you don't need to test'. A bit simplified, but this is more or less what I heard more than once from a customer.

    3. Re:No shit Sherlock by phantomfive · · Score: 1

      The more interesting article is this one: "Our survey of more than 3,000 developers and managers shows...salaries are on the rise once again"

      --
      "First they came for the slanderers and i said nothing."
    4. Re:No shit Sherlock by aliquis · · Score: 1

      "Pick your staff wisely and we're all sure we'll never make any mistakes!"

    5. Re:No shit Sherlock by Anonymous Coward · · Score: 0

      Don't worry... there is "immigration reform" on the horizon which takes off the number caps off of H-1Bs, so said salaries will be the same as the barista at Starbucks in no short order.

    6. Re:No shit Sherlock by Anonymous Coward · · Score: 0

      Should have responded with "If you didn't age, you wouldn't get old". Welcome to being human.

    7. Re:No shit Sherlock by ChunderDownunder · · Score: 1

      In the case of test inputs, we're largely talking unit tests here, which form part of the code base to verify the functional code is correct. The 'customer' shouldn't have such fine grained control over the development process.

      (As distinct from a black box tester who never looks at the source code etc)

      As far as not using xUnit/TDD, that's often a generational thing where development practices stem from the previous millenium before Kent Beck and others popularised its widespread adoption. I've worked on several projects where senior managers were resistent to adopting unit tests but at the same time had serious problems with unmaintainable code and regressions etc, with many hours wasted sitting in front of a debugger trying to work out the cause of a coding flaw.

    8. Re:No shit Sherlock by Tanuki64 · · Score: 1

      The 'customer' shouldn't have such fine grained control over the development process.

      It is not really a question of fine grained control. More a question of time and money. Suppose you are a consultant, who is asked how much time a certain project needs. You say: Four weeks. You know how to write tests. You like to write tests because you know that requirements evolve and even with a proper design changes in one place might have unexpected consequences in another place. But then comes another consultant, who gives a **** and says: Three weeks. She can do this because she does not care, or is to stupid to even know what a test is. But guess who will get the project?

      Customers don't necessarily get what they pay for. But it is even rarer that they get more than for what they pay.

    9. Re:No shit Sherlock by angel'o'sphere · · Score: 1

      As far as not using xUnit/TDD, that's often a generational thing where development practices stem from the previous millenium before Kent Beck and others popularised its widespread adoption.
      Yepp, and now it is an ideology. Most people / developers don't understand for what you need a unit test. A "unit test" is a set of tests for _one single_ "compilation unit".

      Example: I'm the developer of the Java Collections library (the stuff in java.util, List/ArrayList etc.) As I shift classes back and forth in the "hierarchy" and introduce new interfaces here and there I certainly like to have a "unit test" for every class in the hierarchy and I test every single method (or most of them). Just to be sure a simple change does not break old code that once worked.

      OTOH: if I'm developing a business solution with lots of business classes like "Customer", "Address", "Order", "Delivery", "Bill": I write no unit test at all.
      I write high level acceptance tests, on the business level, for "Use Cases" (or user stories).
      The likely hood that a bug in "Order" and in "Delivery" got introduced and all high level business level tests still work is so close to zero that it is a waste of time to unit test every single stupid pojo.

      So: why is Kent Beck right with unit tests? Because when he made the topic popular he was using languages like SmallTalk!!

      We (that is me and the rest who use jUnit) program Java/C# or any other high level static typed languages. The way how a dynamic typed language is compiled (and executed) is completely different. A hugh deal of "errors" we try to catch with unit tests in a language like SmallTalk or Python is already caught by the compiler in Java/C# etc.

      I've worked on several projects where senior managers were resistent to adopting unit tests but at the same time had serious problems with unmaintainable code and regressions etc, with many hours wasted sitting in front of a debugger trying to work out the cause of a coding flaw.
      Yeah, thats a shame. Don't get me wrong: algorithms in "service classes" should be tested. You imho should start top down, start with tests for high level code (implementing business logic). Watch code coverage. If needed (e.g. a few BOs get changed regularly ... you see that in your version control system) drill down and add unit tests to those BOs.
      Also keep in mind there are excellent tools for code reviews, they work directly on the code repository and summarize changes and integrate into issue tracking systems.
      If you have trouble "fixing" new bugs I would switch from debugging to a code review in a short time to browse over all changes.

      Ok, back pedaling a bit: when you have to introduce testing/unit testing into a team of developers then that means ofc they are unexperienced with testing. In that case starting with simple bottom up testing of BOs (boring POJOs). That means in contradiction to my above stated opinion it makes sense to teach them using "unit tests". When the BOs are under test, try to teach them to test the algorithms working on those BOs. So you introduce "test fixtures", stubbing/mocking, data base rollbacks etc. And finally move up to automated user acceptance tests, like automated clicks through a UI. For Java there are excellent frameworks for that also for browser based applications.

      As I said before, in real development: I do the exact opposite. Click through tests are the first things I write.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    10. Re:No shit Sherlock by Anonymous Coward · · Score: 0

      Sadly, I still see developers not testing, and are practically afraid of writing test scripts.
      It's not news to you or me, but these reminders are important for newer generations, especially to the 'I want to do it because it makes money and I couldn't care less about computers otherwise' programmers. AKA webmasters!

      I test extensively. I write code that is very strict about error returns. I know well how to write parallel and realtime programs.

      I also recognize that every unit test is simply the same code rewritten but for very limited inputs. Writing your code twice can be helpful in complex situations to double check but it is no panacea and most of the time it is only of value to poor programmers who are likely to introduce a lot of errors by accident. It is particularly useless when you're writing graphics, parallel code or anything time sensitive.

  7. Of course not by Billly+Gates · · Score: 1

    Those are features

  8. . . . (redux) DUH by Anonymous Coward · · Score: 1

    And some people cannot be programmers, some cannot hammer a nail, and some cannot wear their wife's clothings in public. You aren't a real man until you can do all three.

    1. Re:. . . (redux) DUH by mooingyak · · Score: 1

      And some people cannot be programmers, some cannot hammer a nail, and some cannot wear their wife's clothings in public. You aren't a real man until you can do all three.

      ... at once.

      --
      William of Ockham had no beard. The most likely explanation is that it was chewed off by squirrels every morning.
  9. well no d'uh by Anonymous Coward · · Score: 0

    If this is a surprise to anyen writing code, you need to bone up on QA and failure modes.

  10. Sherlock's theorem by epine · · Score: 0

    Many security bugs are really failures to implement correctly a requirement of the form "No matter what the input to this program is, it must not do X."

    This is a special case of Sherlock's theorem:

    Once you have eliminated the disallowed, whatever remains, however unintuitive, must be the robust.

    It's far easier to debug a sin of omission than a sin of commission. If a piece of code never performs a disallowed function (e.g. leaking memory, failing to sanitize user input) then all failures that remain are sins of omission: the program doesn't actually transfer the file requested, out of excessive restraint on some edge case the programmer never even considered.

    Well, the programmer needs to get in there and consider the omission in the harsh light of day. Then the specification document needs to be updated.

    And questions need to be asked about the user environment when an edge case is tripped three years into a heavy use cycle.

    The only way to achieve software up-front with no failure modes and no functional omissions is to massively gold-plate the validation process, and this rarely works anyway.

    I'm never happier writing code than when I'm subtracting stupid.

  11. Look at commit time stamp. by 140Mandak262Jamuna · · Score: 5, Insightful
    Talking from personal experience, all the bugs I ever committed to production were coded in between 1 PM and 2 PM, my sleepiest time, when my stomach digesting the lunch was competing with the brain for blood supply.

    If I am a columnist with some modest name recognition I could have converted this mildly amusing (to me at least) observation into a column. But alas, I am not one. So he gets to repeat the age old advice given by old Prof Mahabala, teaching Intro to Computing 201, (Fortran programming, in IBM 365/155 using punch cards no less ) back in 1980 into a column, and all I get to do is to bitch about it.

    --
    sed -e 's/Chuck Norris/Rajnikant/g' joke > fact
    1. Re:Look at commit time stamp. by Anonymous Coward · · Score: 0

      Try a better lunch then. Something without bread, pasta, or cakey desserts.

    2. Re:Look at commit time stamp. by Anonymous Coward · · Score: 0

      Because that will magically not require digestion anymore.

    3. Re:Look at commit time stamp. by Anonymous Coward · · Score: 0

      Other than what the OP guessed at, you have no evidence that digestion is the problem.

    4. Re:Look at commit time stamp. by Anonymous Coward · · Score: 0

      The company can always fix bugs later, I only have one life to live and I'm not skipping cakey desserts for lunch. I'm not skipping this either

    5. Re:Look at commit time stamp. by jones_supa · · Score: 1

      Something without bread, pasta, or cakey desserts.

      Bread and pasta are good for maintaining a stable blood sugar, and the brain likes a stable blood sugar.

    6. Re:Look at commit time stamp. by Anonymous Coward · · Score: 0

      Bread and pasta are good for maintaining a stable blood sugar

      Umm... no. Ask any diabetic. Both bread and pasta are great for spiking your blood sugar high, followed by a crash a short time later as those "fast" carbs run out. Protein and, to some extent, fat are good for slowing down digestion and maintaining a stable blood sugar over more hours.

    7. Re:Look at commit time stamp. by Anonymous Coward · · Score: 0

      How are bread and pasta good at maintaining stable blood sugar? They are quickly digested and are broken down almost directly into sugar. Veggies, fruit, and meat all take longer to digest so you slowly extract their nutrients leading to more consistent and stable levels. Fat takes awhile to be converted into sugar (fat that you eat isn't simply added as body fat, it is converted first to sugar than back to fat if you have enough sugar in your blood stream).

  12. Well Duh by MichaelSmith · · Score: 1

    we can sometimes predict circumstances in which it is particularly likely to fail. 'For example, any time a program decides to use one or two (or more) algorithms depending on

    If you have an MVC architecture with 10000 models, controllers and views; all of your domain data is stored as Object in maps, keyed with strings. If the keys for your middleware and your maps are built up on the fly and type casts are used at the point where your domain data is actually used, then you are probably going to have problems.

    Oh and here's another good one: you have a module blah with an internal namespace com.company.blah but now you want a newblah so you copy blah and change two classes but leave the namespace the same then you get a bright idea: lets delete all the unchanged stuff from newblah and stick it into the classpath ahead of blah. The new module now inherits from the old one, right? Thats a brilliant idea, worthy of a genius. Oh yeah the classpath we customised isn't actually used to run the software, only to develop and test it.

  13. Evolution by Anonymous Coward · · Score: 1

    Has Dr. Dobbs discovered Software Engineering? They are only a few decades late.

  14. You see this giant middle finger from QA by Anonymous Coward · · Score: 0

    The next time you excuse a bug as a corner case will be your last.

  15. No bugs are random - computers are deterministic by Anonymous Coward · · Score: 0

    If computers can't make truly random numbers, then they can not make truly random bugs. This means that all bugs are deterministic. No bugs are actually random.

  16. Re:No bugs are random - computers are deterministi by msobkow · · Score: 2

    Apparently you've never dealt with race conditions and multi-threaded code.

    --
    I do not fail; I succeed at finding out what does not work.
  17. Not the answer, different Q by MonsterMasher · · Score: 1

    In theory shouldn't any state change be checked for this interpolate continuity.
    Do the sliding weight algo.. overlap N points in X, do both and adjust output as weighted ratio, mathematical discontinuity gone, all derivatives (within resolution of N) will be continuous. I've applied this and a simple 2 node neural-net device to make yes/no reply smooth (in respect to input.)
    I've often wondered if this fuzzy logic device had a name.

    The answer is Yes, of course those bugs must be hunted down and crushed into pulp and the trail backtracked and the colony attacked.
    I agree! No Christmas bonus for Joe the janitor! that will teach 'em for making that error.

  18. It's good to test the corner cases by Black+Parrot · · Score: 3, Informative

    News at 11.

    --
    Sheesh, evil *and* a jerk. -- Jade
    1. Re:It's good to test the corner cases by Anonymous Coward · · Score: 0

      You're going to make me wait until 11? Could someone post the spoiler and tell me if I should be testing the lazy susan I've got in the corner as well? I'm not sure if it's considered a corner case or just another cabinet.

    2. Re:It's good to test the corner cases by plopez · · Score: 1

      Poster meant "3"

      --
      putting the 'B' in LGBTQ+
  19. Are today's computer programmers devoid of the abi by Anonymous Coward · · Score: 0

    I had an interview a few years ago for a systems administrator position and knowledge of C was a requirement. I had programmed in C mostly as a hobby for several years prior but not during the most recent five years. The interviewer kept asking increasingly questions in hopes of tripping me. The interviewer eventually said I knew more about C than everyone of the people on his staff of highly experienced C programmers. I was even asked specifically about what test cases I would use given a certain short algorithm. It was bizarre how easy those test cases were to me but they astounded the interviewer.

  20. 'No' bugs are random by Timmy+D+Programmer · · Score: 1

    Short of hardware issues, no software bug is truly random, 'it just happens sometimes' = 'I lack the skill to troubleshoot this'

    --


    (If at first you don't succeed, do it different next time!)
    1. Re:'No' bugs are random by Shinobi · · Score: 1

      Apparently you've never used Perl.....

    2. Re:'No' bugs are random by dbIII · · Score: 1

      The closest I've seen the that was the early "AutoLISP" interpreter in AutoCAD, but it was really just selectively sensitive to whitespace so looked random. Removing a line and retyping it would magically be the difference between running or not. Doing anything with a lot of lines of code (eg. polyline to milling machine G-Code converter) was very frustrating.

    3. Re:'No' bugs are random by Shinobi · · Score: 1

      For me, what made me swear off Perl was back when I was doing backend work for web development in 1998....

      I had been struggling with some fairly extensive code I had put together. But I decided to tag along with the coworkers/bosses for a few beers. Intoxicated as I was, I decided that "hell, I need to go fix that code" and went back to the office... And I understood the code better while intoxicated...

      The day after I loudly proclaimed that that would be the last Perl project I'd ever work with....

    4. Re:'No' bugs are random by dbIII · · Score: 1

      I get what you mean - I had a "WTF does this regular expression mean and who was the idiot who wrote it without comments moment".
      Then I saw my name on it.
      You can do astonishing things to text in a single line of Perl but then may have to write six lines of comments to give a clue as to what the hell is going on :)

      Behaviour defined arbitrarily by whitespace (and not in a python way) is far worse since there is nothing to read to work out what is going on.

  21. Re:No bugs are random - computers are deterministi by Anonymous Coward · · Score: 0

    Those aren't random, either; they just appear to be random.

  22. Re:No bugs are random - computers are deterministi by InsectOverlord · · Score: 1

    Good point, though it doesn't actually refute GP. Computers are deterministic*. On the other hand, programs, functions, etc may not be deterministic.

    * Except devices specifically designed not to be deterministic, such as hardware random number generators that rely on quantum, electron phenomena, etc. Then again I'm not sure it is correct to call such devices computers.

  23. Re:No bugs are random - computers are deterministi by msobkow · · Score: 1

    Let's see you force one to happen in the debugger, then.

    --
    I do not fail; I succeed at finding out what does not work.
  24. Look at the comments by tomhath · · Score: 2

    A study by the company I worked for a few years ago only found one thing that correlated with the number of bugs - the number of comments. It wasn't so much that the algorithm was complicated and needed explanation; more often it was just bad programmers tossing in a bunch of commented out print statements and comments that didn't accurately describe what the code was doing.

  25. Who might know about this? by Anonymous+Brave+Guy · · Score: 4, Interesting

    That depends. If you're are a die-hard TDD fan, for example, then you'll be writing your (unit) tests before you necessarily know where any such boundaries are. Moreover, there is nothing inherent in that process to bring you back to add more tests later if boundaries arise or move during refactoring. It's not hard to imagine that a developer who leaves academia and moves straight into an industrial TDD shop might never have been exposed to competing ideas.

    (I am not a die-hard TDD fan, and the practical usefulness of white box testing is one of the reasons for that, but I suspect many of us have met the kind of person I'm describing above.)

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    1. Re:Who might know about this? by Anonymous Coward · · Score: 0

      If you're are a die-hard TDD fan, for example, then you'll be writing your (unit) tests before you necessarily know where any such boundaries are.

      What? You shouldn't be writing units tests until you know what your units are what what bounds they have. Test Driven Development, not Test Driven Design. Tests should very rarely change. In an unpractical setup, Tests should be made by the designers and the programmers should just be fleshing out the code.

      You should not be doing almost any programming until the design is done. The one thing drilled into us in school was that making changes to design, after programming has started, is expensive. System Analysis and Design was a required course. There was a 3 day stretch where our teacher covered many different project failures and repeated many times about how important design is and how it should almost never change once programming starts. If it changes, you've failed to acquire the needed information from the client.

      He also covered how the client doesn't know what they need, they only know what they want. It is the system architect to make sure the customer gets what they need. If it doesn't help the customer, YOU'VE FAILED. Ask good questions, understand their business inside and out, figure out what their real issue is.

    2. Re:Who might know about this? by Anonymous+Brave+Guy · · Score: 2

      FWIW, what you're describing seems more practical to me. However, if you start from a position that "You should not be doing almost any programming until the design is done" then you're already a long way from how many TDDers practise and from the process that many who advocate TDD, including big name consultants and authors, describe.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    3. Re:Who might know about this? by gl4ss · · Score: 2

      you can't write the tests before knowing what the program is supposed to do first and for that you need to know the bounds it needs to adhere to...

      or well, you can write them, but then you're doing them to just fill a tickbox and to input hours into timetracking. which is fucking useless. still happens a lot though, because someone on the management chain is a tdd fan but is also an agile fan. furthermore, tests for the ui could be testing against boundary values xb while the back end was developed against unit tests with values ya - which is really what the blurb of the article is about anyways, you could have 100% unit tests for all the pieces of the code with the problem being that since nobody knew the real values at the time of development they could be different..

      --
      world was created 5 seconds before this post as it is.
    4. Re:Who might know about this? by Anonymous+Brave+Guy · · Score: 1

      you can't write the tests before knowing what the program is supposed to do first and for that you need to know the bounds it needs to adhere to...

      I read the context, as given in the summary and TFA, as switching between different algorithms at certain bounds, not necessarily limited to only accepting input at all if it's within certain bounds. In other words, the bounds and algorithm switching could be implementation details, not necessarily exposed in the relevant interface.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    5. Re:Who might know about this? by Anonymous Coward · · Score: 0

      then you're already a long way from how many TDDers practise

      They're not "TDDers", they're "Agilers", and even then, taken to an extreme. All of the books and blogs of big name developers that I've seen talk of Agile more of a way to flesh out code to pass TDD tests, not as a way to design architecture.

      Many people who claim to use TDD, Agile, SCRUM, whatever, are just using buzzwords but not actually doing what they claim they're doing. Kind of like the people who rave about "the cloud" as being great for everyone instead of people who just want to reduce capital investments or to handle peak load. Some people think Agile gives them a license to not plan.

    6. Re:Who might know about this? by Anonymous+Brave+Guy · · Score: 1

      I don't think you can credibly claim a big name consultant like Robert C. Martin is not a TDDer, but when you watch interviews like this it seems pretty clear that he would object to your claim. See also the infamous Sudoku contrast between Ron Jeffries' TDD attempts and Peter Norvig's version, assorted comments by Kent Beck ("It's an analysis technique, a design technique, really a technique for structuring all the activities of development."), etc.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  26. Back in my day... by mjs0 · · Score: 1

    Is there really anyone to whom this is not obvious?

    When I started work, almost 30 years ago, in the Functional Verification team at IBM this was day one training.
    "Test around the limits" (or bounds testing as it was known) was practically beaten into you.

  27. QA needs to be testing coders are poor QA / tester by Joe_Dragon · · Score: 1

    QA needs to be testing coders are poor QA / testers and we need real live testers not some scripted system that can be coded to pass but still not be right and or well it passes but if any one looks at the out put they will say that does not look right.

  28. Re:No bugs are random - computers are deterministi by TechyImmigrant · · Score: 2

    Not if the different threads are clocked from different PLLs.

    --
    I should use this sig to advertise my book ISBN-13 : 978-1501515132.
  29. what a juvenile story. by Anonymous Coward · · Score: 0

    if you are in 8th grade i give you a pass. but i suspect you suck.

  30. All software needs to be tested by Anonymous Coward · · Score: 0

    even the simplest of algorithms. No human has ever written 100% correct code 100% of the time.

    1. Re:All software needs to be tested by phantomfive · · Score: 1

      No human has ever written 100% correct code 100% of the time.

      Once I found a human, taught him to write a single hello world program, which he did correctly, then I forbade him from ever programming again, ever, on pain of death.

      Ha! I just proved an anonymous coward wrong. I feel so accomplished.

      --
      "First they came for the slanderers and i said nothing."
    2. Re:All software needs to be tested by narcc · · Score: 1

      Wait a minute. I know that guy! I hired him because 100% of the time, the code he had written was 100% correct.

      Let's just say that you should have killed him.

  31. Re:QA needs to be testing coders are poor QA / tes by Anonymous Coward · · Score: 0

    And QA doesn't usually understand what the designers intent is, so leaving it all to QA is a bad idea.

  32. Re:No bugs are random - computers are deterministi by Anonymous Coward · · Score: 0

    It is not random. If you have enough knowledge and the ability to comprehend that knowledge, you can predict what will happen. Nothing is random.

  33. What a useless research by Anonymous Coward · · Score: 0

    That's like a kindergarten level lesson on debugging.

  34. no bugs are random by wbr1 · · Score: 1

    In my mind all bugs arise from an unexpected set of conditions and/or poor coding. They may be unanticipated but that does not make them random.

    --
    Silence is a state of mime.
    1. Re:no bugs are random by russotto · · Score: 1

      Some bugs arise from such a complicated set of conditions that they appear to be random. These are the most interesting bugs, and the most infuriating.

      Other bugs can even be truly random; a race condition that depends on whether one thread gets scheduled on a processor that's running just slightly faster (or slower) than another, for instance.

  35. Computer theory by mynamestolen · · Score: 1

    A program is an alogrithm or group of algorithms.

    So surely we're talking about "correctness" of algorithms?

    Isn't the best textboom on this by Dr Jeffrey Kingston, Algorithms and Data Structures: Design, Correctness, Analysis ??
    http://www.goodreads.com/book/show/2682170-algorithms-and-data-structures

    Have to agree with the above comments, but hey, slashdot is not what it used to be (they let me on for example).

    I have to declare a possible conflcit of interest too; I know Kingston.

    --
    work in progress
    1. Re:Computer theory by phantomfive · · Score: 1

      Due to your suggestion, I am buying that book. Not sure if it's the best one, but I'm buying it. Thanks.

      --
      "First they came for the slanderers and i said nothing."
  36. Re:No bugs are random - computers are deterministi by PCM2 · · Score: 2

    It is not random. If you have enough knowledge and the ability to comprehend that knowledge, you can predict what will happen. Nothing is random.

    Sure, as long as you start a program and let it run all by itself without touching anything. As soon as you introduce human input, the system may still be deterministic, but the output of the program is in effect random because the behavior of the operator cannot be predicted. The kind of "knowledge and the ability to comprehend that knowledge" that you describe is known as omniscience, and most IDEs currently don't support it.

    --
    Breakfast served all day!
  37. Re:No bugs are random - computers are deterministi by msobkow · · Score: 1

    Oh.

    Excuse me.

    "Stochastically Variable".

    :P :P :P

    --
    I do not fail; I succeed at finding out what does not work.
  38. Coding 101 .. by Anonymous Coward · · Score: 0

    "any time a program decides to use one or two (or more) algorithms depending on an aspect of its input such as size, we should verify that it works properly as close as possible to the decision boundary on both sides"

    If you haven't figured this out already, then you shouldn't be writing code ...

  39. Re:QA needs to be testing coders are poor QA / tes by ChunderDownunder · · Score: 1

    There's a scope for both and shared knowledge can be beneficial.

    Part of the automated build process can be running QA scripts via a robot. e.g. QA person files a bug report with steps to reproduce the issue. A VNC script is attached to the bug report, which is then translated to, say, a junit script. Programmer inserts asserts in the junit code to verify expected conditions. In this way regressions are fewer and don't escape to the QA people in the first place.

  40. Re:QA needs to be testing coders are poor QA / tes by plopez · · Score: 2

    QA ignorance is not a bad thing. QA should not be working from designers POV but from a requirement/user story POV. If it does not satisfy the requirements or the user story, it is a bad design. Period. The less QA knows of the design the better.

    --
    putting the 'B' in LGBTQ+
  41. How is any bug random? by HalAtWork · · Score: 1

    Besides when it's caused by interference from background radiation?

    1. Re:How is any bug random? by mynamestolen · · Score: 1

      random is a silly concept too. It often means we don't know the reasons, so we call it random.

      --
      work in progress
    2. Re:How is any bug random? by hibiki_r · · Score: 1

      Don't look at the bugs individually, but at the distribution of bugs in the application. Bugs do not have an equal chance of appearing anywhere in a codebase, so their distribution is not random. There is much you can learn about the quality of your system and your development process depending on where the bugs are found, and this knowledge is actionable. Maybe your team needs to take unit tests more seriously. Maybe your developers have no idea of what are realistic scenarios. Maybe you are building on a technology that is just misused for the task at hand.

      Either way, you should be making educated guesses on where the bugs will be, and then measure where the bugs are actually found, both during development an in production.

  42. Adjectives and adverbs by Anonymous Coward · · Score: 0

    "that it works properly as close as possible"

    The proper word is "closely".

    When all words are equal there is no longer any communication. Unfortunately that day seems imminent.

  43. Worst headline of 2013? by khb · · Score: 2

    Bugs are never RANDOM. Bugs are, by definition, an error (human blunder ... incorrect design, improper code, etc.)

    1. Re:Worst headline of 2013? by Anonymous Coward · · Score: 0

      Not one single bug in computer software was ever random. computers work in finite algorithms. In my work in software testing, I know that there is never really behavior that is truly intermittent, every behavior is a result of inputs. Those may be unexpected values, or temperature fluctuations, or sunspots, but they are an experience in causality.

      The article referenced is a rudimentary and academic discussion of white box testing. If you have never heard of testing software as informed by your analysis of the code, it would be a passable primer on the subject.

      Seriously, not even random() is random. Who put this shit on News for Nerds??

  44. Re:No bugs are random - computers are deterministi by MikeBabcock · · Score: 1

    When exactly will that bit be flipped by the stray subatomic particle hitting your PC from the sun?

    Some bugs really are random.

    --
    - Michael T. Babcock (Yes, I blog)
  45. not to a developer, programmer, or comp scientist by raymorris · · Score: 1

    > The word "random" also includes the definition of "odd, unusual, or unexpected."

    In everyday conversation, people may say "random" when they mean "unexpected". Hopefully they wouldn't WRITE that in a published article, but they may say it in informal conversation.

    A computer programmer who passed Programming 201 will distinguish between random, unexpected, and arbitrary in informal conversation, because in our world those words have COMPLETELY different meanings. Among programmers, saying "random" when you mean "unexpected" would be like saying "pizza" when you mean "broom" - they are completely different concepts altogether, and both are important concepts. Witness the recent articles about the NSA messing with random generators - random is an important thing to us.

    For a programmer writing for other programmers to conflate the two in a published article is sloppy, very sloppy.

  46. I'm afraid of yet another test framework by raymorris · · Score: 1

    > Sadly, I still see developers not testing, and are practically afraid of writing test scripts.

    I'm a little bit afraid of some tests I've been asked to write, and I've been programming professionally since 1997. My credits include WordPress, Apache, testing the Linux kernel raid, and other well known software.

    I fear it because tests for this project involve learning at least one and probably two new unit testing frameworks which each try to approach testing in an innovative new way. One has tests that look like English prose, not like code.

    Also, I have to rewrite other people's code to make it testable, then try to get those changes, and all of the tests, through an arduous review process. This looks like it's going to be a giant PITA. Both of these problems could have been easily avoided.

    If testing were integrated with the language, we wouldn't have a different test framework (or two) for every project. If you know the language, you know how to test it, if the two are integrated. Were it integrated, I also wouldn't need to rewrite the existing code in order to make it testable - any valid and reasonable code would be testable, or nearly so.

  47. presumes that anything by db10 · · Score: 0

    is random.

  48. no shit. by Anonymous Coward · · Score: 0

    no shit.

    1. Re:no shit. by Anonymous Coward · · Score: 0

      But... no shit no shit no shit!

  49. Bugs Never Random by Common+Joe · · Score: 1

    No, a select few are random. One of my coworkers from a decade ago randomly copied portions of if-then statements trying to get them to work. "This branch works so I'll copy it, paste it, and fiddle with the conditions until something else happens." Never mind those two branches required completely different decisions. Looking at one part of his program, a third of his if-then branches could never be run because they would always evaluate to false. I pointed that out to him and he couldn't offer a shred of logic behind what he was doing. After I got home, I bleached my brain with a stiff drink and then I hoped I'd never see code so bad again.

    Ahh... the good old days of being fresh from college. I've since seen much worse code since, but at least it wasn't as random as this guy's methodology.

  50. race bug is not random, output is undetermined by raymorris · · Score: 1

    > Other bugs can even be truly random; a race condition that depends on whether one thread gets scheduled on a processor

    The bug exists before the processor is even purchased.
    The bug is not random, though the output may be influenced by a random event. The output isn't even random - I debugged one of those in the kernel and the result was spinlock. The only random part is WHEN the problem becomes visible to the user.

    That reminds me of a Heisenbug we had once. Completely off topic, but we once had a bug which would never manifest with debug tools running . You could try it a million times and it would be fine so long as IE's debug console was open. With the debugging tools closed, it would crash most of the time. Guess what the cause was.

    Someone had left a call to console.debug in the code, which causes IE to stop execution if there is no object named "console".

  51. Pex by Anonymous Coward · · Score: 1

    Pex does half of the testing for you: http://research.microsoft.com/en-us/projects/Pex/

  52. Re:not to a developer, programmer, or comp scienti by DarkOx · · Score: 2

    Even in the computer science sense the article is using random correctly. It's arguing bugs from programming errors are NOT randomly distributed through the code base but cluster around code that does certain implementation tasks.

    There article is IMHO vapid, but does use it's vocabulary correctly.

    --
    Repeal the 17th Amendment TODAY! Also Please Read http://www.gnu.org/philosophy/right-to-read.html
  53. No by Anonymous Coward · · Score: 1

    the seemingly random bug is in fact deterministic and only triggered under certain unintentionally well-defined conditions. Hence all software bugs are deterministic.

    1. Re:No by Lord+Crc · · Score: 1

      the seemingly random bug is in fact deterministic and only triggered under certain unintentionally well-defined conditions.

      The faulty code is of course fully deterministic. The resulting output may be completely arbitrary.

  54. Re:No bugs are random - computers are deterministi by msobkow · · Score: 1

    Computers are not deterministic. Interrupts are raised at any time by interface hardware. Users generate keystrokes and mouse events at random. Internet packets arrive at random times. Pre-emptive multi-tasking operating systems suspend and resume processes according to the load at the moment, not according to a fixed schedule of n clock cycles.

    If you want to go back to something like a TRS-80 where you were programming the hardware, not an OS, then yes, they approached deterministic, but with random user inputs, they have never been truly predictable.

    You people are using some perverse definitions of "deterministic" if you think otherwise.

    --
    I do not fail; I succeed at finding out what does not work.
  55. Re:No bugs are random - computers are deterministi by dkf · · Score: 1

    Computers are deterministic.

    That's an over-simplification due to the widespread prevalence of multi-core CPUs and operating systems with preemptive (i.e., clock-driven and environment-driven) multitasking and interrupts. These things make even things that are clearly computers be non-deterministic. That "computers are deterministic" is merely a useful model of the world, not reality.

    --
    "Little does he know, but there is no 'I' in 'Idiot'!"
  56. -1 for the poster and for the editor that approved by Anonymous Coward · · Score: 0

    This is not news.

    https://en.wikipedia.org/wiki/Edge_case

    Amateurs

  57. This is why monkeys can do it better... by WileyC · · Score: 1

    As others have pointed out, this ain't rocket science. I was a tester (and programmer) for years and the number of programmers I encountered that a) refused to do range checking properly or b) failed to use well-tested libraries were legion. I really thought that hooking electrical 'reminders' to them every time they did something like this would have improved their code dramatically.

    --

    /// Not a super-genius . . . yet. ///

  58. Re:No bugs are random - computers are deterministi by PeterGeorgeStewart · · Score: 1

    Isn't a machine's "mistake" as much a deterministic output as its "functionality"?

  59. Re:QA needs to be testing coders are poor QA / tes by Hognoxious · · Score: 1

    Who passed that load of unpunctuated garbage?

    --
    Confucius say, "Find worm in apple - bad. Find half a worm - worse."
  60. Re:QA needs to be testing coders are poor QA / tes by Anonymous Coward · · Score: 0

    QA ignorance is not a bad thing. QA should not be working from designers POV but from a requirement/user story POV. If it does not satisfy the requirements or the user story, it is a bad design. Period. The less QA knows of the design the better.

    ALL testing should be done from a requirements point of view. All. Even boundary tests. If one doesn't fail, the test still only makes sense if it shows that a certain requirement is fulfilled under the conditions.

    I've seen far too many test-cases going green on a behavior that doesn't make any sense whatsoever. Waste of money for zero gain. "Don't know how it should behave" better produces a nice crash that is easily noticed, and resolved properly.

  61. Random Bugs by MisterToad · · Score: 1

    I am surprised Dr. Dobbs would publish this. Maybe they are trying to politely/indirectly send a message to the ObamaCare software folks. The requirements for testing and re-factoring will never go away. But since it was invented by people over 55 it can't be useful in "modern" programming!

    --
    Dick
  62. Re:No bugs are random - computers are deterministi by Tyler+Durden · · Score: 1

    Yeah no. Not sure if this applies to software testing (although some cases can be so unpredictable that you might as well refer to them as random), but the results of some quantum events are indeed random. Even with perfect knowledge of all variables from some moment in the past, some future events are impossible to predict. There are no hidden variables.

    --
    Happy people make bad consumers.
  63. Randomness and information by John+Allsup · · Score: 1

    True random data has maximal information content (or close to that at least).  Meaningful software does not.  It may be incomprehesible, but it is not random in nature, and there will always be many points of view from which it is far from random.  Find one of these, and you have a toehold into how it works.

    --
    John_Chalisque