Slashdot Mirror


Properly Testing Your Code?

lowlytester asks: "I work for an organization that does testing at various stages from unit testing (not XP style) to various kinds of integration tests. With all this one would expect that defect in code would be close to zero. Yet the number of defects reported is so large that I wonder how much testing is too much? What is the best way to get the biggest bang for your testing buck?" Sometimes it's not the what, it's the how, and in situations like this, I wonder if the testing procedure itself may be part of the problem. When testing code, what procedures work best for you, and do you feel that excessive testing hurts the development process at all?

470 comments

  1. Never can you test too much by The+J+Kid · · Score: 0, Redundant

    In MO you can never test too much...although it is advisable to actually run user enviroment test in addition to debug test.

    --
    Moderation: +4. Modded 70% Funny and 30% Overrated. 100% Saturated.
    1. Re:Never can you test too much by Fruit · · Score: 1

      It happens often that software is tested only under lab conditions, the user environment often has strange quirks that weren't anticipated.

      IHBT?

  2. the best way to test code... by Anonymous Coward · · Score: 4, Insightful

    ... is to not make the mistake in the first place. This may sound kind of stupid, but it's true. Don't skip on sleep - so you may stay properly awake, don't run yourself on Coca/Pitr Cola, eat good food, go for walks, and you'll find yourself making far fewer mistakes and producing better quality stuff. And _double_check_ everything.

    1. Re:the best way to test code... by rattler14 · · Score: 1

      just like a friend of mine always says.

      The best way to have your program compile the first time is to stop putting bugs in them

      That seems to have been my problem all along...

      --
      my last sig was too controversial... now, a new and improved useless sig!
    2. Re:the best way to test code... by eam · · Score: 5, Insightful

      I agree. The whole concept is flawed. Ultimately the problem with too many bugs is not a "testing" problem, but a "design" and "implementation" problem.

      The flaw in the thinking is the assumption that all bugs are inevitable. You accept as given the idea that the bugs have to be found and corrected. It actually is possible to avoid introducing the bugs in the first place.

      The sad thing is, it is likely true in every case that *avoiding* the bugs is cheaper than *correcting* the bugs. Yet we keep introducing bugs & assuming they will be found & corrected later.

    3. Re:the best way to test code... by sql*kitten · · Score: 5, Insightful

      ... is to not make the mistake in the first place. This may sound kind of stupid, but it's true. Don't skip on sleep - so you may stay properly awake, don't run yourself on Coca/Pitr Cola, eat good food, go for walks, and you'll find yourself making far fewer mistakes and producing better quality stuff.

      The question is what type of mistake. Is your program crashing a lot? Then see the above poster. Is your program generating the wrong results? Then the problem is that you have not specified rigorously enough. With good engineering specs, the actual code is just data entry.

    4. Re:the best way to test code... by Anonymous Coward · · Score: 0

      I prefer the following:

      Good programmers don't have bugs, they have compiler errors.

    5. Re:the best way to test code... by Anonymous Coward · · Score: 0

      Yes.

      To get the bugs put in one hour of programming while half asleep, you need ten hours of debugging while wide awake.

    6. Re:the best way to test code... by Hater's+Leaving,+The · · Score: 5, Interesting

      Better than double checking everything is to have an external eye code review everything. It's probably a 10% overhead when it comes to the coding side, but a >50% decrease in the debugging side. Well worth it.

      I'm currently on sabbatical, but I consult 1 day a fortnight for a couple of small local companies who can't afford me full time - all I do there is code review, and they are of the opinion that I more than double the effectiveness of their less experienced programmers.

      THL.

      --
      Keeping /. cynic density high since the fscking Kwhores/trolls arrived.
    7. Re:the best way to test code... by ranulf · · Score: 1
      To get the bugs put in one hour of programming while half asleep, you need ten hours of debugging while wide awake.

      Kind of, but not always. I remember before I went to Uni, I used to write Amiga stuff in assembler. It was truly amazing looking at some of the stuff I'd written whilst drunk that worked perfectly, and yet when sober I sure as hell couldn't figure out what it was doing. Equally, there was code that skirted around the obvious immplementation so much that it had me laughing at myself for days.

      I kind of miss those care-free days...

    8. Re:the best way to test code... by Anonymous Coward · · Score: 0

      This may be far fetched but I was thinking that with the new eda tools or any other super computer tool you can make a database of exploits for software and just hammer away at the software. Maybe even have some kind of super smart software that could change the exploited code to secure code. Doesn't sound to hard to do to me. Of course again I don't own a super computer to test the ideal, hehe. Though if I had enough money I would buy one of these bad boys and hire me a viva programmer and lease the machine for software testing!}

    9. Re:the best way to test code... by Anonymous Coward · · Score: 0

      I can tell you`ve been working in the CS industry for a long time. ALL code will have bugs - the problem is `how best to find/fix them`. You`ll never be able to write bug free code - even if you never drink coke and walk 10 miles a day.

    10. Re:the best way to test code... by Anonymous Coward · · Score: 3, Insightful

      You both miss the point. If the compiler picks up on it (or Lint), then its hardly a bug. A bug is something which passes testing and simulation, and plonks your $10 Billion space craft in the middle of the Atlantic Ocean.

    11. Re:the best way to test code... by Xentax · · Score: 5, Informative

      I agree -- our own company suffers from giving less effort on code reviews than most of us know we should. People try to save time by under-planning for code reviews, but that saved time is always lost at least twofold in uncaught bugs, extra time for optimization, and so on -- all things that would be identified in a solid code review.

      Identify the people in your company that have the best "critical eye" for each language you develop in -- and see to it that they get the time they need to really critique code, either during implementation or at least before starting integration testing (preferably before unit testing, actually). It may be hard to convince management the first time around, but if you account your hours precisely enough, the results WILL speak for themselves, in terms of hours spent overall and on testing/integration.

      Xentax

      --
      You shouldn't verb words.
    12. Re:the best way to test code... by freshdot · · Score: 1

      but, if you bellong to a team developing a product, and you must take your product scheduling and also test the code... what do you think about using some Rational enterprise tools? I've attended a product overview of some tools which can help on that. Did you know ratinal has a dumb user "emulator" which can test your app during the nigth, report the errors even telling you how to replicate application crash's... those are some cute tools :)

    13. Re:the best way to test code... by protonman · · Score: 3, Funny

      No that's gravity.

      --
      The man of knowledge must be able not only to love his enemies but also to hate his friends.
    14. Re:the best way to test code... by Anonymous Coward · · Score: 0

      The difficulty of fixing the bug is (in general) proportianl to the size of time gap between writing the code and discovering the bug.

      If I find a bug in a line of code as begin to start the next line then the fix should be easy, the exact purpose of the problem line is still fresh in my mind, as is the relevant variables.

      Ask me to fix the bug a week after I wrote the code and I will have to rebuild the mental map of all the objects involved, the purpose of the code ...

      Ask a different developer to fix some of my code (because I have left the company) and things get even more difficult.

      So whatever testing process used, ensure code is tested/reviewed as early as possibly.

    15. Re:the best way to test code... by lrichardson · · Score: 5, Interesting
      "The best way to have your program compile the first time is to stop putting bugs in them"
      Heh! Unfortunately, most of the 'problems' I deal with turn up later ... as in, whether an add/modify or new, the business side suddenly starts screaming "That's not right!"

      The appropriate quote is "It's just what we asked for, but not what we want!"

      I don't think this kind of 'bug' can ever be removed. Despite an understanding of the 'business' side of things, my experience has been that the overwhelming majority of specs suck ... whether it's incomplete definitions, contradictions, or questions about what order various rules things should be in. Coding errors should be few and far between. To have them occur generally means that the writing went too fast ... although, to be fair, given the "I want those changes yesterday!!!" attitude of the modern business world, this situation seems to occur with more frequency now than it did a decade back.

    16. Re:the best way to test code... by Anonymous Coward · · Score: 0

      Better yet, use Pair Programming. Two heads are better than one, and in fact are better than two. 15% increase in time over one developer, but bugs are reduced to between 15% less and 90% less (depending who you talk to, and the kind of bugs). Good at the time, but we all know about the long-term cost benefits.

      And who knows, some of the code monkeys might even develop some social skills.

    17. Re:the best way to test code... by Anonymous Coward · · Score: 1, Interesting

      Great idea, so long as there is someone who can competently review your code around. I do a great deal of scientific programming (some if pretty nasty stuff) and quite often bringing someone up to speed to do better checking than a compiler would require teaching them about the level of MS in physics/math and or CS. I've found few people who sit the fence with enough expertise in enough of the fields I draw from the be really useful.

      But, given that most coding "ain't rocket science" your suggestion is cogent and applicable in many cases.

    18. Re:the best way to test code... by jstott · · Score: 1
      Better than double checking everything is to have an external eye code review everything.

      I might add that in addition to the obvious benefits (many eyes, etc.), I know my writing certainly improves when someone else is going to have to read my work. No one wants to be embaressed in front of others, and the threat [promise?] of an external review makes it worth spending the extra few minutes to make it right instead of just "close enough".

      -JS

      --
      Vanity of vanities, all is vanity...
    19. Re:the best way to test code... by wheany · · Score: 1

      Equally, there was code that skirted around the obvious immplementation so much that it had me laughing at myself for days.

      Like the time that I had a buffer that had space for x samples. My samplerate was y seconds. How long would it take for the buffer to overflow?

      When I figured it out, I was embarassed as hell. That is the most simple kind of problem you could ever have. Serves me right for coding while tired...

    20. Re:the best way to test code... by Anonymous Coward · · Score: 0
      Heh! Unfortunately, most of the 'problems' I deal with turn up later ... as in, whether an add/modify or new, the business side suddenly starts screaming "That's not right!"

      The appropriate quote is "It's just what we asked for, but not what we want!"

      I am a software tester, and this is so true in today's companies. They don't want a quality product, they just want a product that "appears" to work correctly. Whether it does or not matters not. What matters is whether the clients and investors buy it, and decide you really are smart - to quote the Simpson's: "I am smart, s-m-r-t!"

      Here's a clue for how much testing is too much: No amount! I could test all day long on the same issue and those moronic customers would still break something. The key for big business is to actually listen to the folks like me that are actually saying: "STOP! This is a bad 'feature' and it's going to break and cause lots of problems in the long run!" I'm thinking back to an incident we just had that caused one of our clients to get totally pissed off at us (and it was one of those multi-million dollar partnership type clients too). And it was all because the one major flaw that I (that's right, me, I, myself) found and told everyone would be a major problem if released into the wild world of Production was indeed released, because everyone thought, "Oh, the users will NEVER do that. Why would they want to?" Excuse me mister/miss "Project Manager", but people like you thinking things like that are the reason why crackers love to prey on MS Windows. "Me run a buffer over-running script thinking it's some high-quality Anna Kournikova naked pic from my friend? That's unpossible!"

      Oh well, I guess my vindication in no one listening to me was seeing the exact error bite them in the ass - HARD! And to think, it didn't even take a year to happen like I said it would; just a measly 3 months. Hahahahahaha!!!

    21. Re:the best way to test code... by Anonymous Coward · · Score: 0

      You must not write code for Windows. (I can only assume that other OS's have similar problems.) The actual OS code differs from the documentation in many places (or the documentation is just vague enough) that there will often be bugs that creep up out of nowhere.

      (posting anonymously because this sounds like a troll, but it's true)

    22. Re:the best way to test code... by ckaminski · · Score: 1

      I'll agree to that... my favorite was the InternetCanonicalizeUrl function that only did 4096 bytes at a time...

      Bit me in the ass when I didn't test thoroughly enough... I thought 4000 bytes would be enough for the customer...

      Nowhere was this limit documented (NT 4.0 SP4 days). ;-) Gotta love it.

    23. Re:the best way to test code... by Anonymous Coward · · Score: 0

      Rational? *shudder*

    24. Re:the best way to test code... by gabec · · Score: 1

      or rams it into a plateau on Mars... ;)

    25. Re:the best way to test code... by AJWM · · Score: 3, Insightful

      the overwhelming majority of specs suck

      That is, assuming you have a spec at all beyond some vague handwaving and perhaps some marketing viewgraphs (er, power point presentations).

      Specifications almost invariably need to go through a step that I refer to as "debugging the spec" -- looking for internal inconsistencies and contradictions, vagueness, ambiguity, etc. Of course many projects aren't given the time to do that -- meaning that additional time is wasted on the back end fixing all the design and code problems that lack of a good spec caused.

      The projects I've been involved with that went fastest and smoothest all started with a good spec that had gone through several iterations of "debugging" and review with the end users. In one case that "spec" was the Nth draft of the user manual -- we "prototyped" the thing on a whiteboard in front of a small group who would be the first users. (Of course you need a pretty experienced designer/developer involved so as not to commit to something that can't be implemented in the available time.)

      Of course you need to make sure that the business side signs off on the spec so that they can't later say that it wasn't what they asked for. (It may not be what they meant, but that's their problem -- although it is the analyst/designers responsibility to double check if that's what they really meant if there seems to be an obvious problem.)

      And a good spec means that the test cases can be written in parallel with the actual code.

      --
      -- Alastair
    26. Re:the best way to test code... by Ungrounded+Lightning · · Score: 3, Interesting
      the best way to test code is to not make the mistake in the first place.

      But the way to make solid code is to get each bug out as soon as you put it in.

      Over my thirty-five years of professional programming I developed a coding/testing method that produces extremely solid code - to the point that one of my collegues once commented that [Rod] is the only person he'd trust to program his pacemaker. B-) It goes like this:

      Design ahead of coding.

      Of course! If you haven't spent more time designing than you eventually spend coding, you likely haven't yet understood the problem well enough.

      This doesn't mean you have to understad every nitty-gritty detail before you write your first line of code - you'll discover things and change your design as you go. But you should know where you're goiong. And as you go, map the road ahead of you.

      Not coding until you understand where you're going is VERY scary to administrators. But it gets you to your destination MUCH sooner than striking out randomly.

      Get the modularity right.

      Think of the final solution as a knotted mass of spaghetti threaded through meatballs inside an opaque plastic bag. Squeeze it around until you find a thin place, where few strands (representing flows of information) connect the halves of the solution on each side of the bag. Cut the bag in half here and label the strands: You've defined a module boundary and interface. Repeat with each of the two smaller bags until the remaining pile of bags each represent an understandable amount of code - about a page - or a single irreducable lump of heavily-interconnected code (one "meatball"). Then tear them open one-by-one and write the corresponding code.

      Debug as you go:

      This is the key!

      Program top-down like a tree walk, stubbing out the stuff below where you're working. As you write the code, also write one or more pieces of corresponding test-code that produces output that is a signature of the operation of every bit of the code you write, and an expected-output file that is hand-generated (or computer-generated by a different tool, preferably written by someone else, or at least in a different language and style if you're alone).

      Use a system tool (like diff or cmp) to compare the results (in preference to writing programs to "check" it, so you don't have to worry whether the test is passing beacuse the code is right or the test is broken.)

      Run the test(s) every time you make a change or add code. Make a single change at a time between test runs, get it working and tested before you move on. (This is easy for procedural modules and subroutines. For instance: You can build the running of the test into your makefile, and fail the make if the test fails. GUI stuff is tougher, and I didn't have to deal with it myself. But tools are now available to perform similarly there.)

      The result is that your bugs will generally be confined to the changes you just made, drastically limiting your search space and shortening your debugging time.

      Do COVERAGE testing, and TRACK it.

      Don't move on until you have exercised every bit of code where you were working. "Exercise" means your tests have been updated to execute every line or component of a line, driving it to its edge and corner cases and extracting a signature that shows they're doing their job correctly.

      Automated coverage tools are an inadequate kludge to try to do this after the fact. Unfortunately, they pass code once all the branches have been executed, but have no idea whether they did the right thing. They may test that you hit the edge conditions - but can they tell if the edge is off-by-one? Human intelligent, with its knowlege of intended function, is required.

      I developed a style of marking listings to document coverage, which is why I use hardcopy even in this day of glass terminals.
      - a vertical bar beside a line that is completely working. Cross-mark across its top (T) at the first of a set of working lines, across the bottom of the last of a set.
      - an "h"-shaped mark beside one that represents a partially-tested branching construct (if, for, do, "}", ...} with a cross across the right if the branch case is untested, across the left if the through case is untested. Switch to vertical bar when fully tested (including hitting the edge from both sides if applicable)
      - For compounds (i.e. "for( ; ; ) {" or " ? : " underline the portions fully tested, put an "h" with crossbar through those partially tested.
      - Declarations "pass" when you've checked that the type is right for the job and at least one hunk of client code uses them.
      - Comments "pass" pretty much automatically when you think they're right.
      - A place where code is not yet present, or where the code above and below is tested but the flow across the gap is not, gets a break in the vertical line, with crossbars, as if there were an untested blank line "in the cracks". (But there should be a comment in there mentioning it. I start such comments with "MORE", so I can find any that are left with an editor. Similarly a MORE comment marks where I've stopped coding for now.)

      When the code is done-and-coverage-tested there's a vertical slash beside all of it. (Sometimes you have to add test code temporarily to make something visible externally, but #ifdef or comment it out rather than removing it when you're done.)

      The result is like growing a perfect crystal, with flaws only in the growing surface. When you've tested a part you're usually DONE. You never have to return to it unless you misunderstood its function and have to change it later, or if the spec changes.

      DOCUMENT!

      Co-evolve a document as the project develops if there's more than one on it, or if it has to be handed off to others later. If you're alone, you can get away with heavy comments.

      Put in the comments even if you have the document.

      Keep the comments up to date.

      Comment heavily even if it's just you and always will be. When you come back to the code (especially if you're following this methodology and only get back to it MUCH later) you'll have forgotten what you were thinking. So put it all down to "reload your mental cache" when you get back to it.

      The document should be a complete expression of the intended operation of the code - but in a very different and human-understandable form. (Especially not just pseudo-code for the same thing, or "i = i+1; add one to i". Use pseudo-code only for an ilustration, not an explanation.) Remember: Testing can NEVER tell if it's RIGHT. It can only tell if two different descriptions match. "Self-documenting code" is an untestable myth - all that can be tested is whether the compiler worked correctly.

      There's more but I have to go now. I'll try to continue later. The above contains the bulk of the key stuff.

      --
      Bantam Dominique roosters crow a four-note song. Once you've heard it as "Happy BIRTHday" you can't NOT hear it that way
    27. Re:the best way to test code... by Anonymous Coward · · Score: 0

      you rawk! good business and good work to ya.

    28. Re:the best way to test code... by Creepy · · Score: 1

      In a perfect world, a developer will know everything that other developers are putting into the code, but that is rarely the case, unless you're the only developer.

      My company has the case where a huge product works on several OSes, and the developers are told to program and test on only one of those OSes and let Q/A handle the rest. Usually the OS the code is programmed on has a lot less problems than other OSes, but even then, I see a lot of bugs, especially when we mix and match different machines (lots of networking code). The code goes through a lot before it gets to Q/A - formal design documents, several code reviews, unit testing, integration testing, then finally a handoff to Q/A and still there are bugs (Q/A writes a testing plan and test cases, so this is XP-like, but it was done long before that term existed). I'm not saying that it is impossible to write bug free code, it's just that the larger the product and the more variables thrown in, the less likely the code to be bug free. There also is the arguement of "how much is too much" testing, where your costs outweigh your returns.

      Then there's configurations - I recently found a bug with two identically patched and OSed Solaris machines that had slightly different hardware. One Solaris box worked with our software, the other didn't and was only fixed by a patch to our software. To find problems such as this, some companies have turned to public betas (not mine, though, as we don't even use the concept of Alpha/Beta software), where they give away a portion or all of the software to key (or all) customers, who get an early look at the software in exchange for testing it for bugs. The problem is, early adopters never know what they're getting. Some public betas I've used were very polished pieces of software, where others were unstable garbage that should be considered pre-alpha, if anything. One garbage beta I used is now very stable and robust and is actually what my company uses (automation software), so you shouldn't make all your judgements of a piece of software on a beta itself.

    29. Re:the best way to test code... by smithmc · · Score: 2, Insightful

      That's insulting to programmers everywhere. The business requirements state why the software is needed. The specification addresses what the software will do. That still leaves the question of how the software will be implemented so as to meet the specification. In any non-trivial programming language, there are many, many ways to write a piece of code that will perform a given function. Even with excellent, detailed specs, there's still a lot of thought that goes into how to write a good program. To say "it's just data entry" implies to me that you've never actually done programming on a project of any significant magnitude.

      --
      Downmodding is the refuge of the weak. Don't downmod, make a better argument!
    30. Re:the best way to test code... by tshak · · Score: 2

      Very good post. This is very typical of American culture though. Look at our health care. I just posted a rant a week ago about how we spend several orders of magnatude more on trying to cure preventable diseases (AIDS, many cancers, etc.), then trying to research how we can prevent them in the first place. Obviously we need cures, just like we need software testing, but that should be the absolute LAST line of defence. The company I work for is too small to have a QA or a Software Test Engineer, so we essentially "are not allowed to code bugs" :-). This attitude has contributed to applications that have very few bugs, albeit we generally code Intranet apps so we don't have to worry about multiple platforms, OS versions, etc.

      --

      There is no longer anything that can be done with computers that is nontrivial and clearly legal. -- Paul Phillips
    31. Re:the best way to test code... by GodInHell · · Score: 1

      The sad thing is, it is likely true in every case that *avoiding* the bugs is cheaper than *correcting* the bugs. Yet we keep introducing bugs & assuming they will be found & corrected later.

      Can I live in your world?
      No really!? A world where bugs can be caught, all the time, every time, because you don't put them in. Nice theory. Too bad there's no such thing as a spell checker built into most compilers. Just simple, as you type, error notification would be cute.

      Anyway, I work in QA, the QA process starts in the design stage, where we look for issues in the design that will be prone to errors, and try to find alternate means, and carries right through running antivirus software on the disc when it goes gold.

      Not all bugs are code, many 'bugs' are exactly what the designer intended... but the users hate it.

      Some of these things can be seen, and good testing helps find them. But methodology is the key to testing, choosing a structured method of testing, and sticking with it... always.

      -GiH

    32. Re:the best way to test code... by RealisticWeb.com · · Score: 1

      Yet we keep introducing bugs & assuming they will be found & corrected later.

      So your doing it on purpose? Do you work for Microsoft?

      --
      Sigs are out of style, so I'm not going to use one...oh wait..
    33. Re:the best way to test code... by eam · · Score: 1

      > So your doing it on purpose?
      ^^^^

      "you're" not "your".

      Sorry, I couldn't help pointing it out in this case.

      But you made the point for me. Put the thinking *before* the typing and the bugs should be *greatly* reduced. True, I did exaggerate. You won't avoid all bugs, but I still say that you'll spend a lot more finding & correcting bugs than you will if you invested more in the planning. Particularly if you factor in the bugs you *won't* find.

      If you are still finding tons of bugs after you did all your planning & design, you may not have done enough planning & design. Perhaps the problem is not carefully sticking with the design or not having a good process for changing the design when the changes are unavoidable.

    34. Re:the best way to test code... by soft_guy · · Score: 2, Insightful

      What you are describing is a lack of good Program Management. A good Program Manager can head off these problems and prevent you from ever coding something that isn't what the customer wants. Such a person invariably has to have excellent communication skills and a technical (i.e. programming and maybe QA) background. They also should understand business and have a strong fear of Murphy's Law.

      Such a person is not a magic bullet, but can eliminate 90% of your problem, decrease your time to market, and shield developers from the insane headaches described.

      --
      Avoid Missing Ball for High Score
    35. Re:the best way to test code... by eam · · Score: 2

      Unfortunately, I live in the same world you live in. I'd like to live in a world where the effort went into avoiding the bugs rather than finding them after the fact, but I am also faced with unreasonable demands that force inferior code out the door.

      > Too bad there's no such thing as a spell
      > checker built into most compilers. Just simple,
      > as you type, error notification would be cute.

      Even that is too late. By the time you start typing, every line of the program should already be set in stone. Every line of code should have been evaluated and approved long before it was typed. It doesn't require a "perfect world". It could happen in this one (& does in rare cases). However, you have to believe that it is possible, and then you have to choose to do it.

      > Not all bugs are code, many 'bugs' are exactly
      > what the designer intended... but the users
      > hate it.

      Again, this is a failure in the planning & design. Why would the designers plan & code something that the users don't want (or won't use, or can't use, etc.). This is one of the bigger problems I've seen. People design applications without finding out what the users want it to do. Example:

      Radiology image viewing workstation. Vender designs the application to display the images with a wide black border around the image. Radiologists don't want to waste the screen. They want to display the image as large as they can, with as much detail as the hardware can display. However, it does look prettier with the border ;-)

    36. Re:the best way to test code... by Gonarat · · Score: 1

      Great idea. It is easy to read what you think you wrote instead of what you actually wrote -- especially if one codes in more than one language (think c versus COBOL).


      A good example is

      if ( cowboy_neal = survey_answer )
      {
      ...

      instead of
      if ( cowboy_neal == survey_answer )
      {
      ...


      A second set of eyes would catch that right away...


      --
      Beware of Sleestak
    37. Re:the best way to test code... by Anonymous Coward · · Score: 0

      Hire Me to test it!

    38. Re:the best way to test code... by Pfhreakaz0id · · Score: 2

      Hmmm, I've been programming for 5 years and I just want to know ... what are these "spec" and "test cases" you speak of?

    39. Re:the best way to test code... by anonymous_wombat · · Score: 1

      Using modern software development techniques, you can design high quality code that is modular and much easier to test. You can't test quality in; it has to be designed in from the start. With the proper design work, and design and code reviews, the testers job is much much easier. Without that upfront effort, it is almost impossible to produce a decent product with any amount of testing.

    40. Re:the best way to test code... by dkixk · · Score: 1
      The question is what type of mistake. Is your program crashing a lot? Then see the above poster. Is your program generating the wrong results? Then the problem is that you have not specified rigorously enough. With good engineering specs, the actual code is just data entry.
      Reading the above comment made me remember the following from the introduction to ANSI Common Lisp by Paul Graham, as I am currently flipping through the book.
      In the old model, bugs are never supposed to happen. Thorough specifications, painstakingly worked out in advance, are supposed to ensure that programs work perfectly. Sounds good in theory. Unfortunately, the specifications are both written and implemented by humans. The result, in practice, is that the plan-and-implement method does not work very well.

      As manager of the OS/360 project, Rederick Brooks was well acquainted with the traditional approach. He was also acquainted with its results:

      Any OS/360 user is quickly aware of how much better it should be... Furthermore, the product was late, it took more memory than planned, the costs were several times the estimate, and it did not perform very well until several releases after the first.
      And this is a description of one of the most successful systems of its era.

      The problem with the old model was that it ignored human limitations. In the old model, you are betting that specifications won't contain serious flaws, and that implementing them will be a simple matter of translating them into code. Experience has shown this to be a very bad bet indeed. It would be safer to bet that specifications will be misguided, and that code will be full of bugs.

    41. Re:the best way to test code... by dkixk · · Score: 1
      Sounds good in theory. Unfortunately, the specifications are both written and implemented by humans. The result, in practice, is that the plan-and-implement method does not work very well.

      As manager of the OS/360 project, Rederick Brooks [...]

      <grumble> Case in point being that Frederick Brooks was the manager of the OS/360 project, a project with which Rederick Brooks had no involvement.
    42. Re:the best way to test code... by GodInHell · · Score: 1

      Even that is too late. By the time you start typing, every line of the program should already be set in stone. Every line of code should have been evaluated and approved long before it was typed. It doesn't require a "perfect world". It could happen in this one (& does in rare cases). However, you have to believe that it is possible, and then you have to choose to do it.

      I think the worst sources of error are the third and fourth generation patches to fix the errors created by the send and third generation patches. When it begins to reach the point where the currect coder can only take on faith that the function of object being edited still lives up to spec... which I suppose is your whole point.

      Again, this is a failure in the planning & design. Why would the designers plan & code something that the users don't want (or won't use, or can't use, etc.). This is one of the bigger problems I've seen. People design applications without finding out what the users want it to do.

      That's not so black and white as it should be, at the most basic level, people don't know what they really want until after the product is delievered. Something sounds like a great feature, and all the users like it on paper, and then they play with the prototype and demand it be removed.


      -GiH

    43. Re:the best way to test code... by plumby · · Score: 2

      An even better approach, if you can convince the management that it does actually use less resource in the long run, is pair programming. I am an experienced developer, who likes to believe that I develop software in the 'right' way, but until I'd worked on a pair-programming project I never realised how often I manage to convince myself to take a shortcut rather than do things properly. With someone beside you asking "why are you doing that?", you can't duck out and take the shortcut, and when you're sick of their nagging, you get the pleasure of swapping over and badgering them to do it properly.

      It's also amazingly useful to have someone keeping an eye on the big picture of what you're trying to achieve that day while you worry about the minutiae of your language syntax. The system that we developed may have taken slightly more overall man-power than if it had been developed without pair programming, but it's a complex multithreaded system integrating with a badly documented 3rd party system, and has been running 24x7 for the last 6 months with not a single minute spent on bug fixes or support caused by errors in the system. The non pair-programmed systems either side of it (including the 3rd party app) have frequent failures and regularly suck up resource for support and maintenance.

    44. Re:the best way to test code... by Anonymous Coward · · Score: 0

      Your reply is extremely insightful. If your Program Manager is reading this, give this person a raise!

    45. Re:the best way to test code... by Anonymous Coward · · Score: 0

      the best way to test code...is to not make the mistake in the first place.

      to err is human.

    46. Re:the best way to test code... by Anonymous Coward · · Score: 0

      he was protesting against unfairness and injustice. yes, let's ignore him, that's just stupid.

    47. Re:the best way to test code... by eam · · Score: 1

      > That's not so black and white as it should be,
      > at the most basic level, people don't know what
      > they really want until after the product is
      > delievered. Something sounds like a great
      > feature, and all the users like it on paper,
      > and then they play with the prototype and
      > demand it be removed.

      While that is true, I think calling that a bug really stretches the definition of bug. Not that the users in question would admit it, but it is really a specification change.

      In a situation where a contract has been signed based on a well defined specification, not only would the users have to pay the agreed on cost of developing the feature, they'd also have to pay the cost to have it removed...as they should.

    48. Re:the best way to test code... by Anonymous Coward · · Score: 0

      i wasn't aware that there was a computer science industry. you sure about that one?

    49. Re:the best way to test code... by DunbarTheInept · · Score: 2

      By the time you start typing, every line of the program should already be set in stone.


      Why waste everyone's time reviewing source code that doesn't even compile without syntax errors yet? FIRST you type it in, THEN clean up the obvious things you can find right away, like syntax errors, THEN take that cleaner version to your first code review. There's a reason they call them text *editors*, you know - it's because after you write one first draft, you can *edit* the file later if you like. It's a rather nice concept.

      --

      Don't label something "offtopic" unless you know the topic well enough to tell what's on topic.

    50. Re:the best way to test code... by DunbarTheInept · · Score: 2

      The purpose of a lot of these software engineering techniques is to make the design of the *algorithm* independant from the typing of the code. The goal is to make someone with more experience write out the design in a rather pseudocode fashion and then someone else can convert that to actual compiling code. In theory this means the experienced developers lead the newbies through the process, with the experienced ones doing the design, and the newbies doing the muckwork typing. That actually makes a lot of sense in theory, but in practice, it didn't seem the work that way at the job I first got out of college (where this approach was used). The deep, deep problem with this approach is that the psuedocode has to be phrased in such a way that everyone involved in the meeting can understand it, and that means no high-falutin' computer science terminology or any o' that techie stuff. So your design has to be at the level a PHB can handle, and since the coders aren't allowed to get too creative with their implentation of the design, the actual code ends up being just as simple-minded as the design. Thus time and time again we ended up with slow wasteful brute-force approaches to problems, not because the coders and designers didn't know any better, but because that's all that was expressable at the high-level meetings where the design was being hammered out.

      Then the problem got worse after several years of that situation ended up making people believe that design work doesn't require a programming background, and then we started having designs made by people who only have a cursory understanding of programming (and by deisgns here, I'm talking about stuff that dictates the algorithm that must be used, not just high-level 'what does it look like' interface design.)

      Another big problem is that after spending a year or two doing the "design but don't code" job, even someone who once knew what he was doing starts getting rusty and making dumb algorithmic decisions.

      I don't know what the solution is, but it certainly doesn't involve putting a programmer into a position where he never programs again in his lifetime before he can affect the design.

      --

      Don't label something "offtopic" unless you know the topic well enough to tell what's on topic.

    51. Re:the best way to test code... by RFC959 · · Score: 2

      I agree in part. But the critical word in your statement is "good" program management. That's the tough part. In my experience with IT projects (not necessarily programming), either the project manager is "one of the techies" or he isn't. If he is, he usually takes the techies' side and demands proper specs, testing, etc., and then the rest of the business whines to upper management that he's being a "bottleneck", and then he gets replaced. If he isn't a techie, he usually fails to understand why the techies are always griping about the lack of meaningful specs, time pressure, etc, and he exists only to help the business side push harder. Finding someone who crosses between the two sides (which you do mention) is damn tough, and such a person is worth a lot.

    52. Re:the best way to test code... by DunbarTheInept · · Score: 2

      I used to know someone who always wrote his c-code equals conditionals such that if one operand was an lvalue and one was an rvalue, he'd put the rvalue on the left, where it isn't allowed for assignment statements, like so: if( 0 == myFileSize )
      { // TO-DO: print some error and die
      }
      Instead of the more human-readable: if( myFileSize == 0 )
      ,,,etc,,,

      The theory was, if he screwed up and put in a '=', instead of a '==', then the compiler would catch it for him that way. An interesting idea, but I figure if you expend the mental effort to remember to type it in backward, you are already thinking about the difference between '=' and '==', and so at that point you aren't likely to make that mistake anyway.

      --

      Don't label something "offtopic" unless you know the topic well enough to tell what's on topic.

    53. Re:the best way to test code... by Thatman311 · · Score: 1

      How can you say that your products have very few bugs when you said you don't have a QA or Test Engineer(s)?

      --
      Silly Rabbit...Sig's are for kids.
    54. Re:the best way to test code... by ras · · Score: 1

      No one has replied to this yet, so I thought I would. Over the 20 or so years I have programmed I have developed a methodology that is eerily similar to yours. At the risk of repeating what you have just said, here is how I do it:

      1. Break the problem down into modules (aka classes, interfaces, or whatever your favourite silver bullet is). I don't know of any systematic way to do this, certainly none that guarantee a good outcome. If you have solved similar problems before then your design will almost certainly work well. If not - well to quote other branches of engineering - "plan to throw the first one away - you will anyway".
      2. The next step is to design the modules. This step consists of writing the documentation another programmer would read to figure out how to use your new module. The quality of what you write should be on a par with other documentation you think is good. For example, if you find the Java library documentation easy to navigate and understand, then make it look like that.


        By the way, in case it is not obvious, you are not documenting how the module works internally here, you are documenting its published interfaces and how to use them. I firmly believe the code should take responsibility for the internal module design.


      3. Next, start writing the code. If you have done the previous jobs properly your should be able to hand your module documentation to a team of programmers and have then work on different modules without trampling on each others toes. If programmer X needs to talk to a module from programmer Y he knows what the interface will look like, so he adds some dummy routines that allow him to check what is going on, and moves on.


        Notice we have stopped writing pure documentation and started writing code. But the documentation effort has not finished. The module programmer should be documenting any non obvious decisions he has made with comments.


        There is one other aspect to coding the module - it should be done defensively. The attitude should be that the program won't fail in my module, and just as importantly it won't appear to fail in my module. The latter could happen if other programmers pass the wrong thing, or don't follow the rules and do things in the wrong order. When that occurs it should be obvious that is was their mistake and not yours. The usual method is to have your code littered with assert()'s or their equivalent checking for the more subtle errors that might occur. You don't have to check for more blatant errors - like being passed a NULL pointer for instance, because it will be obvious that is what happened and thus is not your fault.


      4. The next step is unit testing. Unit testing involves writing a test harness which turns your module into a stand alone program. It supplies dummy routines for all the external modules used. Usually the dummies just print out some trace to the test log. And yes, if you are going to be sure you have tested your code throughly then you must do coverage analysis, and yes, by far then best way I have found is the dead tree method. Print out a listing of your code, run a highlighter down the left hand side when you consider a line has been tested under all conditions. When you have a solid line down the length of your listing you are done. This method works a lot better than it should. I think that is because it forces you read your code again with your testers hat on, and for some reason when I do that I generally think up a lot of devious test cases - usually along the lines of "gee, I did not have that case in mind when I wrote the code, I wonder if it works?".


        The unit testing code becomes a permanent part of your modules code - it is not removed when testing is over. I place the trace log in there as well. That way it is easy for someone else to re-run the test and compare the output. If you are lucky and have something like C's pre-processor then you can #ifdef it, otherwise you have to manually comment it out.


      5. The next step is to verify all the modules hang together the way they are supposed to. This boils down to running the program and testing it all works. Of course someone will of written the user doco by now, so you can test it against that. But as we know pigs don't fly, so you won't have user doco yet. Ergo you will have to test it against the design you did in step 1. The design from step 1 will be hopelessly out of date of course, so you may as well start writing the user doco.


        The dead tree method still applies, but this time to you use the module reference documentation. You print out your module reference doco, and put a line down the left hand side of the page when the external interface next to it (constant, property, method, event, etc) when you think it has been adequately exercised. Again, when you have a continuous line down the left hand side of all your doco, you are done.


        If you are a one man band, ie if you have written the program from start to finish, then this step can be combined with the previous one. In effect the finished program becomes its own test harness.


        Oddly enough, when I have been able to combine the final two steps, I produce the best code. Typically less than one defect per 1000 loc. This is for programs of around 15k loc (they have to be small because I do the lot!). When I can't combine the two steps it means there is a team doing the work, of course, so that may explain the difference.


      6. The final step is beta testing. If you are lucky you can give this job to a tester - someone who is good at abusing the system the way an end user might. Programmers are not good at this - usually it is someone from the industry the product is targeted at. Someone who understands the damage that will be done to their business when some part of the product does not work, and is willing to put in the work to ensure that doesn't happen. I had one of these people once. They were happy days! But very rare. The other options are roping the public into doing the job by publishing your program as a "beta test", or more commonly getting the customer to do it. If you are polite you will warn the customer that this is a "testing period", but telling them it is "finished" seems to be the accepted practice.


      It is depressing, but a lot of the work you do will be thrown away after 5 years. I get to keep and re-use the module documentation, the source code, and the unit tests. Having the module documentation up to date after long period of maintenance is unusual. It happens because I insist it is maintained as a comment in the source. The comment is sometimes 1000's of lines long. In C in would like in the .h file. At first it seems archaic having all your documentation in 12pt courier and manually formatted. But the programmers come to appreciate having the documentation regardless of what it looks like, and since it is under their noses in a format that is easy to change they take the time to keep it up to date. The same applies to the unit tests and their results.

      This leaves the initial design document, the system tests, and the beta testing as either not re-usable or is ignored and hence just withers and dies. You could re-use the system tests if you had a decent test harness that recorded and ran the tests. But in every one I have come across is not practical. It is not hard to write the first systems test. But as the system evolves the effort and expertise required to maintaining what is essentially a serial of key strokes and mouse clicks becomes overwhelming. It is less effort to maintain a set of test scripts written in English and run them manually. That is a pity, because it seems like you could save a huge amount of time if you could automate it.

      Hmmm, I doubt anybody will read this far. But it is nice to get your development process down in black and white. I have not done it in a few years, so it was time to do it again. And it is ever so good of slashdot to keep a permanent record of it!

    55. Re:the best way to test code... by Anonymous Coward · · Score: 0

      This post has the most funky moderating I've ever seen.

    56. Re:the best way to test code... by Anonymous Coward · · Score: 0

      I would like to give mine a raise. I would like to raise her three feet by the force of my foot going up her ass.

    57. Re:the best way to test code... by Anonymous Coward · · Score: 0

      You do not know shit. The problem is that bugs are out of the coders control. Bugs are either by-design, short-sightedness, or the result of a changing need.

      The only solution that I have found is covering my ass. For each project, I keep a personal diary and scrap book to show that I do my job as instructed. I have been burnt too many times by people telling me that a program does not do what it is supposed to do, yet the only thing that has changed is their expectation.

      Another thing that the diary and scrap books do is show the logic behind decisions. Where I work, "real" design documents do not show reasoning, only conclusion. This is helpfull when the next guy wants to make a change that we decided against the first time around.

    58. Re:the best way to test code... by Anonymous Coward · · Score: 0

      Geeks are a species unto themselves ;)

    59. Re:the best way to test code... by eam · · Score: 1

      You're still getting it wrong. This isn't about *reviewing* code. It is about how you develop the code in the first place. You start with loose definitions of the various components of the application, then you solidify the requirements for each component. After that you produce rough pseudo code to describe the algorithm. Then you begin to write out the actual code. Each of these steps would be reviewed and approved before you could move on. Each component would be small and simple enough to be relatively bug free, and the definitions of the requirements for the component should control the interactions with all the other components being developed.

    60. Re:the best way to test code... by tshak · · Score: 1

      Because we have a lot of people (end-users and internal staff) using our software. We have many channels for product improvement and bug reporting. We also have an extensive loging system that will report back to us if any exception is thrown and not handled properly (everything we do is Web based so we control the software side). We generally get very positive feedback about the functionality of our tools. Ironically, I just got one of the first bug reports in 9-10 months for one tool this morning :-(.

      --

      There is no longer anything that can be done with computers that is nontrivial and clearly legal. -- Paul Phillips
    61. Re:the best way to test code... by DunbarTheInept · · Score: 2

      That would have made sense if the statement was "each *algorithm* must be set in stone before you begin typing", but that's not what the post said. It said each *line of code* must be set in stone, which is saying that there must be some form of the entire verbatim program in existence somewhere before you even begin typing (which would preclude using an editor to actually edit the code rather than just type it in). Now, maybe that's not the meaning you meant to get across, but that *is* what your words said. I would have assumed that that's not really what you meant except that you later also mentioned all the peer reviews being done before you type, and that, to my mind, includes code reviews as well as design reviews.

      --

      Don't label something "offtopic" unless you know the topic well enough to tell what's on topic.

    62. Re:the best way to test code... by Anonymous Coward · · Score: 0

      from your explanation, it isn't the "techie" manager who's the problem, it's the lazy "business whiners" who are unwilling to do their job, but are politically connected enough to replace the "bottleneck."

    63. Re:the best way to test code... by Anonymous Coward · · Score: 0

      they're what the QA team writes after the product has shipped while they're waiting for the next product to be ready to test instead of actually participating in the design discussion and working with business and development to um... nevermind.

  3. Maybe it's the motivation by tweggen · · Score: 1

    May be it is the motivation that drives you while testing. While the optimal motivation IMO should be "I wanna clean up the code, find and fix potential and actual bugs", I can observe many developers (and don't wanna exclude me) which assume, that anything is corrent.

    In our minds, we should look for mistakes, simply imagine we were engeneers building bridges...

    1. Re:Maybe it's the motivation by Anonymous Coward · · Score: 0

      Another good thing to have in mind when coding and testing, is to consider the code as "not finished" until it has been tested.

    2. Re:Maybe it's the motivation by jeanluisdesjardins · · Score: 1

      In our minds, we should look for mistakes, simply imagine we were engeneers building bridges..

      We are engineers building bridges... bridges to the future... :)

      Lets try not to be that Tacoma Narrows Guy...

    3. Re:Maybe it's the motivation by tweggen · · Score: 1

      ...reminds me of the word responsibility...

      no more I just coded down the spec.

    4. Re:Maybe it's the motivation by murdocj · · Score: 1

      This is exactly right.

      The key to testing isn't the methodology or the tools you use, it's how you approach it.

      Glenford Myers summed it up in "The Art of Software Testing":

      A successful test finds bugs.

      Yep, absolutely the reverse of what most of us think. And yet, consider: if you spend all afternoon testing and "prove your program is correct", what have you accomplished? Your program is no better than when you started!

      If, however, you rip into your program, determined to hammer it and find bugs, you'll emerge with an improved product.

    5. Re:Maybe it's the motivation by Anonymous Coward · · Score: 0

      I'm about to start a testing role on a new project... I've been working as a developer on a few others, and already found some pretty major prexisiting bugs whilst testing some of my own fixes.

      I'm going in with the attitude "let's see what we can break". I don't know if it'll work out that way - maybe too many formal test cases to run and things to set up - but "random unplanned testing" seems to find quite a few things that the developers never thought of (and therefore never tried to test).

  4. The most effective way... by rattler14 · · Score: 3, Funny

    before each compile, one should make a small sacrifice to the debugging gods and ask them to forgive you for your syn(tax).

    --
    my last sig was too controversial... now, a new and improved useless sig!
    1. Re:The most effective way... by gentix · · Score: 1

      I always do that. Every time before compiling I type make, offer a lamb and cut my thumb, letting the blood drip on an altar surrounded by candles. Then I carefully press enter while murmering a latin prayer and humbly ask for forgiveness. The debugging gods usually answer instantl yby giving 121 error messages, indicating they're not satisfied with my rituals. After performing the ritual a couple of times, the debugging gods often seem pleased and let me run my code. If they're really cranky they'll let me compile without trouble the first time, but while executing the code problems arise. These cases take a lot of sacrifice...

  5. Do it mathematica-style by gTsiros · · Score: 1, Interesting

    or wolfram-style, if you prefer.

    Put your program on many computers (local to you fif possible) and have them generate random input and drive it to the program to. Or if that is not possible, betatesters, try to make your program die.

    The most certain way to weed out bugs (before others, that is...others that we don't want to find out i.e. users who bought the program, etc) is to use it a lot yourselfes beforehand.

    In my mind this will work very well...

    And no, there can never be too much testing, unless your code is like one line, which i doubt...for any full blown application, there is not "too much"

    --
    Looking for people to chat about multicopters, coding, music. skype: gtsiros
    1. Re:Do it mathematica-style by DumbSwede · · Score: 2
      Some people will now be able to guess the identity of DumbSwede, but
      I was really shocked to see the Wolfram testing method mentioned, because
      I invented it (for Wolfram at least), back in 1989. Stephen himself gave me
      credit for this type of testing numerous times, at various conferences, when I was still with the company.


      I didn't invent random testing in general, but with a mathematically based
      language like Mathematica, many operations are symmetric algebraically.
      If I generate a random algebraic expression, Integrate it, then Differentiate it,
      then it should then match (after simplification or variable substitutions) the original
      Integrand. This was the first type of random test that I designed for Wolfram, and
      man did it find slews of problems with V1.0 versions of Mathematica. Back when I worked part time
      and was an undergrad at U of I (more clues to who DumbSwede is).


      I worked developing scores of other math identity verification procedures for Wolfram
      over a 10 year period, then sadly, moved on (I use to really enjoy pounding on that code).


      Even things like word processors can be tested in this fashion. If you randomly add 10 characters, then
      delete those 10 characters, should get you the original file back.


      Operations do not always have to be symmetric, but they have to have some testable property or
      identity after a series of events.


      While this kind of testing doesn't replace other types of testing, I guarantee it takes you into
      a whole new bug-space you didn't even guess existed with your software, requiring a more mathematically
      consistent way of handling data.


      On a related note, for GUI based apps, having a way to script equivalent events is a must.
      Where I work today, we use Android to play back GUI events, but I pre-process the Android scripts,
      (that I have peppered with replaceable tags) to do things like random testing or repetitive testing over
      many inputs, rather than have a static GUI test, that can only simulate one very narrow set of events.

    2. Re:Do it mathematica-style by cant_get_a_good_nick · · Score: 1

      The Palm Emulator, POSE, has something like this. Gremlins they call it. They randomly hit your app with events and keypresses and other random stuff. Let it run for as long as you want, or infinite. You control the random seed, so it's reproducable too.

    3. Re:Do it mathematica-style by Anonymous Coward · · Score: 0

      Err... one small problem with your methodology.

      How do you verify the output of your tests?

      Testing is only good as it's weakest link, and this is exactly where most testing efforts break down. If you don't check your output very carefully, you might as well not test at all. And checking output by hand is very tedious and error-prone, and is very ineffective in my experience.

    4. Re:Do it mathematica-style by DumbSwede · · Score: 2
      If you will look two posts up in this same thread (also by myself, DumbSwede), you will see that I flesh out the verification process, as the original author of this method for Wolfram. With out automatic and reliable verification, this method only uncovers catastrophic error conditions like crashes (which can be a valuable exercise in itself). When thing go wrong, you have to be able to trace back the series of events, so you keep updating a log of every action performed.

      As explained the first time, many operations are symmetric, especially in the case of Mathematica, which is why it works so well at Wolfram. In some rare cases a symmetric operation may make and then erase a potential bug find, but it is very, very rare. Most often a bug is amplified when doing a series of symmetric operations. For a simple example, take factoring a polynomial expression, subtracting the original polynomial from the factored one and simplifying should give 0. It won't tell you that the factoring was done correctly, but it will tell the attempted factorization was not equivalent algebraically. More than this, it will tell you if your simplification algorithm was strong enough to find the two expressions equal to Zero after subtraction. One trick to this method is finding non-trivial ways to generate good mathematical examples randomly, for which I spent years coming up with a bag of tricks to do. The other trick is finding a testable pass condition. In the case of symmetric operations, the pass is that you got the original back, or Zero after a Subtraction (if you are testing something mathematical in nature). For the many Matrix operations, you test for properties that hold after a transformation, such as knowing what the determinate should be, or performing a series of events that will eventually lead to an identity matrix.

      But don't just think Math here, think any testable property that data should have after a known series of events, even if you generate those events randomly. Hint, you may have generated the events randomly, but you know what they where, and can factor that into creating additional deterministic operations, that lead to a testable property - a property that doesn't need eyeballs to test.

      A final note here. The real power of random testing is not that any one test is better than one test by a knowledgeable human - it is that it can do MILLIONS of more tests than a knowledgeable human in a given time frame. Most of the tests will pass, most combinations absurd in their utility, many will be repeated in trivial combinations, BUT if you only find one bug after 1000 tests random tests, you could still potentially find 100 to 1000 bugs a day, remember you only have to eyeball the Failures. Some days I came close to that hundred figure, with 20,000 bugs reported in my tenure at Wolfram. Bugs, you won't see in Mathematica, but most likely would have, without random testing.

      OK, A final-final note.
      We even mused about a creating a utility for customers to use that would constantly delve Mathematica for obscure hidden bugs during computer idle time, very much like SETI@HOME. The powers to be, didn't want to give the impression to customers that there would be any bugs in the product that should be looked for.

  6. First by lfourrier · · Score: 1

    Remember that testing, and test implementation is mainly a human activity, and must be tested, and corrected...

  7. Just use the Microsoft way... by cliveholloway · · Score: 3, Funny
    They use Beta testers - the have the largest group of Beta testers out there - otherwise known as their customer base :)

    boom boom

    cLive ;-)

    --
    -- Trinity in high heels carrying a whip: The donimatrix - there is no spoonerism
    1. Re:Just use the Microsoft way... by aug24 · · Score: 1

      Hey, you just described every open source project out there.

      OK, there are release candidates, but there are beta programs for MS too.

      It's a damn good way to finally test something - if not the only way. The difference is that MS charge you for the product, and if you can't shout loud enough (think non-corporate), won't be worried about providing a fix.

      --
      You're only jealous cos the little penguins are talking to me.
    2. Re:Just use the Microsoft way... by spongman · · Score: 2
      joking aside, Microsoft does use external beta testers, I believe the win95 beta program included about 500,000 testers.

      I worked on the Visual Studio team a while back and we used three main methods of formal testing during product development:

      1. manual testing. each feature team had a parallel team of testers that were responsible for testing that team's part of the product. the testers wrote manual test scripts driven both by the 'spec', requests from developers and regressions. these test scripts were used for generating the next two testing methods:
      2. 'sniff' tests. the sniff tests were a small suite of automated tests - sometimes using point-and-click automation, sometimes using internal code hooks or exposed automation (eg COM) interfaces - that were a requirement for check-in. ie before checking new code back into the source control system (microsoft's internal 'SLM', or later, SourceSafe) the developer had to run the sniff tests and ensure that they passed. they weren't particularly thorough (they had to run pretty quickly), they basically ensured that the product was usable and that other developers/testers would not be blocked by breakage. if the sniff tests did not pass, it was the responsibility of the developer to either fix his code, or grab the tester responsible for the test in question and update the test to reflect the altered functionality.
      3. BVTs (build verification tests). these were a much more thorough superset of the sniff tests that run on the build-lab's machines after the nightly build had completed. for example the compiler BVTs included iterations and combinations of self-building the compiler and libraries with the new code. the developers had little interaction with these test, unless they failed, of course.
      For me as a developer the sniff tests were the most important, I could come in in the morning, sync up, build and continue working without worrying about whether or not some guy down the hall in a completely unrelated part of the product had broken the 'file open' dialog, for example.
  8. It's easy by cca93014 · · Score: 1, Funny

    If it compiles, its fine! VB's great isn't it?

    I never did learn what segmentation fault meant at college.

    1. Re:It's easy by Anonymous Coward · · Score: 1, Funny

      on error resume next

      What errors?

    2. Re:It's easy by Anonymous Coward · · Score: 0

      You can still run into memory leak problems with VB.

  9. Testing by CoderByBirth · · Score: 2, Informative

    I think JUnit-style testing works great, and I plan to start using it more often.
    Testing is good to verify that your code does exactly what you think it does; a lot of the time I produce code that I "think" works, using JUnit allows me to verify that it actually does.
    Check out junit.org.

    For those of you who are sceptic about unit-testing, you should try it. Setting up the tests are not as tedious as one might think, they force you to think your problem through, and maybe most of all: they make your build look cool :)

    1. Re:Testing by Anonymous Coward · · Score: 0

      JUnit is designed for transactional software. We have considered using it as our management team believe that is will improve our software quality. The downside is that highly graphical software and like ours does not fit into their model. The tests that we could perform effectly using this type of test rig are minimized.

      Incedentally we also had to ditch J2EE because the transction model of processing was too constraining

    2. Re:Testing by pafcio · · Score: 1

      I find JUnit good but in my oppinion it's got one fundamental drawback. You can't parametrize the tests, meaning that you need to hardcode the parameter values of the tested methods. Test logic and test input data should be separated. or did I miss something in their docs?

    3. Re:Testing by pinch · · Score: 1

      I somewhat agree with you but moving the sample data outside of the code to be tested could introduce side affects from test to test. For instance if you have 1 test that creates a file and the another that reads it, the order that the tests are run now matters. This is bad. This is the reason the setup method exists to explicitly set up test objects before running each test. Hard-coding the building of the object to be tested in the setup method is the only way to insure that your tests are operating on the same data. If you pull data from a file, even if you've made an agreement with yourself never to change that file, things have a way of breaking. When you're knee-deep in a test of a complex method the last thing you need is your sample data changing. Sometimes it can seem like a pain to set up a multi-level object (an object that contains multiple other objects), but in the end, I find this code is useful in *real* places in my code and this code can also help me understand how my object is put together.

  10. Trying to fit in implicit restrictions by korpiq · · Score: 3, Insightful


    One wonders how your development has been organized. Everybody here should know the basics of software engineering, including but not limited to:

    1) document APIs exactly, including definitions of legal and illegal data sets

    2) separate test group from programmers

    3) separate quality assurance from both API testing and programmers.

    Well, that's the theory. I've never worked in a place where that would have been implemented. Instead, people trying to bring this in have been kicked out. In practice, maybe one should try to get a feeling of each API: how is it supposed to be used? Use each piece of software only in the implicit limits of it's programmer's idea to keep the number of bugs down. Not to mention the obvious coding style mantras.

    --

    I think, therefore thoughts exist. Ego is just an impression.
    1. Re:Trying to fit in implicit restrictions by Twylite · · Score: 5, Insightful

      This is excellent advise. In my experience, the most stable code comes from pragmatic design followed up by pragmatic coding.

      Design your system thoroughly. Identify every component, and the minimum interface required for that component. Carefully document that interface (API) - use Design By Contract (preconditions, postconditions and invariants) if possible.

      Moving targets mean that the API will almost certainly have to be extended - documentation on the design and intent of the component/API as a whole will reduce the pain of this process. The responsibility for this documentation is shared between the design and implementation phases. Pay careful attention to documenting assumptions made within the code, e.g. ownership of member/global variables.

      When it comes to coding, start with a skeleton. Put in the API function/method as defined, then check/assert every pre/post condition. Think about how any parameter could be out of range, or violate the assumptions you make. Once you are happy you're checking for all illegal use, you can go on to code the internals.

      When coding internals, remember that you cannot trust anything (with the possible exception of other code in the same component). Check/assert the return values (and in/out parameters) of all calls you make. Have a well-defined system-level design for error handling, that doesn't allow the real error (or its source, if possible) to get lost.

      As for testing, I'm all for the XP method: write your test cases first. This helps you to think about what you API is doing, how you are going to actually use it, and what you can throw at it that may break it (helping you to lock down the pre/postconditions).

      You must use regression tests! Testing is useless if its done one, but the code is modified afterwards. Have a library of test cases, and use all of them. Every time a bug is found, add a test case for that bug, and ensure it is regression tested every time.

      Code audits can detect and solve a lot of common implementation bugs. Use them to look for unchecked pointer/buffer use, assuming return values or success/failure of functions, and that asserts are correctly and accurately used.

      In my experience most bugs do NOT come from implementation errors, but from developer misunderstanding, especially late in a project or in maintenance, or even during bug fixing! A developer must fully understand the code (s)he is working on, and all the assumptions it makes. Never adjust a non-local variable without first checking all other functions that use or modify that variable, and understanding the implications. Never use a function or method without understanding all the side effects (on parameters and scope/global state). This is why all of this information should be documented, and audits performed to ensure that the documentation is accurate.

      --
      i-name =twylite [http://public.xdi.org/=twylite], see idcommons.net
    2. Re:Trying to fit in implicit restrictions by Anonymous Coward · · Score: 0

      Is it possible to write code that is easy to QA??
      One of the big problems we had was that every code
      change would break every one of our tests so that
      it would take a week to ramp the tests back up before
      meaningful QA work could take place.
      Or we had to just test what you had ad hoc.
      carpal tunnel syndrome I hear you coming.
      -
      -
      Just scream 'deferred' at every meeting.

    3. Re:Trying to fit in implicit restrictions by Grab · · Score: 3, Informative

      Re (2) and (3), having separate groups is a *really* good way to get the old "them-and-us" battle going. The testers hate the programmers bcos they see themselves as covering up for the programmers' lack of skills; the programmers hate the testers bcos the testers keep telling them that they're screwing up; and everyone hates QA for telling them how to do their job.

      The problem is that very few bugs occur at the purely code stage, and most of them are easy to trace. The real problem is design bugs - they're the killers. The solution at our company is to (a) review, (b) separate development, and (c) follow a V-model quite strictly. We have one group of engineers, where everyone writes, codes, reviews and tests, and for each section, everyone will have a different role so no-one gets stuck just being the tester.

      Someone writes a requirements spec, and also writes the system test spec by which they'll prove that the thing works as expected. Writing the test spec forces you to put numbers to your requirements, basically making you self-review the requirements for errors, and it find a lot of bugs. Someone else checks that the requirements spec makes sense, and also that the system test spec matches up with the requirements spec. And typically we spend over a quarter of our time at the requirements stage, bcos it's dead easy to edit a single line in a Word document but it's a helluva lot more difficult to change a zillion C files, test specs, etc.

      If the system is simple, we'll go straight to code. But if the system is complex, we do a detailed design (usually in Simulink and Stateflow these days, since we're coding for embedded control systems). The person who does the design MUST NOT be the same person who wrote the requirements - this effectively gives us another review of the requirements, to catch any oddities which can't be implemented. And someone will review that the design is actually meeting the requirements.

      The same person who's done the detailed design will also write a test spec to say how to test the code. This will cover all boundary conditions, so any time there's a comparison, for instance, we'd check that it gets ">=" instead of just ">". We've got an in-house tool which allows us to write test specs in Excel and run them on code automatically. And someone will review this to make sure it matches the design and covers all cases.

      Then someone writes the code. The coder MUST NOT be the designer - as with the requirements/design separation, this gives us a free review. They'll put that through Lint to check for obvious problems (we follow the MISRA coding standard, with a few exceptions where MISRA didn't get it right), and then run their code through the test spec. If it fails, they'll look for the bugs in the code. Sometimes they find bugs in the test spec; in that case the test spec gets modified. Having an automated test spec means we can run tests on code with zero overhead for repeating the tests.

      And then the code will be run against the system level tests, and hopefully everything passes. If it doesn't, the system level test has found a bug in the design, where the design isn't meeting the requirements. Rinse and repeat.

      It's worth saying that we're writing code for automotive control systems. How much testing to do is really a trade-off of the cost of testing against the cost of failure, and in our case, failure is not an option!

      Grab.

    4. Re:Trying to fit in implicit restrictions by ronlamb · · Score: 1

      I know what you mean by people trying to bring this in being kicked out. I haven't worked for a place yet where even one of the three steps have been even partially followed. This includes two academic research/work study projects.

      Even if the group you work in tries to follow the three principles you mentioned, it is often overridden by upper management some of whom are ex-developers themselves.

      More than once I have heard complaints come down the chain about too much time being devoted to testing and pressure put to reduce the time.

      Once a "pencil pusher" determined that there is no need for separate QA/test groups and most of the groups where either eliminated, reduced in size or folded into development.

      Another problem I have seen is the dislike of many business people of the "Ivory tower academic world". More than once I have heard a comment like the following, "What do they (academics) know about the real world, they don't have realistic budgets or timelines to meet," when someone mentions the established basics of software development or engineering.

      I have first hand knowledge that even in academia most of the software engineering ideas are ignored or overly bent, regardless of "unrealistic budgets." One of my work study jobs was to document a fortran mathematics library widely used throughout the academic wor, that was over at the time over 20 years old with almost no documentation, and what existed was wrong.

    5. Re:Trying to fit in implicit restrictions by Anonymous Coward · · Score: 0

      In my experience the "them-and-us" battles fade with time. Those that persist are usually individual personality conflicts (and good indicators of who to layoff...er, transfer.) It's mostly just stress. If you can get the same testers and developers to work together past the 1 release cycle mark, there will usually be better understanding, communications, etc. -- this is, if anyone is left standing.

  11. Incomplete by Anonymous Coward · · Score: 0

    Linux is incomplete and I am finally out of Linux.

    Bye.

  12. Need more data... by joto · · Score: 4, Insightful
    It's impossible to tell what's wrong in your case, since all you've said so far is akin to "we find lot's of errors, should we test less?"

    And the answer to that is of course: "No, you should test more, and fix the bugs". And of course, looking over your development model to see why you have so many errors might be a good idea (such as formalizing who can commit code, if you've got lot's of programmer at various skill-levels).

    But in real-life, many bugs are not that important, and time-to-market and development cost is more important.

    So unless you provide us with more data, such as ...

    development process, type of product, size of product, complexity of product, severity of bugs, age of most bugs found, bug-review process, testing schedule, testing process, how you manage your version control tree, whether you are on or behind schedule (and if behind, how much), how management deals with the problem, etc...

    ...I don't think anyone will be able to give any good advice either.

    1. Re:Need more data... by six+bands · · Score: 0

      The only advice I have ever found helpful is to use a testing tool that forces you to fully document all tests. This allows a third party to replicate what you have tested and find gaps in your tests.

    2. Re:Need more data... by leuk_he · · Score: 1

      lowly tester writes:...from unit testing (not XP style) to various kinds of integration tests...

      Testing should start at the design phase. If you throw a finished design at developers there will be errors in that or untestables cases , or just cases that are not defined.

      If you do some structural test you should write test plan at the desing phase.

    3. Re:Need more data... by acoustiq · · Score: 0

      Yeah, this definitely reminds me of a question on a standardized test I took once. It went something like this: "One scientist performed an experiment and published his results. Another scientist then used his writeup to do the same experiment, but got different results. Why?"

      --

      --
      I romp with joy in the bookish dark
    4. Re:Need more data... by pyrrho · · Score: 2

      I assume the poster thinks most of the bugs are not serious, and they are willing to just not see them all. I mean, if these are fatal bugs then there is no question, you need to find them.

      So I say, be happy if you have a list of thousands of bugs... just prioritize them and possibly decide which ones will be "In the Shipping Version".

      --

      -pyrrho

  13. Testing with a large customer by Warmth+Is+Life · · Score: 1

    Offer the product for free to a sizable corporation who could use it. It will not only give you bragging rights ("as used by Whateversoft") but will also give you reviews and suggestions from the best consultants of all: your future customers.

    1. Re:Testing with a large customer by fdiskne1 · · Score: 1

      This isn't bad, but please listen to the beta-testing company. We beta-test software. (Yes, we pay for it. I only wish it would be free. Don't ask...I didn't agree to it. I don't make the rules.) When one of our people called them with a problem, they stated "We've never had anyone complain about this problem." Of course our person said "I'm complaining now." The company couldn't get it through their skulls that there was indeed a problem. I guess they can't understand that someone has to be the first to complain about a new problem.

      --
      But why is the rum gone?
    2. Re:Testing with a large customer by tius · · Score: 1

      Right, not! Your system happens to be an embedded flight control system where any bug may cause a fatal event.

    3. Re:Testing with a large customer by Anonymous Coward · · Score: 0

      In general, large corporations choose to pay for "proven" software rather than debug some bush-leaguer's beta.

    4. Re:Testing with a large customer by kent_eh · · Score: 1

      We are currently on the "customer" side of one of these deals.

      Except, the supplier didn't bother to tell us that the software that we had bought was still a "development version" .
      And we didn't find out until after we had about 1200-1400 installations done in the hardware that our customers were using.

      Imagine our skecpicism when they presented us with the next version, which they claimed was new features, and incidentally over 75 bug fixes.

      --

      ---
      "I can't complain, but sometimes still do..." Joe Walsh
    5. Re:Testing with a large customer by Warmth+Is+Life · · Score: 1

      Don't be a prick. If it was a flight control system, he wouldn't have asked about "bang for the buck testing". The development budget for products like that is unlimited: as long as there are bugs, the product will not be released. At least I hope not.

  14. Code Review, Code Review, Code Review by JohnT · · Score: 5, Informative

    My experience has shown that the number one way to find defects is code reviews performed by other developers who can read the code and also understand the intended functionality. This will catch 90% of all defects before they are even released to QA.
    For more information, the developers bible (IMHO) Code Complete (available on Amazon and elsewhere) has some good information on testing strategies and some hard numbers on effectiveness of testing. Good luck.

    1. Re:Code Review, Code Review, Code Review by Anonymous Coward · · Score: 0

      It make even more intertesting if the other developer is not familar with your code as people tend to skim over things that are familiar to them.

      We used to do cross debugging session at school. Most the time I find my bugs in the process of explaining how my code works to my friends.

    2. Re:Code Review, Code Review, Code Review by Lumpish+Scholar · · Score: 5, Insightful
      My experience has shown that the number one way to find defects is code reviews performed by other developers who can read the code and also understand the intended functionality.
      Violent agreement, for the following reasons:

      Study after study has confirmed: Code reviews find more defects, per staff hour, than any other activity, including all kinds of testing.

      Aside from that, the benefits of having more than one person aware of each change to the code are significant. If George is sick, or quits, or wants to go on vacation, it's not just George who can make the next change.

      --
      Stupid job ads, weird spam, occasional insight at
    3. Re:Code Review, Code Review, Code Review by ssclift · · Score: 5, Informative

      Again, violent agreement. Why? Testing is basically just writing the code again, only in a more restricted form. You take a known input, and then program the output expected (rather than derive it another way) and then compare the two implementations.

      Inspection, on the other hand, compares the program with it written in another form: human language. Since human language is generally too vague to execute automatically, the only way to test the equivalence of the two is to inspect.

      By far the best inspection book is Software Inspection by Tom Gilb. His very generous web site contains a ton of supplementary material.

      Remember, proving two statements are the same is the halting problem, and is NP-complete (i.e. you must check all possible solutions). Testing is a measure of code against code, inspection a measure of code against requirements. Together they kill a lot of bugs because they find different discrepancies between three statements of the same problem.

    4. Re:Code Review, Code Review, Code Review by PhilHibbs · · Score: 1
      Study after study has confirmed: Code reviews find more defects, per staff hour, than any other activity,
      Got any examples, so I can present this stuff to mgmt?
    5. Re:Code Review, Code Review, Code Review by Zathrus · · Score: 3, Interesting

      We need to do a code review in my shop, since we're approaching release on our project, but there's a slight issue... there are two coders on the project (myself and the senior coder), and we're the only ones in house that know C++ very well.

      What do you do in that case? Self-reviewing the code is of questionable value -- since you tend to skim over the parts you wrote "because you know it works!".

    6. Re:Code Review, Code Review, Code Review by Kombat · · Score: 2
      I strongly disagree. It may have been true in the past, but you have to consider that languages, compilers and tools have evolved considerably since the idea of "code reviews" was first introduced.

      Designers should rely on their tools. We're a Java shop here, and we employ everything from JUnit testcases for whitebox testing to JProbe for memory leak testing. We also use JTest for lint-like output. This, combined with selective code reviews of trouble spots gives you the most bang for the buck.

      You must remember that code reviews will NOT catch the most insidious and costly mistakes, such as general architecture design flaws, race conditions, and memory leaks. You may catch a few, but peoples' eyes glaze over pretty quickly, and these are tricky bugs to catch.

      In short: USE THE TOOLS! That's what they're there for. They've come a long way. They're very good at what they do. And there's no substitute for firing the product up and just plain using it for a while.

      --
      Like woodworking? Build your own picture frames.
    7. Re:Code Review, Code Review, Code Review by Digital_Quartz · · Score: 2, Interesting

      Well, no actually.

      Requirements review and Design review find more defects per person hour than code review, especially when you consider that a single requirement defect will result in multiple design defects, and a single design defect in multiple implementation defects.

      But yes, code review is a good plan all the same.

    8. Re:Code Review, Code Review, Code Review by broody · · Score: 3, Interesting
      --
      ~~ What's stopping you?
    9. Re:Code Review, Code Review, Code Review by bluGill · · Score: 2

      Maybe, if you code reviewers are any good. Here the process won't let any code be commited until it has been code reviewed. However the following code would pass code review:
      // This function is invoked when a mistle launch is initiated to make
      // sure that two different users have both turned their key in the lock.
      // The locks status is stored at location 0x23236341 and 0x65a3e222, and
      // follow the format of the electronic lock (document number 235235)
      // It returns TRUE if both locks have been turned, otherwise false.
      bool lockCheck()
      {
      return TRUE;
      }

      The code review would flag only that missle is spelled wrong in the comments.

      So if you can get quality code reviews, more power to you, I'll agree they are worth doing. If your code reviewer isn't very good, then it is a waste of everyone's time to do them.

    10. Re:Code Review, Code Review, Code Review by PhilHibbs · · Score: 1

      Thanks! I already have a copy of "An Introduction to General Systems Thinking" by Weinberg, and I'm looking for a copy of "Quality Software Management
      Volume 1: Systems Thinking". Hey, I've just found one here! Today is a good day.

    11. Re:Code Review, Code Review, Code Review by dubl-u · · Score: 2

      there are two coders on the project (myself and the senior coder)

      Do you already review each other's code? If not, try that. Also consider trying pair programming, which gives you a continuous code/design review.

      Otherwise, consider hiring an outside contractor to do the code reviews. Or even a couple of them to give you different perspectives.

      we're approaching release on our project

      This is not the best time to start code reviews. Why? At this point you've written a bunch of code; you're also facing release pressure. The only things most people would be willing to fix at this point are clear bugs that can be fixed without changing the design. Anything else you'll likely be forced to ignore (or hack around).

      The earlier you catch a problem, the cheaper it is to solve. In your next design cycle, start code and design reviews early!

    12. Re:Code Review, Code Review, Code Review by aggressivepedestrian · · Score: 1

      I agree with the idea of code review. However, it has a problem. Lots of organizations do code reviews in a conference room from hardcopy. Sometimes there isn't even a computer available. You read the code, find a possible bug, and tell the developer to go test it and fix it.

      That might work if code were static, but software systems undergo constant change. In every organization I've ben in had code reviews, a given piece of software gets exactly one review. But it will inevitably have to change, and the changes are rarely reviewed.

      That's where team programming comes in. Say what you will about the whole of XP, but my experience with pair programming (which can be viewed as constant code review) is that it eliminates tons of bugs before you even check in your code. This is espcially true if the pairs are all working together in a big room: not only do you have your partner reviewing your code, but you can ask questions of the other teams.

    13. Re:Code Review, Code Review, Code Review by dubl-u · · Score: 2

      Designers should rely on their tools.

      I think you may be setting up a bit of false opposition here. I agree that tools are good; I use many of those same tools myself. But when you say

      [...]code reviews will NOT catch the most insidious and costly mistakes, such as general architecture design flaws[...]

      you go too far. If there's a tool out there that will catch design problems, I've never met it.

      Software development is an expression of human desires in languages meant simultaneously for human and machine interpretation. Good tools can help with the machine interpretation side, but only inspection by other humans can catch problems relating to human desires or human interpretation.

      Design walkthroughs, code reviews, and pair programming can address problems for which there are as yet no good tools.

      Deciding whether to use a code inspection or a profiler depends entirely on nature of the problem causing the poor software quality.

    14. Re:Code Review, Code Review, Code Review by mstorer3772 · · Score: 0

      'code reviews will NOT catch the most insidious and costly mistakes, such as general architecture design flaws, race conditions, and memory leaks.'

      Uhmm... NO.

      Leaks:
      I don't know about you, but I've found quite a few RESOURCE leaks in code reviews (memory, files, you name it). Besides, many memory leak detectors can only detect leaks as they happen. If the leak is in some error-handling branch, many tools will never see it.

      Race conditions:
      We don't work much with multi-threaded code, so I've never even run across a race condition in 'live' code. Can't really comment.

      Design Flaws:
      Yup. To paraphrase... "Hey, Joe Coder! That way is dumb. Do it like this instead."

      Code reviews are Very Important.

      And "Code Complete" rocks. Go read it NOW.

      Don't get me wrong... Tools are great. Any bug that can be detected automatically, should be. But that doesn't make code reviews any less valuable.

      --
      Fooz Meister
    15. Re:Code Review, Code Review, Code Review by laserjet · · Score: 2

      Isn't your comment kind of redundant? Of course if your code reviewer sucks, it will be a waste of time!

      That's like saying, "Unless you buy good beer, your beer will taste like crap."

      In either case, it pays to hire someone who is qualified. Why hire someone who will not help?e

      --
      Moon Macrosystems. Sun's biggest competitor.
    16. Re:Code Review, Code Review, Code Review by Grab · · Score: 2

      Depends. If ppl go straight to code, then the code *is* the design. So review the code for all of this.

      If they do a detailed design first, then you should be taking the next logical step of reviewing the design against the requirements. Then the code gets reviewed against the design.

      The thing is, no tool can catch the classes of bugs that are thrown up by these review steps. No tool EVER will, bcos what these steps are doing is taking a concept expressed in some customer's Word document and over a bunch of meetings and turning it into a design document and some code. Believe me, if you've found a tool that can do this, you've cracked natural languages, AI and the Turing Test in one go!

      That's not to say that tools aren't useful. If you can have a tool manually search for "if(x=0)" then that's useful, so there's a good chance that you can at least catch most of the typos that way. But no tool will ever replace a review by a human.

      Grab.

    17. Re:Code Review, Code Review, Code Review by benhoganuk · · Score: 1

      Pair Progamming XP style has given me the edge to allow more bugs to be caught.

      Test First Design is also a big win.

      Dont forget to refactor all the time. This also reduces bugs.

      Simple design! ( = less bugs)

    18. Re:Code Review, Code Review, Code Review by stardyne · · Score: 1

      Only true if you are talking about automated Code Reviews, and not (like everyone else is talking about) human Code Review.

    19. Re:Code Review, Code Review, Code Review by openman · · Score: 1

      In my experience code reviews also bring to the surface any organizationl disfunction. Examples: - Managers who refuse to allocate time for engineers to inspect the code. - Quality bean counters that want the inspection check off more than the results. - Pre-madonna engineers who believe their way is better than the rest of the code. - Sloppy coding - Personality clashes. If these underlying issues don't get resolved, any push for code inspection just blows up in your face. That said, good reviews do bring to light lots of potential bugs especially in SMP and other areas where automated checking tools are not enough.

    20. Re:Code Review, Code Review, Code Review by Anonymous Coward · · Score: 0

      LOL.... great example.

      "missile", by the way.

    21. Re:Code Review, Code Review, Code Review by bmillerward · · Score: 1

      "Code reviews find more defects, per staff hour, than any other activity, including all kinds of testing." Sure, but a project can get two tester hours for the price of one coder hour.

    22. Re:Code Review, Code Review, Code Review by angel'o'sphere · · Score: 2

      Your post has some points but your terminology is wrong!

      Remember, proving two statements are the same is the halting problem, and is NP-complete (i.e. you must check all possible solutions).

      Thats wrong.
      C:
      int a = 1;
      int b = 2;
      int sum = a + b;

      Pascal:
      a, b, sum : interger;
      a := 1;
      b := 2;
      sum := a + b;

      Different statements. Semanticaly equvivalent. You prove this by using a meta language which has a regourus semantics or in this case by looking at the assembly codde. The compiler output is in both cases the same. No halting problem involved.

      Its more complex if you use a functional language and have a = 1, b = 2, sum = (add a b).

      Now you likely have no assembly output to compare but you can define for all languages a simple pseudo code with a defined semantics and mappings form your language to the pseudocode.

      Often you transform the procedural code INTO a functional language and just evaluate it to a final expression ... if both expressions are the same the code is equivalent.


      Testing is a measure of code against code,

      No idea what you mean with that ... the test is performed WITH code but usualy you test expected output versus real output for a given set of input.

      inspection a measure of code against requirements. Thats wrong.
      Inspection is going through a check list and "inspecting" wether your code matches formal criterias which have absolutely no relation to the intend of the code.

      A typical point on a check list for an inspection is: for all if statements involving the character "=" in an expression inspect wether the character only appears once and report: Likely bug as it is an assignment!!
      Another one:
      For all if statements involving the character "=" in an expression inspect wether the left side is "const", if not report: Likely bug as it COULD be an assignment!!

      If you use C++ a typical check point on the check list could be:
      For all parameters to a member function or function check wether they are modified inside of the method body and if NOT then check if the parameter declaratin is either const, or const reference or pointer to a const object. IF NOT; report that you have fragile code as the the code will behave in its context of use totaly different if a single line inside of the function is changed and by that a parameter gets changed.

      Inspections and most other ways of code reviews are a formal way to check wether a piece of code adheres to a set of coding guidelines.

      The coding guidelines are set up to avoid typical bugs.

      Ah ... the most typical check on top of the check list: are all local variables initialized?

      This has absolutely nothing to do with the intended calculations the code should do. You never look on the requirements while making inspections. Probably you do it if you do make a walk through.

      angel'o'sphere

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    23. Re:Code Review, Code Review, Code Review by ssclift · · Score: 1

      Um, good points in the replies.

      IIRC (and I don't have a theory text handy) equivalence is decidable for finite memory machines, so therefore for practical examples. NP-completeness I thought, since the only proof would be an exhaustive search of all possible states. I could be wrong there...

      As for "measure"... I mean that in the sense that when we "test", we establish a lower bound on how "close" two programs are. If the single test fails then the distance could be said to be 1. If the test passes then the distance is bounded below by 0, but could be higher. Similarly with inspection. If the inspection fails (finds N_m major defects) then the "distance" between the two statements of functionality is bounded from below by N_m. If all measures of program equivalence are zero, then we have not proved equivalence (a very hard problem) but we have shown that the "distance" could be 0.
    24. Re:Code Review, Code Review, Code Review by broody · · Score: 1

      No worries.

      I tend to borrow Weinburg books from the library (corporate or public) myself. Now if I happen to find them at a discount book seller, watch out I am stocking up. {;

      --
      ~~ What's stopping you?
  15. Start at the beginning by yogi · · Score: 4, Interesting
    Make sure that testing starts with each developer, so that they attempt to break all of their code before it goes anywhere.

    If you look at the guys with really low bug rates, like the NASA guys running the Shuttle control software, they have very separate test and development teams, and a competitive attitude. The test team "wins" if it finds a bug, and the devlopers don't want to look silly.

    Some Extreme Programming techniques, such as paired coding may help too.

    1. Re:Start at the beginning by Anonymous Coward · · Score: 0

      Don't they also tend to use formal methods to design the programs before they even start to write any code?

      This irons out most of the problems even before the coders come along by mathamatically proving that a program will work

    2. Re:Start at the beginning by cheeto · · Score: 2, Insightful

      Yes, we use formal methods to design the programs before we start to write anything. We are an SEI Level 5 shop, but most of you guys would hate to program for us. Once the requirements are approved, the programmer has virtually no freedom. However, the programmers are intimately involved with the requirements review process. Half of us involved in producing the Shuttle Flight Software have never written a single actual line of code at the terminal.

      For instance, I was reviewing some code a few months ago that said to compute an array of three vectors. Well, we were actually only going to use the third element of each array, so the developer only stored the third elements.

      That was OK, but we also ended up documenting that in the detailed design spec, which is thousands of pages in itself.

      Most desktop apps can't afford our process and probably don't need it. Embedded software in avionics equipment probably do need this process and can't afford not to use it (I don't know if they all do).

      --
      - "Sweet merciful crap!" Homer J. Simpson
    3. Re:Start at the beginning by Malc · · Score: 1

      The people working with the shuttle don't have to worry so much about constantly hardware (e.g. PCs) and software/OSes (e.g. Win32/.NET/Mono/etc). This makes it a lot easier to avoid bugs in the first place.

  16. testing... by RogueProtoKol · · Score: 1

    ... is the most annoyin part of dev, but it needs to be done, i find gettin a bunch of people who are reliable and don't mind downloading builds in matter of minutes/hours is the best way, also make sure they are good at explaining the problem (eg not 'i clicked a button and it went wrong'), the more descriptive they are the faster you can find the problem.

    instant messaging, a decent webhost/ftp, descriptive testers are the things you need

    1. Re:testing... by AVee · · Score: 2

      ... is the most annoyin part of dev

      That's mostly true, but it gets better when you let developers test eachothers code. They will do anything to make it go wrong ;-)
      And they are very descriptive testers most of the time.

    2. Re:testing... by Anonymous Coward · · Score: 0

      Well if you're doing medium-to-large OSS development, why not try writing and supplying some test plans for the beta testers to run through? That can help reduce the risk that all of your testers are testing the same things, while ignoring something which then never gets tested.

  17. Quality is Designed In... by reptar64 · · Score: 2, Insightful

    ... NOT tested in. If the product is poorly engineered, there should be no surprise at the vast number of bugs, no matter how much testing you do. Crap is crap.

    1. Re:Quality is Designed In... by jorleif · · Score: 1

      Well, yes good design certainly helps, but if the code is rubbish the design won't get you very far. Most people would like it to be the way you described, however it is a well established fact that testing is currently a necessary part of building reliable software.

    2. Re:Quality is Designed In... by Anonymous Coward · · Score: 0

      Agreed. You can polish a turd all you want, but when you're done, it's still a turd.

  18. Software Development and Bugs. by Yousef · · Score: 1

    There are numerous issues to be considered when testing your code.
    What are you testing for?
    Who is doing the Testing?
    What kind of Error/Exception Handling is in place?
    What processes are in place to manage project?
    How have you defined "BUG"?

    Just because you have tested does not mean that your application will be bug free.
    Does your bug crash the system, or do you have correct error/exception handling in place to deal with any and all bugs?

    I'd suggest that you invest the time to develop a robust Exception handling, Logging and Debugging system.
    Flag all possible errors (Database interactions, NullPointers etc) and deal with them specifically. Decide which errors must notify the user, and which errors are for the system log. Which errors should cause the system to halt, and which can be ignored as expected or minor.
    Make your error messages meaningful. If you use Java, then try Apache log4j to handle your logging.

    The best rule to follow is:
    1. More things can go wrong with the Software System than go right.
    2. User actions are always unpredictable.
    3. Expect the unexpected/worst - then deal with it.

    --
    -- "To ask a question is to show ignorance; Not to ask a question means you'll remain ignorant."
    1. Re:Software Development and Bugs. by Jedi+Alec · · Score: 1

      What kind of Error/Exception Handling is in place?

      Obvious:10 ON ERROR GOTO 1000
      1000 RESUME NEXT
      --

      People replying to my sig annoy me. That's why I change it all the time.
  19. Wrong problem.. by psycho_tinman · · Score: 4, Insightful

    The main thing: testing does absolutely nothing to minimize the number of defects in a particular application.. There are lots of other things that are as important.. ie: are these defect reports being seen by the appropriate developers and are they being acted on, what types of procedures and communication actually exists between the developer and the QA persons (assuming that they are not the same folk)..

    The last point isn't as bizarre as it sounds, I've seen lots of places where a QA person enters bugs, but the developers silently reject them ("its not a bug, that's how the program works")

    Testing just tries to discover the presence of defects, by itself, it cannot ensure that your product works perfectly (for an application of even moderate complexity, there may be an exponential number of cases and paths to check, most test cases are written for a percentage of those only).. Because of this, if you feel that you're spending too much time testing, perhaps you need to check if your test cases are appropriate to the situation and stage of development..

    Another point is that tests can be automated to some degree or the other, perhaps a scriptable tool might assist in lowering some of the drudgery associated with actually assuring the quality of your software...

    rant mode = on...Excessive testing ONLY hurts if it takes people away from development at the early or even middle stages of a project and forces them to run tests on incomplete sections of code.. otherwise, there is NO such thing as too many things...

    1. Re:Wrong problem.. by elmer-12 · · Score: 1

      Agreed. The problem is not always the testing itself, but what you do with the test results. They should be used to discover patterns of coding/design mistakes, holes in previous testing phases. Each bug found should be a revelation affecting all aspects of the development process.

  20. Irrational users by AVee · · Score: 2

    "I wonder how much testing is too much"

    Well, it's never to much, until you've done every possible thing. Thats one of the advantages of open source development. A lot of people are working, playing, coding with the beta version wich means a lot of things get tested. In my experiance most errors show up with unexpected things, like missing error checks etc. A good point to start testing is to test agains the developer. Ask him everything, what if i do this, what if i do that. If you think crazy enough (like normal users), you will recieve a dozen of 'euh, don't know' answers. Thats where your errors are ;-) Most tests are based on what the system is supposed to do, not on what one can do. Given a few users anything can be done to the program, things you likely didn't test because you understand the program to good. Try putting your mother behind the prog ;-)

  21. Use feedback from previous test cases by alapalaya · · Score: 1

    It's very common that a set of test cases covers only a little part of the real bugs in a product.
    And it's a normal and clever wish to prepare a larger set of test cases. This can surely lead to a better bug-coverage. But this must be done wisely: all the time you receive from a release product a bug which wasn't covered by your tests, you shold look at the cases to see how they must be changed/expanded so that, if the tests are repeated that bug will be (dis)covered.
    Bottom line: use bug report (also) as a feedback to improve the way you deisgn test cases. And remeber that also the testing needs to be planned and well designed, pay to it as much attention as you give to your code. Cheers.


    (yeah, my sig is wrong, so what?)

    --
    667 The Neighbour of the Beast
  22. Testing is just part of good design/implementation by GnomeKing · · Score: 2, Insightful

    Its all in the same package...

    If you have a well thought out and well structured design... and if every single function is documented atleast mostly before coding begins... and if all of the theory of interactions fit in... then only a small amount of testing is required

    The main problems which require more testing come when corners are cut over the initial design stages, or their not done as fully as they should be doing, or when people dont actually think about what input users can give

    For one of my projects I did ages ago for college, half of the class (which was split to give the same coding ability spread in both halfs) were each asked to write this program and the other half were asked to design it, review the design, make a proper testing strategy, document and THEN start writing it

    The second half took a little longer to get their program working, but the first half had more bugs, and spent more time testing ... My bet is that the second half would spend less total time on that program and bug fixes in a real world situation (which was the whole point of the exercise)

  23. What's a "defect"? by Anonymous Coward · · Score: 1, Insightful

    Most of them have nothing to do with poor coding, they have to do with poor understanding of the original problem. Which leads to writing a solution for the wrong thing. No amount of debugging will fix a wrong assumption.

  24. For me by pkplex · · Score: 2, Interesting

    Well.. showing your work to someone important always brings up bugs, every time :)

    I suppose its just a case of using the product like an actual user who knows nothing about it would, right from the first step.

  25. Its been said before, but... by tgd · · Score: 3, Insightful

    If you really want to generate bug free code, you have to keep one rule in mind at ALL times. A bug occuring in the code is a failure in the methodology you are currently using to avoid them. Sounds very basic, but a lot of companies forget that.

    When you have a problem with bugs, you need to figure out where in the process the problem happened. Was the unit spec wrong? Documentation? Implementation? Unit testing procedures? Was it a correctable problem caused by the engineer involved?

    If you really want to be bug-free, every time one shows up you have to figure out why it happened, and change things.

    Personally, I think the biggest one is to make engineers work 9-5. Not 9-7, or 11-9. Tell them to go home at 5, even if they're in the middle of something. Software engineering is a very complex task that takes a lot of energy and concentration to do right. Just like Doctors who work long hours make mistakes (resulting, often, in people dying), engineers who work too long make mistakes too.

    Being in the "zone" is often the death of good code. You get lots of cool code written, but none of it is double-checked, none of it is verified to match spec, and it often ends up afterwards difficult to understand.

    Now don't get me wrong, I don't do any of this, and my crap is FULL of bugs, but thats what you need to do if you really want to help it. Writing buggy code is like a public works program for QA people. Who wants a hundred thousand unemployed anal-retentive QA people nitpicking something else like your car's inspection or your tax forms? Better to keep them in the software where they can't do any harm ;-)

    1. Re:Its been said before, but... by Anonymous Coward · · Score: 0

      Oi! As a software tester, I would like to point out that we are not anal retentives who "nitpick" at all!

      Your shoe laces need retying by the way.

  26. Design by Contract by Yousef · · Score: 2, Interesting

    Another good way to reduce errors is to follow the principals of Design by Contract.

    State using Assertions what is expected of the code. Pre Conditions and Post Conditions.
    If any of these fail, then throw an appropriate Exception.

    --
    -- "To ask a question is to show ignorance; Not to ask a question means you'll remain ignorant."
  27. Eat your own dogfood.... by T-Ranger · · Score: 2, Insightful
    and force feed it to others.

    Mathmatical proofs and unit testing asside make sure that your program dosent crap out when its being used or abused. So get some regular people to bang on it..

  28. Never.. by kb · · Score: 2, Insightful

    ... trust the programmers when it comes to testing. You may find some obvious buigs in your own code, but when it comes to runtime testing most programmers tend to emphasize on "correct" user behaviour or maybe the few wrong input sets they've taken care of and completely neglect the pervert fantasy of lusers *g*

    Dedicated testers OTOH are perfect in letting a program die in the most obscure ways. Did you know that you can crash a Commodore 64's BASIC interpreter by just typing PRINT 5+"A"+-5 ? ;)

    1. Re:Never.. by Anonymous Coward · · Score: 0

      My favorite line.
      What kind of a dumbass would do that????
      --
      You are spot on. It is the rare programmer that can
      put his or her ego aside and admit that once the code
      has been released out into the wild, the user on the
      street does NOT care about the programmers vision
      for what the software SHOULD do.
      -
      -
      deferred!!!!!!!!

    2. Re:Never.. by jweatherley · · Score: 1

      MS wrote the C64's BASIC - seems they never learn:

      for(;;) printf("\t\b\b");

      kills the NT based Windows OSes.

      --

      --
      Reverse outsourcing: it's the future
    3. Re:Never.. by Anonymous Coward · · Score: 0

      Shut the fuck up, you retarded English fuckwit.

  29. Don't put bugs in! by Thomasvdv · · Score: 1

    I know it sounds a bit cheesy, but the trick is to make sure there are very few bugs in the product before you enter test. Try things like code reviews, spend time on removing defects early on in your process. Read a few books on how to achieve high quality programs. There are lots of books on software quality and process stuff, Rapid Development by Steve McConnel is one of my favourites.

    Testing won't make a bad product good no matter how long you test it, you will only find lots of bugs. Testing a good (high quality) product will confirm that it is OK. Testing is a very inefficient way to find defects. Mind you that doesn't mean to get rid of testing!

    Thomas

    --
    See ya, Thomas
    1. Re:Don't put bugs in! by Anonymous Coward · · Score: 0

      >Testing a good (high quality) product will confirm that it is OK
      testing does not confirm that it is OK, unless it is exhaustive.

  30. programming and debugging are the same thing by dikappa · · Score: 5, Interesting

    IMHO, programming and testing should be done at the same time in the development stage.

    While programming and "bugging" happen at the same time, programming and de bugging/testing should happen at the same time too.

    It is very well explained in Bruce Eckel's Thinking in Java . You should just test everything in the code itself, even if it happens to add some overhead. Once called that function, you want that <something> happens.. so check it in the code.

    I know this is not the usual way procedural programming happens. It seems much more straightforward to drop the code as it comes and then check if it behaves correctly.

    But if you do so you will often discover that that tests made afterwards ara not comprehensive of all possible situations.

    And so you discover that testing and debugging are just unfinished tales, and it is even worst if testers are not the programmers who did the work.

    Plus, I hate testing, so I force myself to do the work well and let the code (as long as possible) test itself, even if it makes development slower and boring.

    Umhh... i'll preview this post 10 times, hoping it's free from bugs :)

    Obviously my code contains no ewwows ;)

    --
    :dikappa
    1. Re:programming and debugging are the same thing by interiot · · Score: 3, Interesting

      The test code could well be three times the size of the normal code (IMHO, it could be much larger than that, but since I only have experience with the more standard way of debugging, I'll tone it down a bit). Doesn't this debugging code have to be bug-free as well? If the debugging code needs to go through the most of the whole process (at my place, the relevant steps would be design / code / unit-test / inspect), then it has the potential for doubling or tripling the time spent coding. It will reduce the number of bugs found later, but the number of bugs that pop up due to lack-of-regression-tests are pretty small overall. Perhaps it's not worth it to do this?

    2. Re:programming and debugging are the same thing by Anonymous Coward · · Score: 0

      Actually it's a recursive process. You need to add test code for your test conditions. Kinda like mathematical logic with meta, metameta... metameta...meta languages. I hope no one codes this way as that would fill our universe with code!

    3. Re:programming and debugging are the same thing by lpontiac · · Score: 3, Interesting
      The test code could well be three times the size of the normal code (IMHO, it could be much larger than that, but since I only have experience with the more standard way of debugging, I'll tone it down a bit). Doesn't this debugging code have to be bug-free as well?

      Testing a solution for correctness, or probable-correctness, is usually easier than figuring out the solution in the first place. This means the test code will be smaller and less bug-prone than the code that does the actual work.

      An example: sorting a list of numbers. An efficient sorting implementation can be rather complex, but making sure it works is pretty simple, even in C: min = list[0]; for(i = 1; i < length; i++) assert(list[i-1] <= list[i]);

    4. Re:programming and debugging are the same thing by lpontiac · · Score: 1

      And I continued today's trend of kicking myself in the teeth by fucking up the "less bug-prone" test code. The first statement is completely superfluous (albeit harmless) *cringe*

    5. Re:programming and debugging are the same thing by lpontiac · · Score: 1

      And I continue today's trend of kicking myself in the teeth by fucking up the "less bug-prone" test code. That first statement is completely unnecessary and useless (albeit harmless).

    6. Re:programming and debugging are the same thing by Anonymous Coward · · Score: 0

      It is not *that* simple: you also have to
      assert that the sorted list is a permutation
      of the unsorted list. Otherwise the sorting
      algorithm could just make up an array, discarding
      the original input. Example:
      input [3,1,7,2], output: [1,2,3,4]
      is correct according to your assertion rule.
      but it is not what we mean with "sorting".

      So "sorting" means not only "one element is lesser or equal than the next" but also "contains
      the same elements".

      Not that obvious, isn't it?

    7. Re:programming and debugging are the same thing by Anonymous Coward · · Score: 0
      The way i do it (C++) is that in every class, each member function fx() gets an associated member function test_fx(). All the test functions get brought together in a static function test() for each class.


      Much like the unix philosophy of many small units each being exhaustively tested, you can exhaustively test each small function without much complexity.


      These test functions should not be compiled into the final product, as it will increase the size of your code considerably. Makefile magic and conditional compilation make them developer-only code.


      Every time you make a change to any class function, you run the test function for that class. If it still passes muster, then your code change is OK and won't destroy the higher up stuff.


      I have found the only time all this doesn't work very well is when your code is a user interface or sends/accepts data from a peripheral device.


      Be prepared to spend approximately twice the effort writing the test code as writing the original functions....however the benefits of time saving in the long run vastly outweighs the time spent doing it.

  31. Or the open source way... by Anonymous Coward · · Score: 0

    It's a well known fact that source inspection, massive beta testing with a huge number of beta testers and proper bug reporting system is the most effective way to debug your software..

    Open source systems can be good at all points (but it's usually not the case).

    Microsoft scores only on the number of beta testers...

  32. Doesn't matter by ch-chuck · · Score: 0, Troll

    Software is immune from defect liability anyway so why bother? I worked as a 'lowlytester' once too, and it's one step below building custodian. The marketing brings in the sales, so they're the crown princes. And the software engineers surely don't appreciate someone pointing out their defects, how rude, especially from someone who just installs and runs it, and doesn't appreciate all the effort it takes to code. Testers are worse then customers. At least the engineers are shielded from customers by tech support. Plus, if a commercial software company actually did publish quality software, it would destroy the whole software cash cow ecosystem that's been carefully evolved over the last 25 years. As long as everyone emits buggy products, it's a level playing field, customers are kept on the perpetual upgrade tredmill, and unit sales keep the gravy train going. But sell a good, working product? Give me a break, that would ruin everything! Sure it would look good on the current balance sheet, but in the long run it would just put competitors out of business, then customers would lose the incentive to try out the next version, in vain hopes that "maybe THIS one will do what we want" and boom, that's the end.

    Yesterday we rolled out Symantec WinFaxPro 10.02 and guess what, it breaks Word 2K! Isn't that great? Now you might think, "What, does Symantec think nobody uses fax software and word on the same PC" but that's not the point. The good part is that I got to go around to all these workstations and delete macros and reboot a couple of times, which kept me from dealing with something productive like purchasing a notebook for a field tech. Now that's job security, knowing which files to delete to make Word work again. It's all about the benjamins dude, and bugs and workarounds are an essential part of customer control we leverage to get them. We will not tolerate some lowly 'tester' out to destroy our jobs.

    --
    try { do() || do_not(); } catch (JediException err) { yoda(err); }
    1. Re:Doesn't matter by Anonymous Coward · · Score: 0

      "And the software engineers surely don't appreciate someone pointing out their defects, how rude."

      Then you have very poor developers, who have the wrong attitude entirely. Good developers have a sense of gratitude towards their testers.

      Testers help make my code better - and that's the highest professional complement I could pay somebody.

    2. Re:Doesn't matter by Anonymous Coward · · Score: 0

      You should see if you can get a hold of any of the WinFax development team. Oops, they no longer work there having been laid off over 2 years ago.

      Have fun....

  33. Use large scale Beta testing by z_gringo · · Score: 0, Flamebait

    Microsoft's massive use of Beta Testers in the user community was at the time called the largest beta test in History. They had thousands of people working for free, for quite some time.

    Perhaps this model should be more widely adopted....

    especially considering that the result was an effeciently designed product which was practically bug free....

    Oh, wait, maybe it didn't work out EXACTLY that way..

    --
    -- -- Warning. Do not stare directly at the sun.
    1. Re:Use large scale Beta testing by SarcasticTester · · Score: 1

      It is a nice option to use large scale bete testers, but you have to make sure your testers know what they are doing. Take 500 morrons and tell them to test an OS does'n make a good army of beta testers, like you said yourself, look at microshaft to find out how NOT to do it. Testers need some sort of training (at least I have had great benefits off it, both for myself and for testers working for me)and to train an army will take a lot of time and even more of your resources away. So don't just take an army of volunteers, take a small army of experienced tester (same as the difference between an army and SAS)

      --
      We're all out there, somewhere, waiting to happen.
    2. Re:Use large scale Beta testing by Anonymous Coward · · Score: 0

      "especially considering that the result was an effeciently designed product which was practically bug free.... "

      That would be GWBasic?

  34. Literate Programming by SWroclawski · · Score: 3, Interesting
    This may not address your current situation, but literate programming can often help reduce bugs and clean up errors found later.

    When a programmer is simultaniously coding and documenting thier code, at both the high and low levels, the larger "thought" bugs will decrease in number and severity.

    Even if you don't use a literate programming system, often documenting the system before you write it can help make the code more clear.

    - Serge Wroclawski

  35. Too many people perhaps? by tetranz · · Score: 2, Interesting

    I don't know how relevent this is but I read somewhere long ago that newspapers ended up with more errors if they had multiple people proof reading the same text because nobody was really taking responsibility. Even if it is not intentional, there is always a feeling of 'the other guy will pick that up'.

    I vaguely remember something similar being said about the space shuttle disaster.

  36. Some defects are inevitable by _zaphod(work) · · Score: 1, Flamebait

    *Unless* you never stop testing your program.

    Define acceptence criteria for the program eg: must process square widgets sucessfully, and test, using every valid and invalid situation you can think of (does it reject triangles correctly?) until you meet *all* those criteria.

    There's always going to be issues, you just need to be sure that the cost of resolving those issues will be within acceptable tolerances.

    Of course, making sure your system is designed and specified properly in the first place will eliminate most defects and (IMHO) make the ones that show up just all that much easier to fix.

    btw: http://www.fastcompany.com/online/06/writestuff.ht ml is a great article on how they test the software that goes into the Space Shuttle.

  37. Specification, modular design. by mooZENDog · · Score: 1

    One thing I find that adds bugs is when the management feel that an extra 'feature' or two is the most useful thing you could do. It's not - every thime the spec changes, you're having to hack little extra bits into the system.

    I suppose a modular design is useful, as the 'plugging in' of new modules will not make huge, bloated classes.

    The way we test things is to get the developer to test his own work, then a tester tests the work. The amount of bugs found by the tester is noted, and the developer fixes them, then back to the next test iteration.

    It's about sharing the responsibility for when things go wrong - the amount of bugs found by the tester relate to how well the developer is doing, but when the tester finally says a system has 'passed', they also become responsible. I guess it's fear motivating people to produce quality software.

    Just a few thoughts.

    Adrian Hill @ zendog.co.uk.

    --

    ---
    "An eye for an eye leaves the whole world blind" - Gandhi
  38. Common testing mistakes by Advocadus+Diaboli · · Score: 1
    One common mistake in testing is that people try to prove that the thing that they are testing is working. But that's not the goal that testing wants to achieve.

    Testing is mainly done to find errors and bugs, so the test cases must be designed in a way to probe the limits of the system that you are testing. For example its not a proper test for a web server if it reacts to the request for http://foo.bar but it could be a nice test to send request with an URL that is terribly long and so we try to provoke a buffer overflow.

    One other major mistake is that often the test is just "trying the thing out". A good test needs a good plan of WHAT you want to test, HOW you are going to perform the test and WHAT criterias are used to decide if a test fails or passes. Especially the last point is something that people want to "discuss away" by saying "Oh, that is just a minor issue, but the test at all passed" and so on.

    And last but not least: To test something you also need a specification to know what the thing should do or shouldn't do. I've once been assigned to test a software that was completely without documentation and they told us to play around with it to find out what it does. That was really a nice base for a test setup...

    Just the 2 cents from a guy that has worked long in software development and is now working in a PC hardware test lab.

  39. Balanced testing, finding the last bug, etc. by freddled · · Score: 1

    I don't think that you should worry about finding 'too many' bugs in your testing. If you find them the customers will not, and that is good. Here are a few of my core beliefs about testing. * You can never find the last bug in your system. There have been many studies about this. It is impossible to prove that your system is bug free. Don't argue, it's true. Impossible. What you must do is decide what level of testing to perform based on the cost of that testing against the cost of your customers finding bugs. * You must categorise the bugs that you find and record discovery & clean up rates over time. This allows you to see whether you are improving or not and what trends are emerging. Joel Spolsky's site has good stuff on defect tracking. * The best testing is balanced and I strongly believe in a three-cornered tension. Separate analysis, development and test teams allow the refinement of each of those processes. Analysts and testers in conjunction will identify bugs and also trends and faults in the development process. Developers and testers in conjunction find faults in the analysis and analysis process. Developers and Analysts in conjunction, over time, refine the test process. * Insert defects that you know about at various stages in your process to measure the effectiveness of the test process. This works well for reviews and pretty well for code as long as you tell your boss. * Finally and most importantly, post pompously to discussion groups at all times.

    1. Re:Balanced testing, finding the last bug, etc. by Anonymous Coward · · Score: 0

      hello world can be proven to be bug free under certain circumstances, but that's about it :-)

  40. Simple sata test and regresion by oliverthered · · Score: 2

    Good design is always the best way to avoid buggy, hard to fix code.
    But for testing it depends what you testing,
    a good general test process for data processes (most functions can be though of as dataprocesses) is

    Generate some input test data,
    Work out what the results should be by hand.
    this is your first stage regression.

    Now run the input test data through the application/function

    Diff the results against your hand generate file.

    Any descrepancies should be resolved as,
    A bug in the application/function
    or
    A Bug in the hand generated files.

    Fix all the hand-job problems

    Repeat until you test files are perfect.

    You now have a second stage regression test,
    Known good inputs, and known good outputs

    Use the correct test files to fix the application bugs.

    If a bug is found that isn't in you second stage regression, then generate test files for it.

    Fix the bug in the application(using the test files).

    Then run you second stage regression and check that any differences are down to the bug that was found (and been corrected).

    Following this process you application should always get better, and a you should soon be able to build up a fairly large sample of test data.

    The test harnis is simple enough (just a diff on the files and a bit of code to wrap up the functions.), to prevent artifacts caused by the testing process.

    Any-how that's more-or-less what I do for most of my testing, bug fixing.

    --
    thank God the internet isn't a human right.
    1. Re:Simple sata test and regresion by NetWurkGuy · · Score: 2, Interesting

      One problem that usually arises with this approach is that an very large quantity of data must be hand created to test all the paths in the function. This is not IMO a flaw in the procedure you recommend. It points to a design weakness: it means that higher level logic has failed to adequately sort different cases to be dispatched to different functions. This can be a result of abusing the notion of "hiding messy details" at the upper levels and pushing the problems down to the bottom. There must be a balance of hiding/deferring and exposing/processing of situations at every level to keep the complexity burden reasonable at each level.

      --
      "Obtuse Anger is that which is greater than Right Anger" - Lewis Carroll
  41. Test early, test often by SarcasticTester · · Score: 1

    as XP says... The prupose of testing a program is to find problems in it, not to verify that a program runs correctly. A test that reveals a problem is a success. A test that did not reveal a problem is a waste of time. However, if the design has flaws, your program will be sure to have too many bugs for your own good. Ever tried reviewing the designs with an experienced tester? They might find some nice flaws and possible bugs even before you have written a single line of code.

    --
    We're all out there, somewhere, waiting to happen.
  42. Understand your real goals by James+Youngman · · Score: 3, Informative
    Well, I'm assuming that your systems start with analysis & design, followed by coding, redesign and more coding, go through unit testing (with more redesign if you are unlucky), followed by integration testing once unit testing is complete, and perhaps acceptance testing once integration testing is complete. This is more or less the traditional waterfall cycle when the deliverable is the finished code.

    This strategy works - lots of shops use it all the time. However, the real premise of the process is that you want to get through client acceptance testing as soon as possible, as long as the result is not dissatisfaction on the part of the client with the software after they've accepted it. As you have noticed this strategy doesn't actually produce bug-free code.

    This is not surprising. What you achieve is after all pretty much determined by what your goal was. You (shops in general) need to think hard about what your actual goal is. If your goal is nearly-zero-defects, then the traditional process isn't doing the right things for you. If however, your goal is to obtain milestone payments from your client, then it's pretty good. This is an area where the business goals determine the software engineering processes.

    Let's put another hat on and think about what the negative affects of this strategy might be (negative is really defined in terms of what your goals are, but let's be vague about that for a moment).

    • If your goal is not "zero bugs" then you will stop work before there are no bugs left
    • Your software is delivered to the customer with bugs in it, which the customer will find
    • Your development team will partly move on to other areas, probably leaving a smaller number of people to deal with the remaining bugs
    • Maintenance programmers are typically less skilled than some of the original team - because some of the original team have been pulled off to activities which are more important to your business (e.g. delivering another set of code in order to meet a payment milestone somewhere else).
    • Skills evaporate over time - after N years it gets very difficult to find authoritative information on why something works like it does.
    • As the code is fixed, it gets brittle. The emphasis is on just fixing bugs and making low-risk changes in order to avoid breaking the production code - hence refactoring is rare.

    All of the above factors are unpleasant for those left to maintain the code. Many of them also limit the longer term flexibility of the product and hence the useful life of the software. This feeds back into development processes because limited product lifetimes mean that there is less incentive to change your process to produce software which can persist (i.e. why make the effort to ensure that the system is flexible enough to last through 20 years of changing requirements when you expect the system to be retired after only 7 years?)

    You mentioned XP - it offers a lot of techniques that resolve these problems:-

    • Programming in pairs - this makes for very efficient skills transfer, hence you limit the extent to which the expertise boils off
    • XP testing aims for automation - this encourages more testing and the stronger testing ability allows you to contemplate high-risk-high-return activities like refactoring.
    • Refactoring - which prevents your code getting old, brittle and hard to change
    • Many more I'm sure (I'm not an XP practitioner)

    However, XP is best adapted to projects where a single team makes multiple frequent deliveries of code, can work closely with the client, and where the development project continues in the medium to long term. These characteristics allow many of the XP techniques, and this means that techniques taken out of XP may not help projects of a different style.

    Having said this, the automated testing angle is a real strength. If testing is done manually, it's time consuming and expensive. Hence people don't do it as much as they might otherwise thing is appropriate. Maintenance deliveries often just undergo regression testing, and faults can creep in which might have been caught by the original unit or integration tests. Automated testing has many advantages :-

    1. Automated tests are faster, so people actually do it!
    2. You can redo all the tests after every change if you want.
    3. Automated testing allows you to refactor without danger
    4. Being able to re-run all the tests really does keep out the new bugs which would otherwise have been introduced during maintenance
    5. Your testing coverage grows with time (since bew tests are introduced but tests are only retired when the relevant functionality is changed or dropped)
    6. You don't fail to spot errors (quite often with manual testing regimes errors can go unnoticed because the tester doesn't spot a small bit of incorrect behaviour that the original team might just have spotted).

    Just as a data point, I work on some software that has an automated test suite. The suite contains between 500 and 1000 test cases; the test suite conducts those tests in under 5 minutes on a very old machine. To do these tests manually would take one full-time person at least a week.

    The summary is :-

    • Understand your business's real goals
    • Cherry-pick techniques that will help achieve those goals (you might even be able to adopt a whole methodology if its processes are designed to achieve the kinds of goals that your business actually has).
  43. Quality not quantity by Anonymous Coward · · Score: 1, Insightful

    Testing, like documentation, is not improved by sheer quantity. If you are doing 1,000 crap tests then 10,000 crap tests are not going to catch many more bugs.

    Look at your bugs and ask yourself: at which stage of testing should this bug have been caught? Then find out why it was not.

    If the bug couldn't have been caught by a component of your testing framework then you will have to look at the framework.

    Quality audited tests as what you want, you may find that most of your tests are testing for things that never could happen and thus flooding you with worthless reports and giving you a false sense of confidence.

    As an aside, I have in the past created useless tests to calm panicy project leaders. "5% of our tests failed" sounds much better then "50% of our tests failed" and it as all achieved by adding unnecessary tests. But at least I knew which ones they were.

  44. Missing in the discussion by HiQ · · Score: 3, Interesting

    What I miss in this discussion is something about the persons performing the tests. In my companyh we have a test team, consisting mainly of people who don't know the first thing about coding, who cannot read sources and who can only test 'through the UI'. And yet the system we work on has thousands of sources, a percentage of which has a UI (20%). Testing of all the underlying objects is a lot harder, and my experience is that with this many sources the total amount of possible 'paths' in the system is so large that tests using the UI take too much time, and therefore is never done properly. So now the developers are constantly asked to provide methods by which the testers can perform the tests.

    1. Re:Missing in the discussion by phr34k · · Score: 1

      I work in the games industry, where most of the code I write ends up being UI code of some description (graphics, sound, etc.). This is also the area that ends up with the most bugs (it's easier for a tester to notice graphic glitches than to see poorly implemented AI).

      With an extremely slim development team and timeline (we make GameBoy Advance games), it's difficult to justify unit tests, and usually comes down to the gall of the programmers on the project.

      Of course, a crash bug that's very difficult to reproduce never helps in short timelines :P

  45. your sig by Anonymous Coward · · Score: 0

    I can read your sig, but it would be more interesting if it said something, rather than being random letters.

    1. Re:your sig by Anonymous Coward · · Score: 0
      Or if he caught up with the internet and used UTF-8.

      Says someone frustrated with everyone still using horrible SHIFT-JIS.

    2. Re:your sig by paulbiz · · Score: 0

      It is his name. "Giorgos Tsiros"? I don't know Greek.

  46. Report the design errors before the minor annoyanc by terminal.dk · · Score: 1

    When it comes to software, lots of the errors are caused by bad design or a people who have not been thinking. Often many errors are of the same basic type.

    The real way to test is, that when you find a few errors of one type, you call it a design error, and sends it back to the developers so they canfix this type of error all over their software. This is much more efficient than having the developers focus on 10 single instances of the same error.

    This type of test really ought to be done internally over a few iterations , but most often the people you use for testing don't find the,.

    A good way to fix bugs is to at least have someparts the debugging done by groups of 2 people, letting person1 explain for person 2 what the code does. This will force 2 people to think, and will give better code quality. This is called Extreme Programming these days, but I have used it years before it was invented, and it works perfectly for debugging.

  47. there are 2 main things to test... by RogueProtoKol · · Score: 1

    first is that the program works properly, eg if it was a finance program put in some likely scenarios, with large and small numbers, make sure everythin works as its supposed to

    secondly is enter in as much crap as you can, do your best to crash it, act like a complete and utter retard to the program, put in the opposite of what it would normally want

  48. Biggest bang per buck: case specific testing by jukal · · Score: 2

    I believe that most bang per buck can be achieved if the organisation is not too fixated to one or two standard testing procedures. Projects differ a lot. Using 30 percent of testing budget for testing the testing plan might well be worth the effort. If your company is making a set of applications for a fixed platform using fixed components and fixed architecture and these basics have been previously thoroughly tested, then ofcourse what was said above might not be true.

  49. Get back to programming basics. by Anonymous Coward · · Score: 5, Interesting

    Having been on teams producing 24 X 7, bullet proof code for communication servers and credit card processing I have an idea about the increasing number of bugs found. In the Old Days(tm), we wrote every line of code ourselves and used time tested libraries (C language). I quit using microsnot when their libraries stared having bugs in their rush to C++. Now most coders use massive OOP libraries from who knows where built by slackers, and GUI app builders that generate code and perform all sorts of actions under the hood. When something goes TU it is often hard to find all the conflicts.

    Even when using one of these app builders I read through all the code and put tests and logging into the generated code. Funny that these tools are supposed to make us more productive. My coding and testing every line still beats total time spent on a project since I don't have to go back and redo it later. When it's done, it's done. Next project. I've had comm programs run for over 5 years error free servicing 1000s of users per day. One specialized delivery, billing, and inventory system I wrote was used over 6 years error free and caused the owner to stay with hardware that was compatible with the software (not M$) because the programs always worked. And not a damn bit of it was OO or came from some automated builder tool.

    In short, the closer you get to the metal and the more familiar you are with the code that is executing, the better your chances of producing error free programs. Takes longer to market, but then you don't have to redo it forever until the next bug ridden version comes out. Saves time and coders to work on the next version and the customers are always pleased. Get back to the basics. Try it, you'll like it.

    1. Re:Get back to programming basics. by jukal · · Score: 3, Insightful

      I agree 100%

      The only perverted problem with this approach is that in case you are selling your code to some 3rd party company for example, and you are competing with a set of other companies you might have terribly hard time trying to make the customer understand why your development takes 3 times longer than what is promised in other proposals. This is not so much problem when you have a proven track record clearly stating that the complete time wasted is less using your approach. Still, in some cases, the customer might be stuck to some bizarre outsourcing process with inherently excludes all proposals that exceed the shortest estimate by some magic percent.

      The point being that many of current customers for software support this bizarre approach of first jumping to lake and then seeing if you hit a stone or not. Ofcourse its not easy job to decide to pay $100 for a candy, if you can get the same thing with just some dog dung added for $33. Especially if the software provider does not say that the dung is included in the offering.

    2. Re:Get back to programming basics. by Anonymous Coward · · Score: 0
      Yes I must say I do prefer to write everything myself, that way you know or can trust your code. I make fun of the "drag-and-drop" programmers in my office, using delphi and VB, using this or that component to do the job.

      While i do see the advantages of these "magic" IDE's, especailly in development time reduction, there applications get more bug reports than mine. However it would be wrong of me to say that either/or scenario of development environment is better/worse than the other.

      At the end of the day bugs should NOT be avoided, how else do you get the return customer ;) hahaha

    3. Re:Get back to programming basics. by Anonymous Coward · · Score: 0

      You have to be able to sell quality... first shoot the sales staff... having a proven track record helps. As an architect and lead, one thing I stress in meetings is the testing and review cycles including the customer. They have to sign off on all releases including full cycle testing by their team well as ours. But as I mentioned in the original post, the work was for projects that were expected to last for years without breaking. I never missed a deadline until M$ C6.0 and then it really went to hell with Win NT3.51 added to the mix.

      Anyway, glad to see that I'm not the only one who follows this line of thinking. Quality work doesn't cost, it pays.

    4. Re:Get back to programming basics. by devonbowen · · Score: 1
      In short, the closer you get to the metal and the more familiar you are with the code that is executing, the better your chances of producing error free programs. Takes longer to market, but...

      Amen. I used to work in a Not Invented Here shop and we were heavily criticized during an outside review for having that attitude. Since then I've moved on to contract work in a bank where all they do it build on top of other software and I've got to say it's a total mess. Lots of finger pointing and no one finding solutions to what should be simple problems.

      I have to disagree with your comment about it taking longer to roll your own, though. In my experience here, I've noted that it can take more than 400% longer to deal with other people's code due to 1) the learning curve and 2) the inability to get help when you find a bug. I've often thrown away code I'm supposed to use and written it from scratch to make a deadline.

      I know this isn't the way it's supposed to be. People may argue that "well if it was written well then you wouldn't have that problem". The problem with that argument is that I live in the real world where it usually isn't written well. There are a hell of a lot of bad programmers out there and some of them are even writing APIs. There are some libraries I can depend on but most I can't.

      Devon

    5. Re:Get back to programming basics. by Anonymous Coward · · Score: 0

      You do know that the "basics" are simply the arbitrary way that things got done before anyone figured out they could be done differently, right? Object-oriented design isn't just a marketing ploy (though I can see how you'd think so if you've been trying to learn the techniques from PC books and M$)

      Your tools are not superior to other tools. As you said, it's your familiarity with those tools that's important. Saying that OO is inferior to more "basic" techniques is like saying that Swahili is inferior to English. Well, if you've spoken English all your life, trying to switch to Swahili will probably be difficult and introduce all sorts of problems for you. But that's you that's the problem, not the language or technique you're using. To someone who has the proper experience, OO is a powerful tool. It's not "more powerful" than the way you're doing it, but once you've learned the techniques lots of problems decompose really easily into OO solutions.

      If your only tool is a hammer then all problems will begin to look like nails. Just because M$ makes some lousy screwdrivers and saws doesn't mean that all screwdrivers and saws are useless tools.

    6. Re:Get back to programming basics. by scrytch · · Score: 2

      In short, the closer you get to the metal and the more familiar you are with the code that is executing, the better your chances of producing error free programs

      I would claim that the first two conditions are often mutually exclusive. I spend far too much time chasing down fencepost errors because some nitwit used a C array and a for loop instead of a STL list and iterator. Said fencepost errors are known to lead to root compromises when performed on the stack (but usually it's on the heap and tends to cause heap corruption ... sometimes, in ways that are hard to detect). And often I wonder why an app that spends 99% of its time waiting for user input is being written in C++ anyway, but that's a whole other story.

      Basically, I get mired in some stupid piddly implementation detail instead of being able to think about the system, because someone decided to program to the machine instead of to the spec.

      No, libraries and frameworks are good. Just don't get seduced by frameworks that claim to do everything, because they usually do so ... poorly. Use the right one for the job, and one that's been around the block a few times, and you'll find yourself producing code that works, and even getting over that uneasy feeling that it shouldn't actually work the first time

      --
      I've finally had it: until slashdot gets article moderation, I am not coming back.
    7. Re:Get back to programming basics. by tshak · · Score: 2

      Having been on teams producing 24 X 7, bullet proof code for communication servers and credit card processing...Now most coders use massive OOP libraries from who knows where built by slackers

      Although there's some truth to your point, I think your first statement is what really matters. You worked for a company that made software for credit card processing. This means that you A) probably didn't have to continually debate the importance of software quality and B) probably had a budget to allowed for decent programmers and reasonable project timelines.

      Although MFC was originilly pretty bad (what a surprise), it really has stabalized. Win2K is objectively a stable (read: not secure, stable) OS from a software standpoint and it's full of software with these so-called "unstable OOP libraries using GUI app builders". Also, from my personal experience, the base class library of .NET is also extremely stable (albeit it hasn't been around too long). The Java libraries have also gotten a lot more stable and are used in many mission critical e-commerce or financial systems. Really, there's no point in reinventing the wheel unless we are concerned about the wheels quality. Five years ago I may have agreed with you more, but times have changed and class libraries have matured greatly.

      --

      There is no longer anything that can be done with computers that is nontrivial and clearly legal. -- Paul Phillips
    8. Re:Get back to programming basics. by Anonymous Coward · · Score: 0

      I would say that you see more errors in programs written in Delphi and VB simply because the developer that wrote the program is at fault and not the tool. VB/VBA (because of it's simplicity) is notorious for attracting the very type of person that you do not want writing critical/serious software -- the part-time/HR/marketing-type turned developer.

      I'm more of a middle-tier/back-end developer so GUI development isn't usually a high priority for me. When I called upon to develop some simple tool for the marketing/HR types -- I'll use VB/Delphi/etc for banging it out and be done with.

    9. Re:Get back to programming basics. by tgrigsby · · Score: 1

      I agree -- mostly. You avoided naming names, so I'll be the bad guy: Borland's Delphi libraries are not thread-safe, the "interface" mechanism conflicts with their TComponent child-release mechanism, the visual components often conflict with each other, etc., etc. Granted, this is as of version 5.0 and they're up to 6.0 now, but in 6.0 they made a massive move to Linux and threw out the BDE, so I can't imagine they've gotten rid of all the bugs. Combine that with the bugs I've had to work around in the 5 different 3rd party tools we've purchased and made a part of the in-house toolkit and you've got minor nightmares on a regular basis.

      On the other hand, time to market is a principle you have to respect if you plan on staying in business, and rolling your own is more than just time-consuming; it can be expensive when your competitor is eating your lunch providing functionality quicker than you do because you're still mapping out and implementing functionality that they bought prepackaged.

      Let's just say I agree with you in principle, and that the DOS programs I built (comms, case management, shipment preparation and tracking, patient care, clinicals, materials management, real estate, etc.) ran (and in some cases still run) flawlessly. But there is so much functionality out there that customers expect nowadays and so little time in which that functionality is expected to be delivered that it's unrealistic to reinvent the wheel just so you can control every line of code.

      --
      *** *** You're just jealous 'cause the voices talk to me... ***
    10. Re:Get back to programming basics. by jfengel · · Score: 2

      I think that your success may have as much to do with the sorts of programs you've been asked to wrote as your programming style.

      A comms program does the same thing, over and over. If it runs for one day, it'll probably run for five years. The number of novel scenarios it encounters is relatively small.

      While delivery, billing, and inventory systems are driven by many complex algorithms and sets of rules, they, too, tend to do the same thing over and over. Once they work, they tend to go on working; six years is the same thing as a single day to a piece of software.

      You're talking about a specialized system here. If you'd written a general inventory system, which has to deal with every single customization that the end user will try to come up with, is a vastly more complicated piece of machinery and is much harder to test.

      It sounds like you're used to working on small systems, with a single programmer working from scratch. The larger the system, the harder it is to examine every single line yourself, and track every single one of the dependencies. OOP systems are one way of encapsulating the work so that the dependencies are reduced and the task becomes manageable even when done by a large team.

      It is without a doubt true that "the more familiar you are with the code that is executing, the better your chances of producing error free programs." However, demanding 100% understanding of the code puts an important limit on the sorts of programs that can get written.

  50. People power by pc_plod · · Score: 1

    One of the best ways to find out non-obvious bugs is to, if you can, get normal people to use the program as they would. People with no prior knowledge of the software, apart from what they want it to do, will use the software in a way that people who have worked on the code and know the internal structure wouldn't, and hence find things that coders wouldn't. Nothing is idiot proof because idiots are so damned clever.

    --

    Help the scientists free the world from the evil curse of the dracula
  51. Engineer For Quality Instead by Anonymous Coward · · Score: 0

    If a project is worked on with the assumption that bugs can be worked out during testing, then usually a greater number of bugs are introduced when the project reaches the testing stage. Instead, a project should be engineered for quality; it may take slightly longer, but there will be fewer bugs introduced to the project, and less time will be needed to squish bugs to an "acceptable" level.

  52. Automate the testing by agm · · Score: 1

    Firstly, I strongly recommend a peer-review system where other developers eye-ball the code to make sure it all looks ok. This should catch most bugs.

    The other thing we use is a system that peeks at the code and data structures and look for common mistakes. The code can't be checked in unless this automatic test has been run and the recommendations followed. Automated systems are great for picking up easily recognisable (and often silly) problems before it ever gets to QA.

    The great thing about rules based systems is that you can often automatic checking that the rules have been followed.

  53. Could be lots of things... by alaffin · · Score: 1

    ...you're kinda vague about what exactly most of the bugs are in.

    Assuming that everyone is working on a different branch of the program that you're building (Coder (or group of coders) X is responsible for writing a nice new algorithm, Coder (or group of coders) Y is responsible for writing a GUI for it, Coder (or group of coders) Z is responsible for the making it run on a network) then the most important issue is to make sure everything works right together. Comment lots (and in a standard format - i.e. If you're using an OOP language, make sure every object has an accurate description of what it does, and what'll make it break), and communicate lots, so that everyone knows exactly where everyone else is going.

    After that, make sure every coder (or coder group) runs their code through white box, black box and whatever other testing methods whose names are locked away in the back of my memory. Beta test every 'module', before you even start to think about throwing them together.

    Also, someone mentioned above that the health of the coders was important. He's/She's/They're right. Offer lots of free snacks (or at least free perked coffee), give them a couple cots to lie down on if they get tired, give them an hour a day to do some kind of physical activity (yes, make them excercise) and refuse to let them work more than 50 hours a week (even that's extreme). You'll find their productivity increases, and when productivity goes up, mistakes go way down.

  54. Hurt yourself? by richie2000 · · Score: 2
    do you feel that excessive testing hurts the development process at all?

    Testing should always be a part of the development process. The wording here implies that testing somehow is considered to be outside the scope of development and I suspect this mindset is causing a lot of bugs to remain undetected.

    It's just like documentation or support, those are also (or damned well should be) integral parts of the development process. Sometimes I think that most programmer's believe that the development process consists of the steps hack, compile, ship instead of the tedious iterative process of analyze, design, code, test.

    So what, then, is excessive testing?

    Well, as long as you find bugs doing it, it's not excessive.
    If your projections predict a bug or two in a specific piece of code and your tests fail to find them, then testing (provided that the test method isn't flawed) gave you a much desired quality assessment of that piece of code - meaning that the testing still wasn't excessive.
    Running the same tests over and over on the same code with the same data, now that's excessive, not to mention stupid.

    --
    Money for nothing, pix for free
  55. Test smarter, not harder? by NotZed · · Score: 1

    Well, at least partially.

    Write code and test it as you write it, a combination of bottom-up and top-down development and incremental testing. At this level, the test cases should be trying to break everything, particularly if you're dealing with any kind of external input (i.e. anything NOT in memory that you didn't put there yourself). Remove files, fill them with binary, make them unreadable, etc. This sort of stuff can be the basis or even be the regression test suites that can be used for automated testing.

    If I write a particularly tricky bit of code (which sometimes you just have to, for performance or something), I separate it and write it completely separately so I can test as much of it as possible before it gets into a bigger system. Faster turn-around with changes helps with more-or-less prototype code like this.

    If your api says 'you can't pass a null here', or 'must be between 1 and 7', put an assertion inside that invocation, let the computer test it for you at runtime.

    Tools like gprof and quantify let you know if you're test cases are touching all the cases. If you have exception cases, try and write test cases that will touch all different exception cases at least once. A bunch of bugs i come across are stuff that wouldn't normally happen that does. Sure, the program might be going down the toilet already, but its better it keeps going down than floods the bathroom floor.

    As the scale of the part of the system under test grows (i.e. from unit to module to system testing), its usually harder to exercise individual cases, so the tests change focus a bit. e.g. to usability (just because dialogue a works great, and dialogue b works fine, what happens if a opens before b and you close a first, etc), scalability - 10 things might be fine, 1000 might be unusable, functionality - did you hook up a menu to run function y?

    Some things you can fully automate, others you need someone to operate.

    If its something that needs to run in multiple environments, test in as many of them as you can. Before you beta test. Just as its bad to get a low-level api type bug exposed by your qa testing team, its much worse for it to reach your beta testers.

    And yeah, the best way is to write and maintain quality *DESIGN* from the start. It makes finding and fixing bugs easier, and adding new features isn't like walking a tightrope with glass slippers on.

    --
    _ // `Thinking is an exercise to which all too few brains
    \\/ are accustomed' - First Lensman
    1. Re:Test smarter, not harder? by James+Youngman · · Score: 1
      If your api says 'you can't pass a null here', or 'must be between 1 and 7', put an assertion inside that invocation, let the computer test it for you at runtime.

      See Offensive Programming for a discussion of this kind of thing.

    2. Re:Test smarter, not harder? by Anonymous Coward · · Score: 0

      That link was disapointing. I was expecting tips on how to harm the user when they make a mistake, instead its a white paper on development methodology.

      I want to hire a guy like the evil coder from Dilbert..."I've replaced all the system sounds. This is 'Bird hiting window'...now when the user does something really wrong!"

  56. Wanna know a secret? by Kanasta · · Score: 2

    When someone is told to implement feature A, they spend a little time sifting thru the 20yr old code, and do the minimum to get it done.

    They write test cases to test A, unit, system, etc. Their team leader approves it, and of course all the tests pass before it goes out.

    In the end, there's always some obscure way feat A interferes with feat B, but you're not going to write tests for every combination of keystrokes possible.

    If you have user testing (u should), they'll find a score of bugs u didn't. Of course, the users too have a deadline to get stuff shipping and they too want to do the minimum possible.

    In the end, nobody involved has a personal incentive to make it perfect. With proper testing procedures in place, everyone has a piece of paper with someone's signature on it which says they passed. They don't feel (too) guilty when there's a bug, (hey, my TL approved it!).

    Anyway, how are you going to ask the customer for $20k extra so you can test for an extra week?

  57. Bug Seeding by Anonymous Coward · · Score: 0

    Of course you should stop testing! There is no such thing as flawless code. You must choose a limit for testing: life-support systems need more testing and QA than an ordinary Information System.

    A neet technique to find how many bugs are you missing in your tests, is bug seeding. It consists in create bugs artificially and submit that code to the test team. Then you count the number of seeded bugs the test team found.

    Lets try an example: suppose you seed 10 bugs and the test team found 8 of them. Then you know that you are finding at most 80% of the bugs (in a given confidence interval, depending of the total number of founded bugs). 80% can be very acceptable in the classical Information System, in slashcode, but it't completely unnacceptable for NASA Shuttle control software.

    --
    Senador

  58. Suggestion by ceeam · · Score: 2, Insightful

    I guess you should try to spend a part of your testing budget on improving your design and programming practices.

  59. You can't do it by mauvivas · · Score: 1

    You can't test your code. When you do this you always try to use it the same way you thought when you were coding.
    I suggest you ask your grandma or someone that doesn't know much about computers to do it. They can always find bugs.

  60. Close the loop by edhall · · Score: 5, Informative

    The object of finding bugs isn't to result in fewer bugs by fixing them. It's to result in fewer bugs by not writing them in the first place. The developers need to review found bugs on a regular basis, with the objective of changing development methods to avoid them in the future.

    It's all fine and good to say "don't write buggy code in the first place," but this sort of feedback is the only way to get there. What makes this so hard in many organizations -- aside from the usual disrespect many developers have for QA people -- is that developers fear that this process is some sort of performance evaluation. As soon as this happens, the focus shifts from finding better processes to defending existing processes: "It's not really a bug," "There isn't really a better way of doing that," "We just don't have time to do it the 'right' way," and so on.

    This is why the feedback needs to be direct from QA to the developers, who are then tasked to categorize bugs and develop recommendations for avoiding them. It's the latter that is the "product" required by management, not a list of bugs with developer's names on them. Management should otherwise get the hell out of the way.

    -Ed
    1. Re:Close the loop by jukal · · Score: 3, Interesting

      > This is why the feedback needs to be direct from QA to the developers

      I agree. For some reason (maybe it's just me) developers are nowadays too full of false pride as well, thinkin: I am the lead coder, analyzing bugs is the job of trainees. In my opinion the situation should be (atleast in some cases) completely opposite, only veteran coders can make correct assumptions and define pre-cautions for future and fix this particular case in the correct way. Otherwise it might just lead to a decline of the original code - making things even worse.

      Working with bugs is a tough job, do it with pride! *with the allbugfixers unite anthem playing gently on background*

    2. Re:Close the loop by garett_spencley · · Score: 3, Insightful

      developers are nowadays too full of false pride as well, thinkin: I am the lead coder, analyzing bugs is the job of trainees. In my opinion the situation should be (atleast in some cases) completely opposite

      I don't know who your company is hiring but where I work things are as they should be. It's the college kids who are hired for the experience are the one's with cocky attitudes while the advanced developers are trying to push management to get better processes in place rather than just "Fly to the moon by next thursday."

      ... Then wednsday comes and it's "No wait, fly to Mars instead. But still do it by tommorow".

      At the moment our company isn't as structured as it should be. We don't have a QA team or a testing team. It's just management pushing the developers to get thigns done. But the developers are pushing back to say "hey, we need a process here. It's not just writing code. We need to design it first. And that takes time. We also need to implement code review and pick someone who's got the experience to decide what goes in CVS."

      So my point is that in my experience it's the inexperienced developers who want to just jump in and write code thinking "it's not my job to fix bugs". I think this has a lot to do with wanting to get that advanced status. But as they grow they realize that they're going about it wrong and smarten up with regards to processes.

      --
      Garett

    3. Re:Close the loop by the_verb · · Score: 1

      I agree wholeheartedly.

      The company I used to work for (before the management team went schizoid and scuttled the firm) had some of the best practices I've seen in a small firm.

      An automated bug-tracking system that allowed QA's to rank defects by importance, severity, and component... very direct lines of communication between QAs and Devs, including a 'pair testing' system. When a QA found a non-cosmetic bug, they were teamed with a dev who would work directly with them in isolating and fixing the problem.

      It actually fostered teamwork between the two groups, although we salted that with the occasional "Round of beer for the QAs if they can find a level 3 or higher defect after Monday, Round of beer for us if they can't" sort of contest.

      --the verb

  61. Re:best way to test is to use automated testing by Cpt_Corelli · · Score: 3, Informative

    Of course properly written functionality test scripts (doing what the user does) will find most bugs. The downside is that it is boring to follow test scripts manually.

    My company has been successful implementing automated functionality tests with Rational Robot (part of teamtest). If you just take the time to define proper test scripts you can easily redo all functionality tests on various platforms (if you use VMWare or similar sw to simulate different platforms) at the click of a button.

    This saves time every release as the developers can focus on finding the really tough bugs instead of running boring functionality tests again.

  62. Developer testing... by fcrick · · Score: 5, Insightful

    I've worked on both ends (dev and test), at M$ and other places, and I've come to one conclusion (I'm sure its not the only correct one).

    Developers must test their code.

    With a test team backing you up, it becomes too easy to change something, run it once (if at all), and then push it into the next build so the test team can catch your errors. I've found that as a tester, a huge proportion of bugs are simply features implemented where the developer just forgot something stupid. I end up wasting 5 minutes writing a report, my manager assigns the bug back to a developer (hopefully the one who made the mistake but not always), and the developer comes back to the code a week later, spending 20 minutes just trying to figure what s/he wrote a week back.

    My point: this wastes 30 minutes of people's time for every little stupid mistake. Pressure your developers to really give a thorough test to the code they write before the check it in, especially if you have a test team, because you just end up wasting more people's time.

    --
    Your signatures belong to me.
  63. Speaking from a non programmer point of view by q-soe · · Score: 2

    I often think the time lines have become so compressed in terms of expectations that it becomes harder and harder for companies to write clean code and get it out the door in order to meet the expected cycle of upgrades - and this is something i find common to all companies and even open source software. It seems we as consumers have come to expect an upgrade to this or that every year and so the dev cycle becomes one continuous thing - coders who are exhausted or working long hours write buggy code.

    I think many people would be happy to wait a bit longer for better products but the industry has brainwashed them into thinking that its almost easy to bung a new version out.

    The best way to avoid mistakes is not to make them in the first place but thats not so easy when working on a compressed cycle with management on top of you - its not just programmers who deal with it - its network designers, SOE architects etc etc

    Bugs exist - they always will - but minimising them requires time and time is a commodity not readily found. I dont know what the solution is - as i say its just my thoughts.

    --
    I refuse to argue with Anonymous Cowards - if you want a discussion get an account....
  64. one my first college programming class by reschly · · Score: 1

    They told us to put a potted plant infront of the keyboard and see if the program would still function properly.

    --


    I believe that the existence of women is proof that God loves us and wants us to be happy
  65. My suggestions by Anonymous Coward · · Score: 0

    execessive testing never can hurt the code - at worst it is a waste of time.

    perhaps the most usefull tests for you right now is to just make tests for all the known bugs to ensure they do not pop up again. So at least you won't regress.

    While I am not certain exactly what you are programming for it sounds like the problems are comming because you are making lots of changes to your current code base. I would also suggest setting an expectation of the amount of bugs that pop up/the amount of changes that are made to the code. Becoming more consciousness of how changes in code relate to new bugs can be very helpfull in overall stability as it can help you predict how many new bugs will occur and also show you the strengths/weaknesses in the design of your project in terms of changability.

  66. The Point of Testing is NOT to find bugs ... by Anonymous Coward · · Score: 0

    The Point of Testing is NOT to find bugs in your code, but rather in your software engineering process! if testing discovers a problem with your code that means your software engineering process is flawed and needs to be changed so as to ensure that this kind of bug (1) will never be able to occur again and (2) cannot hide in all your old code.

    it sounds like your SW engineering process is totally crap an urgently needs to be changed.
    striving for error free testing sounds complicated at first and requires discipline but it really pays off, economically and otherwise!

    www.sei.cmu.edu/

    i would refuse to work for shops that don't strive for and regularly achieve 100% error free software at the point before testing.

    1. Re:The Point of Testing is NOT to find bugs ... by trailerparkcassanova · · Score: 1

      i would refuse to work for shops that don't strive for and regularly achieve 100% error free software at the point before testing.

      Then get use to hearing this: "Why yes, I think I would like fries with that!!"

      How do you know it's error-free if it's not tested? First year sw-eng, eh?

  67. Test smarter, not harder by JaredOfEuropa · · Score: 1
    Testing rigs that generate random input or, if feasible, go through all possible inputs, are a good idea and relatively cheap to do.

    Testing input/output, or the application's functionality if you will, is important, but do not forget to test your application on all the different platforms the users will run this on. You may run into missing DLLs, incompatible versions of ODBC drivers. Your application is only part of a greater whole, and often you have only limited control over components outside your application. This is a great source of bugs for programs that are meant to run on many workstations.
    And no, there can never be too much testing, unless your code is like one line, which i doubt...for any full blown application, there is not "too much"
    Indeed. Yet, many a time have I seen projects where seemingly rigorous testing was applied: Unit testing, integration testing, FAT, and SAT are all carried out diligently, but upon closer examination all these tests were testing the same things under the same conditions. In short, a huge waste of time and effort. If your project can afford one, get a test specialist or test manager, and have him make sure each test is conducted at the proper level.
    --
    If construction was anything like programming, an incorrectly fitted lock would bring down the entire building...
    1. Re:Test smarter, not harder by DJPsychoChild · · Score: 1

      I've found that as a programmer, modularizing my code, and testing each module before it is implemented, saves me from 99% of the errors encountered on large projects. For example: I coded an open file as part of my new word processor. If the open file has bugs in it, they will be found before I put the module in with the rest of the program.

      In response to missing DLLs, there is an easy solution: include any vital DLLs in your distribution. NEVER assume that your user has the proper DLL files to begin with. At the very least, tell them what they are missing, and where they can download them from.

      --
      CODITO, ERGO SUM: I Code, therefore I am.
    2. Re:Test smarter, not harder by Anonymous Coward · · Score: 0

      Exactly! By building software using well tested modularized code, you produce reliable results. It's not always perfect, sometimes those modules do strange things when put together in certain combinations. But at least your the reducing human error side of the equation and that's where most errors occur. I can't count how many times I have compiled software for my unix box and just watched as all the compiler warnings fly by.

    3. Re:Test smarter, not harder by DEBEDb · · Score: 1
      Testing rigs that generate random input or, if feasible, go through all possible inputs, are a good idea and relatively cheap to do.


      While you're at it, build a testing environment to simulate all possible states of underlying
      environment, including hardware, OS, other
      software, network, phase of the moon, room
      temperature and most recent Slashdot article.

      --

      Considered harmful.
  68. Easy. by Faile · · Score: 1

    Have a kid go at it for an hour or two, they're cheap and efficient.

    Seriously, this is the best thing to do. You want to see how your product performs out of the test lab? Then go outside the lab and give a copy to your friends and their friends. People who know how the product is supposed to work seldom breaks stuff, it's when you let the inexperienced join the game the fun begins.

    --
    Anataka suki desu. Itsumo. Itsumademo.
  69. The trouble with testing... by Tottori · · Score: 1

    Is that it liberates programmers from the responsibility for getting it right in the first place. After all, any problems will be found in testing, right?

    Wrong, actually. Testing tends to find the surface problems. Sometimes in the process of fixing the surface problems the deeper problems are revealed, but just as often they become even more deeply hidden.

    There is no substitute for reading the code and making sure it makes sense. In an ideal world, this would be done by someone other than the original programmer, but doing it yourself is better than nothing. Yeah, it's really boring. That's what those paychecks are for.

    --
    use constant PERL_IS_BROKEN => $] >= 5.006;
  70. Metrics and Code Reviews by corporal_clegg · · Score: 1

    By 'a large number of defects' do you mean larger than expected? The "average developer" creates between 50 and 150 bugs per KLOC (thousand lines of code) of new code. Is your error rate higher than this? What other metrics do you have in place to indicate that the error rate is high? How many errors are they creating in this release versus the previous release? How many did you expect? The phrasing of your question implies that these basic metrics are not known and thus your statement about the number of errors is not meaningful. If you want to improve software quality, one place to start is to make some basic measurements and predictions so you can track your progress and detect anomalies as they occur.

    Secondly, developers, not testing/QA, are solely responsible for code quality. You cannot test quality into the system; it must be designed and constructed into the system from its inception. If the developers are creating too many errors, examine the development process. It must include formal code reviews (80-90% of all bugs will be found in review) and adequate time to refine the requirements, develop a sensible design and build the software. Pick up a copy of "Code Complete"; it'll help alot.

    --


    public void karmaWhore(String url){addSlashdotComment(fetchContent(url));}
    1. Re:Metrics and Code Reviews by Anonymous Coward · · Score: 0

      KLOCS! KLOCS! KLOCS!

      I always laugh thinking about the story Steve Ballmer told on Cringley's 'Triumph of the Nerds' where Ballmer is explaining how the folks at ibm wanted to know how many klocs it would take to write an OS.

      Anways, I generally agree with what you said. A good engineer should have a good sense of how many bugs he should expect based on the amount of additions (and esp changes) to a the code.

    2. Re:Metrics and Code Reviews by ShadowMind · · Score: 1

      Also recommend 'Writing Solid C Code' from the same publisher. Although it uses C as its language, it covers development approaches which remove 90% of the main causes of bugs. Its a great companion to 'Code Complete'

    3. Re:Metrics and Code Reviews by DecoDragon · · Score: 2

      I heard an interesting presentation at the Baltimore Chapter of the Association for Women in Computing, given by Dr. Linda Rosenberg - Chief Scientist for Software Assurance at NASA's Goddard Space Flight Center. The presentation is online. In the middle of the presentation was a discussion of some of the tools the assurance team uses. There's a density test, which might be of particular interest to the original poster. The density test looks at how many errors one would expect to find based on lines of code, and I think complexity but I'm a bit fuzzy on the exact details. Anyway, part of it is that there is that based on measurement of past debugging there is a curve of how many errors you would expect to find over time. When the testing team says they are done, the results are compared against the curve, to judge whether they fit the pattern one would expect to be done. That is, how far along on the curve are they? There's another tool the assurance team has to judge whether requirements are meaningful, by evaluating the requirements document to make sure it's complete. Using key phrases to judge whether a requirement statement is definitive or fuzzy or incomplete (that is does it say "to be determined later") and giving a percentage of how many of these types of statements you have compared to the rest of the document. Maybe not perfect, but a starting place to judge.

      Neither programming or software assurance are areas I have knowledge in, so take the above with a grain of salt and check it out yourself. It all seemed rather interesting.

  71. No Bugs == poor testing by ThaReetLad · · Score: 1

    The point of testing is to find bugs. If you're not finding bugs then you're not testing hard enough because ALL software contains bugs.

    I once heard of a place where the testing people were actually paid a small bonus for each bug they found, and the programmers bonus was based on the number of bugs found in their code, and the time it took them to write it in the first place.

    The job of a programmer is to write code, not to find bugs, so you write code that seems to work and send it off for testing. It then comes back with a list of bugs as long as your arm, mostly to do with integration testing, and you fix'em. You send it back for more testing and it comes back with a short list of bugs caused by your previous fixes and you fix 'em. Eventually someone decides that bugs are sufficiently rare, or unimportant (ie minor glitches which could be difficult to fix quickly) that it is time to release the software. Then you get a long list of bug reports from your customers when they blatently and wantonly start using your software in a totally different way to which you had thought they would use it thus breaking things you thought worked.

    --
    You can't win Darth. If you mod me down, I shall become more powerful than you could possibly imagine
    1. Re:No Bugs == poor testing by ShadowMind · · Score: 1

      It *is* the job of programmers to find bugs. The addititude of 'all software contains bugs' and 'they will catch it in QA' is dangerous and inefficient.

      It's everyone in the organisations responsibility to a) prevent bugs in the first place. and b) find them, c) fix them.

      In an ideal world QA would always pass, because the architects/coders have done their job. In an ideal world no bugs would pass QA. OK this isn't an ideal world - but you should strive for it.

      Saying that its not the coders job to find bugs, or that the customers wantonly break your software is an approach which will actually take you away from your goals. If the code is correct, it will correctly handle any input or situation (including the big-red-switch); where 'correctly' is according to specification.

    2. Re:No Bugs == poor testing by ThaReetLad · · Score: 1

      I think I was being slightly ironic. My current job will not actually use a QA dept at all because nearly all of the bugs are ironed out at integration (Also because the deadline is so tight). No one likes to give buggy objects to their colleagues but it happens, usually because you can't see the wood for the trees and miss something stupid.

      Everything we write is a separate COM object. This means every software engineer is capable of, and responsible for finding and fixing bugs using either the current integrated software or individual test apps in VB or similar. We also run a bugzilla bug base so each programmer can report an error directly to the author of the bug. I can't imagine a bug in the architecture reaching a tester when a modular structure lends itself so well to modelling in UML, and any flaw in that would raise it's head during implementation and integration.

      Never the less, my point still holds true I think. If your testing regime comes up with no bugs, no small coding errors and no intermittent glitches then the testing is inadequate and you should look harder. After all, we are only human.

      --
      You can't win Darth. If you mod me down, I shall become more powerful than you could possibly imagine
  72. You need find a 'natural crasher' by X-Pirate · · Score: 1

    Hi, I am a software designer for a large corporation (as well as free-lance) I have found that there are people in this world who have a natural knack for crashing computers and finding bugs in software. It's kind of like the light/dark side of the force.

    Some people - such as myself- can simply enter a room with a 'mis-behaving' computer, and it will all of the sudden start working properly. Likewise, there are people who can just LOOK at a computer and it will start to malfunction.

    I have three people (natural crashers) that I have beta test all of my software that are incredible testers. By the time each one of them sees three or four revisions, the software is nearly flawless.

    Don't be fooled, some people are just plain idiots. Sometimes it is hard to tell the difference between an idiot and someone with the crashing-gift. For example: A natural crasher AND an idiot may try to put text in a numeric-only field, but the idiot will want you to change the database format to allow text - whereas the 'natural crasher' will tell you that it doesn't make sense to turn that field into a text field - but he wanted to see what would happen if he tried it.

    Once you stumble onto one of these amazing people, your software design will improve 10-fold.

    1. Re:You need find a 'natural crasher' by Anonymous Coward · · Score: 0

      Some people - such as myself- can simply enter a room with a 'mis-behaving' computer, and it will all of the sudden start working properly

      These people are otherwise known as Software Developers. They are often heard to mutter the phrases "It doesn't do that on my computer" and "We were unable to reproduce that"

    2. Re:You need find a 'natural crasher' by Anonymous Coward · · Score: 0

      I seem to be a 'software crasher' and a 'hardware magi??'. Its
      kind of a funny thing to watch actually. Maybe it
      comes down to the zen and the art of motorcycle
      maintenance??
      I love crashing software. The trick is to make sure
      that everything is kept in context.
      Do NOT gloat. Calmly write down the process it took
      to make the problem appear. If YOU can't get it to
      happen again, you just saved the developer the agony
      of telling YOU to buzz off.
      MANAGEMENT has the final say on whether a 'bug' should
      be fixed. Especially at the end of the cycle. If a
      a bug gets deferred, deal with it. It is not the
      end of the world, and no you are not being ignored.
      -
      And PLEASE will all developers at least spend a few
      minutes testing their warez on clean machines. Boxen
      that don't have all the developer crap on them can
      act very differently from your finely tuned machine.
      (microsoft only??)

    3. Re:You need find a 'natural crasher' by X-Pirate · · Score: 1

      It's not just MS software that needs to tested on 'clean' boxes. I develop for MS and UNIX and even in writing ANSI-compliant C, i've found weird things between clean SUN boxes, MS boxes, and linux boxes. Software NEEDS to be tested on non-dev boxes whether it's UNIX-based or non-UNIX based (win, MAC)

  73. about unit testing by Anonymous Coward · · Score: 0

    You still find many bugs? Maybe you wouldn't find them if you weren't doing unit test? What if they'd be there, you just wouldn't detect them.

    Testing is important. I remember reading that testing and debugging a program takes as much ressources (time, money, manpower) than designing and writing it in the first place. I found it to bne close to that. The most common mistake is to have many programmers and designers and just one or two people doing QA. Your efforts should be on par on both sides. It is also good to involve the developement staff in testing and debugging (even tough they'll hate you for that) at least once because they'll be more conscious about their designing and programming and next projects (or itterations) and the potential bugs hidden and issues that might come up in QA.

    Unit testing is a double edged sword. Since you are testing units you might be tempted to test everything about a specific module. And then overlook integration tests. That's a mistake. Integration tests are critical because they are the ones bearing the maximum level of complexity. Also tests should always be defined according to some kind of user story or scenario (many of them, at the very least one per feature, use case templates are really not a bad start).

  74. Product or process problems ? by PinglePongle · · Score: 3, Interesting
    You say you're finding too many bugs - it sounds like there is something fundamentally wrong with either the product or the development process.

    First thing to do : look in your bugtracking software ( you DO use bug tracking software, right ?) , and try to isolate hot spots. Is there a particular piece of code that generates more bugs than others ? Is there a common pattern to the bugs (ie. memory not being freed, of-by-one errors etc.) ? Are they _really_ bugs or mis-interpretations of the requirements or the design ? In my experience, the 80/20 rule applies to bugs in spades - it is just hard to find the patterns.

    If you need to, make the bug categorisation in your bug tracking software more specific. Once you get an idea of what your hotspot is, you can work at fixing the cause of the bugs.

    If it's a particular piece of code, make sure it's reviewed by the best developers/architects you have, and consider refactoring it. At the very least, insist that it is reviewed and tested thoroughly before chec-in to the source code control system, and consider adding a hurdle to jump prior to check in (e.g. get the manager to sign it off).

    If the code was written by one developer, consider swapping them out and giving it to someone else - it may be they're in over their head.

    Make sure you increase the number of test cases for this piece of software, and check for "edge cases" religiously - if the code is broken at all, it is likely to be broken in more ways than you realized.

    If it turns out that the problems tend to have a common cause (memory leaks, of-by-one errors,etc.) consider a structure which forces developers to concentrate on those issues before checking in code; again, consider the hurdle ("software must be signed off by the off-by-one guru prior to check in"), and hone your tests to check for these kinds of errors if possible.

    If the bugs stem more from misunderstood requirements or designs, beef up those areas. Work on your requirements and analysis processes; consider training courses for the developers to get them up to speed on interpreting these nebulous documents, and look at improving the review process by having designers present. Frequent "mini-deliverables" (another concept stolen from XP) will help here too - get your team to deliver a working piece of code - it need only be a minimal sub-system - and get it reviewed by designers and analysts. If the bugs tend to occur on the boundaries - i.e. invalid API calls, invalid parameters etc. - consider design by contract or aspects.

    Finally, there's a bunch of hygiene stuff :
    • coding standards (ideally with tools to check for compliance) help by allowing you to specify how to deal with commonly bug-prone operations
    • invest in a decent bug tracker, request tracker and source code control system - it really helps if you can trace a bug back to a particular requirement or previous bug fix if you're trying to find out where all your bugs are coming from
    • seating arrangements - I worked on a project once where the bug rate was halved when the developers were moved to sit in the same room as the database team. Get everyone in the same room if at all possible
    • automated test tools - already mentioned - help to ease the pain of testing. If practical, insist that the developers run the automated tests before checking in code
    • religiously review all work products - designs, specifications, documentation, project plans, code, tests, the works - before declaring them "ready for use". It's the single cheapest way of finding problems, and a great way to spread good practice.


    N
    --
    It's all very well in practice, but it will never work in theory.
  75. no one size fits all process by jilles · · Score: 3, Informative

    There's no one size fits all process for testing. How much effort you need to spend on testing depends on a lot of factors including but certainly not limited to: code size, amount of developers, customer requirements, life cycle of the system etc.

    That being said, here are some remarks that make sense for any project:

    In general a testing procedure that gives you no defects just indicates your testing procedure is bogus: defect free code does not exist and no test procedure (especially no automated procedure) will reveal all defects.

    The XP way of determining when a product is good enough: write a test for a feature before you write code. If your code passes the test it is good enough. This makes sense and I have seen it applied successfully.

    A second guideline is to write regression tests: when you fix a bug, write an automated test so you can avoid this bug in the future. Regression tests should be run as often as possible (e.g. on nightly builds). All large software organizations I've encountered do this. Combined with the first approach this will provide you with a growing set of automated tests that will assure your code is doing what its supposed to do without breaking stuff.

    Thirdly, make sure code is reviewed (by an expert and not the new script kiddie on the block) before it is checked in. Don't accept code that is not up to the preset standards. Once you start accepting bad code you're code base will start to deteriorate rapidly.

    --

    Jilles
  76. thinking differently by vsigma · · Score: 1

    Part of the coding process should be 'quality' coding to begin with- with proper planning details and what not.

    However, in the web world - most projects are rushed, and pushed, and not allowed the proper time to do so (at least in my experience in the dot.com and post dot.com world) - hence, the continued cycle of carnage.

    Under these conditions - if you can get some semi-decent QA people to help out - you can pinpoint problems that way a lot quicker. Why? They are not attached to the code. In fact, most QA people these days, can't even code. However, what they should excel in is being either a) A dumb ass user or b) following the logic train.

    Lets start with the 'dumb ass user' view point. They will try to put in letters to numbers, numbers to letter, insane characters to whatever fields that you've never intended. They will try to break the code under different environments, doing things that you never quite expected. Basically - a fresh perspective. Ideally, let them mess with it (if that is possible), or see if you could integrate the item in question into one of their enviroments to see what else it could possibly toast while they are doing their job. While you're coding for a particular thing, and are aware of what it is supposed to affect - its usually when it's thrown into a total environment that things start to break, and break quickly.

    Now, onto the follow the logic train argument - if you, as a developer, can explain to a QA person who cannot code, but who understands the logic, in simple english - AND - they understand what you're talking about - you're 80%+ of the way there already. Again, the key thing here is a fresh perspective on the item in question. Kinda of like stepping away and them coming back to it.

  77. Testing is a start by shoppa · · Score: 2
    Testing is a start, but not enough. The results from testing (e.g. "300 buffer overflows") have to be identified and fed back into the organization to change how future software is developed for the better.

    Testing/debugging is like finding and putting out existing fires. If the organization can use test results to prevent future fires, then you're a step above. And probably more advanced than 90% of the software houses, too :-)

  78. How I Test by Apreche · · Score: 2

    I program mostly in object oriented languages. So I have seperate files, which have seperate classes. I start at the bottom of my UML and work my way up testing each class as if it were its own program. When I know they all work individually, I can be certain that, despite the fact there had to be a few bugs I overlooked, that all bugs are due to the way they interact. It takes awhile, but in the end I'm mostly bug free.

    --
    The GeekNights podcast is going strong. Listen!
  79. Test Engineering by codeButcher · · Score: 1

    At a previous company, we had seperate Test Engineers that never (or very seldom) did any Software Engineering (although they had same qualifications). Oh, the whole company was very into Best Practices, ISO9000, TQM, procedures and all that sort of thing. So that wasn't just a fancy-sounding job title, these people actually made it their jobs to design thoroug tests, keep up to date with latest developments in their field, etc. It was a pain, but it delivered the goods.

    There is a lot of research available on the Web (and trade literature) on best practices in testing. Just entering some random but legal data and saying "Ok, this works!" is NOT testing. A combination of techniques like boundary testing (input data is close to the dividing line between legal and illegal input - from both sides of the line), error injection (modify code to intentionally generate an error then analyse how this is handled), branch analysis, unit + system tests, peer reviews etc. etc. would probably be best.

    One rule of thumb you would want to keep in mind, is that the earlier in your development lifecycle the bug is caught, the cheaper it is to fix (substantially). So it pays off to have testers involved with appropriate consistency checks, peer reviews, and what not, right from the requirements gathering phase. (Yes, "lifecycle" is a bit bigger than code-compile-test :-) So it doesn't help much to have a good test team bnut the development team don't know their stuff.)

    Also, it is assumed that Zero Defect is very hard to achieve, therefor when addressing bugs, first go for the 20% that cause 80% of the trouble (ye olde 20/80 rule-o'-thumb).

    --
    Free, as in your money being freed from the confines of your account.
  80. Bang per buck by Anonymous Coward · · Score: 0

    The questions were with regards to bang per buck and could you have too much testing.

    In terms of bang per buck the single best test instrument we have at our disposal is the human mind, and given that it's also always best to try to catch defects at as early a stage as possible. Then in my experience the one thing that makes the biggest difference is formal peer group inspection (== testing with brain) of all project deliverables, at all stages of the project; be that requirements, HLDs, LLDs, code or test cases. It's a pain to implement, but it works far better than any other form of testing at preventing bugs reaching customers.

    As to too much testing, yes, under certain circumstances you can have too much testing. Testers who've tested the same thing a hundred times will tend not to see the problems on the 101st iteration. Mindlessly running automated tests is unlikely to buy you much other than again boring the same human testers who have to check the results at the end of the day. However, in general you can't have too much testing, as I've already mentioned get in very early and test deep.

  81. Buggy degsign and planning by oliverthered · · Score: 3, Insightful

    Most of the 'worst' bugs i've come accross are down to bas systems design, before a single line of code is written.
    If a system is designed well then you should have far fewer bugs, even if you are using code monkies who don't know a quick sort from a n^2 bubble.

    Design you systems well, know your people, Bill's good at that kind of thing and likes it(but crap at ui's say),
    Jess loves doing data imports, (may not be that quick, but always does them well).
    Fread always designes and produces good/fast systems cores.

    Get your developers talking and sharing knowlage, 'I'm, having a bit of a problem' , or 'Who knows how to', are good things for people to be saying, so incorrage them to own up to the inadiquacies, and they won't have them for long.

    If you can manage that then your productivity and bug counts should drop dramaticly, and the bugs you do have should be easier to fix.

    --
    thank God the internet isn't a human right.
  82. Need proper distance from the code by scoile · · Score: 1

    I find that, when debugging code I write, I tend to try to verify that the code properly handles exceptions I've anticipated. But that's the problem with my process: if I've anticipated an exception, I've already handled; if I haven't anticipated an exception, I won't think to test for it.

    Ultimately, I think a lot of software problems result from the assumption on the part of the coder that users will try to use the program properly, that users won't be lazy and sloppy, and that users will RTFM. That, and many programmers just don't think things through, don't consider all the possible combinations (especially true in parser code!).

    It's important to have people that aren't familiar with the expected functional specifics test the code. And when testing, you have to deliberately try to break the program.

  83. Hold on! Don't use testing to fix a poor process by SledgeHammerSeb · · Score: 2, Insightful
    If your testing is resulting in an inordinate amount of bugs, then there is probably bigger problems than you think.

    Testing is necessary but not sufficient. There must be a way to capture requirements, convert requirements to design, convert a design to implementation, and finally test. At each transisition it is a good idea to make an assessment of how well you accomplished your task.

    Skipping any of these steps and putting if off until test is pure folly. An extremely false economy.

  84. Assault it with random data by Sandmann · · Score: 4, Insightful
    The image loaders in the gdkpixbuf library included with gtk+ 2.0 were tested with random data. This caught a lot of bugs, including some in the standard image manipulation libraries.

    Just generating random data and trying to load it caught a lot of bugs, but even more effective was to take a valid image and modify the bytes in it at random, and then try to load it.

    Of course, the reason this was so effective, is that the loaders would get mostly what they expect, and then suddenly something illegal. This is the kind of thing you tend to forget about when you write code.

    Since it is so easy to attack your program with random data, this kind of testing gives you a lot of bang for the buck, but on the other hand, the bugs it find may not always be those that are likely to occur in practice.

    1. Re:Assault it with random data by Anonymous Coward · · Score: 0
      Well, that's not always effective when taken to the extreme.

      I once wrote a language interpreter, and the QA persons idea of an automated testsuite mostly involved throwing random stuff at it.

      The resulting testsuite was several megabytes in size, took 45 minutes to run, and consisted 99% of error messages. It never once found a bug.

      My own testsuite, which exercised subtle conditions that I was aware of from knowledge of the language itself, was 2k in size, ran in a fraction of a second, and found every bug. Actually, it also found lots of bugs in other implementations of the same language as well...

  85. proper design + inspections ? by Jeppe+Salvesen · · Score: 2

    I am having a bit of a QA problem myself. After reading up (Steve McConnel, etc), I'm looking to spend more time in pre-code, and also implement inspections (a code review technique).

    The disadvantage to testing is that you detect errors, but need to spend time finding the source. If you avoid the error by detecting it at design-time or during code review, you will spend less time dealing with it, since you will know more about the root cause to begin with.

    --

    Stop the brainwash

  86. Use C and not C++ by Anonymous Coward · · Score: 0

    Hello Gentlemen,

    I'm a first year programming student at an Ivy League school and I've just finished my Visual Basic classes. This term I'll be moving onto C++. However I've noticed some issues with C++ that I'd like to discuss with the rest of the programming community. Please do not think of me as being technically ignorant. In addition to VB, I am very skilled at HTML programming, one of the most challenging languages out there!

    C++ is based on a concept known as Object Oriented Programming. In this style of programming (also known as OOPS in the coding community) a programmer builds "objects" or "glasses" out of his code, and then manipulates these "glasses". Since I'm assuming that you, dear reader, are as skilled at programming as I am, I'll skip further explanation of these "glasses".

    Please allow me to make a brief aside here and discuss the origins C++ for a moment. My research shows that this language is one of the oldest languages in existance, pre-dating even assembly! It was created in the early 70s when AT&T began looking for a new language to write BSD, its Unix Operation System (later on, other companies would "borrow" the BSD source code to build both Solaris and Linux!) Interestingly, the name C++ is a pun by the creator of the language. When the first beta was released, it was remarked that the language would be graded as a C+, because of how hideously complex and unwieldy it was. The extra plus was tacked on during a later release when some of these issues were fixed. The language would still be graded a C, but it was the highest C possible! Truly a clever name for this language.

    Back to the topic on hand, I feel that C++ - despite its flaws - has been a very valuable tool to the world of computers. Unfortunately its starting to show its age, and I feel that it should be retired as COBOL, ADA and Smalltalk seem to have been. Recently I've become aquainted with another language that's quite recently been developed. Its one that promises to greatly simplify programming. This new language is called C.

    Although syntactically borrowing a great deal from its predecessor C++, C greatly simplifies things (thus its name, which hints at its simpler nature by striping off the klunky double-pluses.) Its biggest strength is that it abandons an OOPS-style of programming. No more awkward "objects" or "glasses". Instead C uses what are called structs. Vaguely similiar to a C++ "glass", a struct does away with anachronisms like inheiritance, namespaces and the whole private/public/protected/friend access issues of its variables and routines. By freeing the programmer from the requirement to juggle all these issues, the coder can focus on implementing his algorithm and rapidly developing his application.

    While C lacks the speed and robustness of C++, I think these are petty issues. Given the speed of modern computers, the relative sluggishness of C shouldn't be an issue. Robustness and stability will occur as C becomes more pervasive amongst the programming community and it becomes more fine-tuned. Eventually C should have stablity rivalling that of C++.

    I'm hoping to see C adopted as the de facto standard of programming. Based on what I've learned of this language, the future seems very bright indeed for C! Eventually, many years from now, perhaps we'll even see an operating system coded in this langauage.

    Thank you for your time. Your feedback is greatly appreciated.

    Egg Troll

  87. Make good tests, not just "some" tests... by Anonymous Coward · · Score: 0

    Just because you are using unit tests doesn't mean you'll be bug-free.
    Your tests should be good enough to catch any errors, and I've found that too often people don't cover too many possible bugs in their tests.

    Review your tests. When you write a test, think about "what are all the problems that I could have here? What should be the intended behavior of the system?" And when you change your API, carefully check your tests again. Believe me, if you do it right, it works!

    I've worked on a project using unit tests, and it was just great -- usually, the tests would catch several bugs before we commited the code to CVS.
    But just like any other powerful tool, you need to use it right, or it just won't work.

  88. What is the real problem? by Anonymous Coward · · Score: 0

    There really isn't enough information to provide a specific response...but the "our testing is finding too many bugs, so maybe we should test less" seems a bit, well, PHBish.

    Are the tests actually silly (e.g., is a low comment/code ratio a "stop-ship error") or is the problem really despair at the inability to develop good software?

    BTW, in my experience, a non-competitive "we're all on the same team, we all want the same thing" relationship between testing and engineering works very well. I've never worked in an environment where the testers rub the engineer's noses in any bugs they find, nor do I care to.

  89. When to test by droyad · · Score: 1

    TEST AS YOU GO!!!!

    I write this in caps as 90% of coders write a thousand lines of code and then test. The way to do it is:
    1) Write your methods from your specification (you do have a specification don't you???)
    2) Read the code to make sure it does exactly what the specification says it should
    3) Test the method with every type of value it can recieve.
    4) fix the bugs in the method
    5) re-read the code to make sure it still meets the spec.

    I say method, because testing should be on the method level. A method is AT MOST 20-30 lines of code (from O-O point of view) any more and there is too much code and it's to confusing (GUIs are exceptions).

    The theory is that if the methods are correct and the specs are correct, the program will work together, but still do unit testing in gradually increasing sizes.

    ALSO (in O-O programming (Java,C++,C#,etc)) NEVER EVER EVER EVER EVER USE GOTO, EVER
    If your spec needs a goto statement, re-writeit. I can't stress this enough. GOTO is evil, it's bad, it's taliban! It breaks the flow of the program. Java does not have goto, so you can do without it!
    Also don't use pointers in C#!!!!!

  90. 101 little bugs in the code by NeilArrow · · Score: 2, Funny

    Just to emphasise how good design is the key to avoiding most bugs, not testing - there's a song that often gets sung at my place of work...

    Hundred and one little bugs in the code
    Hundred and one little bugs in the code
    Fix the code, compile the code
    Hundred and two little bugs in the code

  91. When was the last time... by barzok · · Score: 3

    most of us actually got good specs? Been close to 3 years now for me. With half-assed specs derived from business users who A) don't know what they want and B) don't know when they're out of their league when talking about how something should work you're pretty much screwed from the beginning.

    1. Re:When was the last time... by scott1853 · · Score: 5, Insightful

      I don't let customers dictate how programs should work. I make them tell me what information they have to enter, and what they want to get back out. I decide on mostly everything in the middle.

    2. Re:When was the last time... by dwarfking · · Score: 3, Insightful

      Maybe this is a topic for another discussion, but I don't expect business user to supply me with specs. They aren't software guys, they are business users. I expect them to supply me with business requirements and business process definitions, from which we will together develop the software process definitions from which the specs evolve.

    3. Re:When was the last time... by zaphod110676 · · Score: 3, Insightful

      Sad but true.....

      Boss: Go write some code that does some stuff

      Me: Well what about this? I need this info.

      Boss: Well just start working and we will fill that stuff in laster.

      How the heck can I write good when I am hardly told what the application is supposed to do? So I write something, it doesn't take into account the missing details that I asked about. Those get defined two weeks after the thing is supposed to be done. The app turns out terrible and then the powers that be want to know why it has problems. It is incredibly frustrating.

      --
      To Do: 1. Take over world 2. Pick up Milk and Bread on the way home
    4. Re:When was the last time... by sql*kitten · · Score: 5, Insightful

      I don't let customers dictate how programs should work. I make them tell me what information they have to enter, and what they want to get back out. I decide on mostly everything in the middle.

      Then you aren't writing particularly complex software. If your users need software that does sophisticated processing, mathematical or otherwise, then the programmer probably isn't the best person to work out how it should do it. This is true whether you're working on software for pricing derivatives, or for tracking shipments in a supply chain, or for controlling manufacturing machinery. That's why there are notations like UML, so that functional experts can communicate unambiguously to the software developers what a system should be doing. A good programmer knows about programming, a good analyst knows about business processes, some people are both, but only with years of experience, and even then, only within a single industry.

      The requirements, specification and alanlysis process is what separates software engineering from "hacking".

    5. Re:When was the last time... by AssFace · · Score: 1

      that is exactly my world now. I have a manager that doesn't know Java or databases, and he is telling me what he needs and vaguely how it should work with other theoretical products that we don't have and only emulate... so in order to emulate properly, we need to know what they do, and we don't know what they do...

      the retarded leading the blind.

      I was really hoping it was just this company and that somewhere I out there I could find a job that didn't suck and I could really use my skills - this is disheartening to read :(

      --

      There are some odd things afoot now, in the Villa Straylight.
    6. Re:When was the last time... by scott1853 · · Score: 2

      My original post was a little ambiguous. My company provides software for construction companies for different phases of their business operations. So yes, there are complex mathematical formulas. On the other hand, complex is an ambiguous term in itself. Something is only complex when you can't understand it.

      But I was referring more to the actual user interface and db support. The formulas are standard and fairly easy to write and debug. But any time a user requests that they have a button somewhere I try to cut them short and just ask them what they want the end result to be. But if they want some custom analysis then yes they need to let us know what the formula is though.

    7. Re:When was the last time... by Zurk · · Score: 1

      yup. but software development still doesnt work too well now does it ? even with software engineering and UML we still end up with a large majority of poorly delivered software projects and products with massive numbers of defects.

    8. Re:When was the last time... by Anonymous Coward · · Score: 0

      This doesn't work for all software. Particularly things where time and user interaction are critical. For example, ever written software for a restaurant? Or a telephone marketing service? They need to have the interface done in a specific fashion so that it integrates into their real job. The kind of specs you're talking about are nice in terms of giving you technical freedom to do things right, but technical correctness is pointless if the users can't work with the system the way they need to with minimal training and overhead.

    9. Re:When was the last time... by andrew+cooke · · Score: 1

      Jobs and companies vary hugely. If I were you, I'd start checking job adverts and writing your CV. You could even put in your CV that one of your objectives is to work in an environment with a structured approach to software development - and ask about it at interviews.

      Good luck.

      --
      http://www.acooke.org
    10. Re:When was the last time... by plumby · · Score: 2

      But if they want some custom analysis then yes they need to let us know what the formula is though.

      And if they don't? or they forget to mention an important detail of it? I've lost count of the amount of times I've gone through detailed requirements gathering, got them to agree that in this situation X happens, developed software that does X, and then been told, after they've actually started using the the software, that they always want it to do X unless Y is true - something that they've never mentioned before. The problem is that most users don't actually understand their requirements, think that "almost always" is the same as "always", that error handling is a software issue not a business process issue, and that detail is not important.

    11. Re:When was the last time... by gripdamage · · Score: 1

      But I was referring more to the actual user interface

      I agree the initial program specs should include only the data that needs to be put in and what the client wants to get out. An important exception is when the program needs to interact with existing systems.

      Obviously the implementation in general however, is entirely in the realm of the programmer. The user interface on the other hand is done best when you work closely with the client. As a technical person, what works well from your perspective will probably not enhance employee productivity for the client. If you can, talk to the people who will be using your interface to get ideas and feedback on your designs. Come back later and get more feedback after they are actually using the interface. Ask them where they make mistakes and adapt the interface as necessary. This is part of the design process for me.

      Unfortunately it's not always an option...

    12. Re:When was the last time... by pthisis · · Score: 2

      How the heck can I write good when I am hardly told what the application is supposed to do? So I write something, it doesn't take into account the missing details that I asked about. Those get defined two weeks after the thing is supposed to be done. The app turns out terrible and then the powers that be want to know why it has problems. It is incredibly frustrating.

      Requirements change. Users don't know how to specify things. They often don't want what they think they want, and even when they do it may be obsolete or of secondary importance before you're done implementing it.

      Your #1 job as a programmer is to write useful code--code that helps your customer/business/department--which usually (in my experience) means that your skill in determining requirements and working with the customer to refine them is far more important than your actual programming chops. Relying on an external project manager to gather requirements and define scope is usually disastrous.

      This is a major part of the XP ethos and especially the agile programming philosophy ("Welcome changing requirements, even late in development" is one of their primary principles...). The sooner you develop softare practices that realize this and plan for it, the better off you'll be.

      see e.g. the Agile Alliance article repository for stuff to think about.

      Sumner

      --
      rage, rage against the dying of the light
    13. Re:When was the last time... by zaphod110676 · · Score: 1

      >Relying on an external project manager to gather requirements and define scope is usually disastrous.

      You said it! This is the problem. Ther person who gathers the requirements is also our department head and he has no time. He's always in meetings and things and we get blown of constantly.

      The department started out with only him and one other person. Now there are nine of us and things have grown beyond the ability of one person to both manage the department, take care of coporate needs and wants and funnel requirements our way. He is very reluctant to give up control and has made it pretty clear that he doesn't want us to talk to the people that actually need the software. Things are going to have to change soon or there is going to be a mutiny.

      --
      To Do: 1. Take over world 2. Pick up Milk and Bread on the way home
  92. What kinds of bugs are you finding? by wowbagger · · Score: 5, Insightful
    When I was an undergrad, one of the out-of-major classes I took was archery (I needed a PE credit, and I was interested in it). In archery (and in any other kind of marksmenship) the trick is
    • Be consistent
    • Measure your error
    • Identify the cause of the error
    • corrent the cause
    • repeat


    Programming is the same way. What kinds of bugs are you finding? Are they just stupid bugs, like buffer overflows or off-by-ones (good design, bad implementation), or are they unhandled errors, or are they API mis-matches or faulty algorithms (bad design)?

    Have you made any effort to go back and say "Gee, we are getting a lot of off-by-one errors. OK folks, we need to think about our loops."?

    And when you find one type of bug, do you go back and identify anyplace else a similar bug may exist?

    If you are hitting high and right, and you never adjust your sights, you will NEVER hit the target consistently. If you never feed back the CAUSE of the bugs, you will never eliminate them.
    1. Re:What kinds of bugs are you finding? by p3d0 · · Score: 4, Insightful

      A third kind of bug is harder to put a catchy name on, but it happens when you constantly say "oh, I didn't think of that case" or "I made a change in these six places but forgot that one". These indicate design problems of a fundamental nature. It means your code is cumbersome and inelegant.

      --
      Patrick Doyle
      I mod down every jackass who puts his moderation policy in his sig. Oh, wait a sec....
    2. Re:What kinds of bugs are you finding? by bluebomber · · Score: 2

      I'd actually consider these separate types of bugs. They're both design problems. The first is of the type that can often be remedied by either a) forming your requirements better or b) performing peer design reviews.

      The second is what the XP-people would call a "code smell". I've found Fowler's Refactoring book to be quite useful in figuring out ways to fix the design such that the "I made a change in these six places but forgot that one" (and other) bugs go away.

  93. must be early by llamalicious · · Score: 1

    I could swear that said biggest bong.
    just wishful thinking I guess.

  94. Add more steps to the process! by Flu · · Score: 1
    First of all, how many bugs are "too many"? Some bugs should (unless you're coding Space Shuttle Software) never be fixed; The hazzle they cause for some users will never justify the cost of fixing the bugs.

    Next, unit- and integration-testing only detects so many bugs.

    How many steps are there in the developement process?

    An exampe of steps to take:

    • Writing specification
    • Writing analysis documents
    • Writing design documents
    • Writing code
    • White-box testing code
    • Black-box testing testing
    • Unit testing code
    • Integration testing code
    • Acceptance-testing the product
    • Writing test specification for each of the test steps

    And, of course, for each document (specification, code as well as test code and its result) produced, a FORMAL REVIEW of that document also counts as a step in the process.

    One rule-of-thumb I've learnt is that each step in the process cuts the number of remaining bugs to half. (A bug found in the specification might cause 10000 bugs to be detected in testing).

    Thus, assuming that a 64kloc program must contain less than one bug, at least 16 steps must be involved.

    /FLu

    1. Re:Add more steps to the process! by cheeto · · Score: 1

      Some bugs should (unless you're coding Space Shuttle Software) never be fixed; The hazzle they cause for some users will never justify the cost of fixing the bugs.

      Actually, we do leave some bugs in the Shuttle software for exactly that reason. Characters on the display that are shifted over one position. Errors that are three failures deep that will cause a 0.001 degree error on a display-only function.

      Most of the time we will write a user note for these bugs.

      It's kind of like the saying: "There's no such thing as minor surgery."

      --
      - "Sweet merciful crap!" Homer J. Simpson
    2. Re:Add more steps to the process! by Flu · · Score: 1
      Actually, we do leave some bugs in the Shuttle software for exactly that reason

      At first I actually got surprised by you saying that the Shuttle does have bugs, but I quickly realized that my own wording of course applies to your development as well! :-)

      I guess I got blinded by a quote made by my lecturer in SW Quality at the time, who claimed that the difference between a Level-4 and a Level-5 shop is that Level-4 can produce SW with very few bugs, and Level-5 can warrant that the SW is bug-free.

      /FLu
      Software Designer

  95. There is no good way to test a program by alenm · · Score: 1

    In my experience the best way to develop stable code is over time. There is no way you can ship something 100% bug free the first time. Deploy the code in the real environment and weed out the bugs one by one. So never expect to make something bug free. You can make something 95 % bug free if you plan and execute really good before you deploy, but the last 5% will cost you as much as the first 95% belive me. For some companies the last 5% is important enough to justify the cost (any rocket engineers here?). The problem is that a test with 1 person is not the same with 10 dumb users doing totaly insane things to your program.

  96. Evaluate your test suite for coverage by pfdietz · · Score: 2, Informative

    One thing I've found invaluable is to compile your program with a translator that inserts code to detect when branches have been followed. Then run the test suite and see that all the code was executed. Any code that was not executed has not been tested.

    It's amazing how poor coverage can be with a naively written set of tests. Ideally you want to write the tests so that the coverage comes out good, but in practice you may have to patch the tests with more tests to cover the parts you missed. You may also have to change the code to make it easier to cover.

    Rare error cases (like malloc failures) can be hard to cover.

    1. Re:Evaluate your test suite for coverage by bluGill · · Score: 2

      That sounds good until your realize the uncovered code path is only executed when the machine is on fire as a last message before it dies... A cheap machine is no problem of course, but management frowns physically destroying a million dollar computer for single test, especcially if there are several different cases like that.

      If there is a bug it is worse yet, becuase you have to fix the bug, and destroy anouther machine to test. Code reviews and careful programing are a must in this case. (See my other posts for how bad my code reviews are though...)

      Fortunatly things are not normally that bad, I have got a special board that generates bad parity, install that board, and see what happens. However there are over 100 different hardware problems I'm responsible for catching, and there isn't money for 100 boards exach destroied in some way. I only got a parity error board because that board went bad at a customers site and it wasn't detected correctly.

  97. Writing Tests First by Anonymous Coward · · Score: 0

    One technique that I have found very useful is to write test programs before you write the main program. Verify the test program via code review, and ensure that it catches as many problems as reasonably possible.

    Example: suppose you have a file format A, and your program is supposed to work on it and produce a file in format B. Write a program that takes files of format B and ensures that they make sense. Then also write a program that compares files of format A and B against each other and makes sure they are "equivalent" in whichever way that makes sense.

    Next, develop a collection of files in format A and you have a good test bed. If your program is doing something wrong, chances are good that it will be caught soon by the test program.

    1. Re:Writing Tests First by ComaVN · · Score: 1

      Then also write a program that compares files of format A and B against each other and makes sure they are "equivalent" in whichever way that makes sense.
      You do realize that's usually as hard as writing the program itself, don't you? To check for equivalence, you most likely will have to translate either one to the other, or both to a third format.

      Write a program that takes files of format B and ensures that they make sense
      Whenever you use your own format X, you should have a tool that does this.

      --
      Be wary of any facts that confirm your opinion.
  98. PC board testing analogy by ortholattice · · Score: 4, Interesting

    A number of years back I wrote test programs for printed circuit boards. First you created a model for the board that simulated the logic circuits. You then wrote test patterns that were applied to the board's inputs, and the simulator model predicted the board's outputs. The inputs together with the predicted outputs were applied to a real board that you wanted to test, and if this test program passed you assumed that the PC board was good with a high degree of probability.

    One mode of the simulator allowed you to simulate faults that might occur on the board. The simplest kinds of faults were physical IC pins "stuck-at-zero" and "stuck-at-one" (these were the most common faults in real life), and if you wanted to be thorough you could also simulate "internal" faults down to the gate level.

    I worked in a contract test programming house, where the contract with the customer required us to produce a test program with a specified minimum level of fault coverage, usually just at the physical IC pin level to minimize cost of developing the program. This ranged from say 90% for cheaper commercial work to 99%+ for certain government contracts. With >95% coverage, the "real life" fault coverage was maybe one or two "dog pile" boards out of 1000 would pass the test program but fail a system test.

    The point of this is in that business, there was a clear objective measure of a test programs "quality". The measure wasn't perfect, but it was far better than just blindly writing a test program based on a "gut feel" for how the board should work. In addition, the test programmer had a clear, objective goal.

    I think a useful tool in the software business would be a measurement of the percent of lines of code that were actually run during the QA process, along with a log of those lines that were not run and not run. Often there are big chunks of code that only get triggered by very special conditions, and there is no way QA can guess those strange conditions. The standard QA process is very subjective; there is no objective measure of any kind as to how thorough the testing was, other than just documenting a list of features that were (often superficially) exercised.

    A more sophisticated tool could go beyond lines of code and into log the various logic combinations exercised in "if" statements, etc.

    Several years ago I wrote an experimental tool that did this for a specialized database programming language. Basically it rewrote the program with a logging call after each statement (and yes, the "QA version" ran very slowly). The results were quite eye-opening, revealing chunks of "dead code" and conditions no one ever thought of testing. Unfortunately the project kind of died.

    Many languages have "code profilers" that are mainly intended to analyze performance, but many of them could be easily adapted to become QA quality measurement tools.

    Do these kinds of tools exist, and if so why aren't they more widely used?

    1. Re:PC board testing analogy by diathesis · · Score: 1

      These are usually called 'Coverage' or 'Test Coverage' tools. They do certain exist, although I hate to say that I haven't used one myself yet, so I can't comment on their efficacy.

    2. Re:PC board testing analogy by Anonymous Coward · · Score: 0

      GCC (at least 3.1) comes with one, called gcov; I haven't used it either, but there's one that's free to play with.

    3. Re:PC board testing analogy by bluebomber · · Score: 2
      Excellent analogy!

      Do these kinds of tools exist, and if so why aren't they more widely used?
      Yes, they're called "coverage analyzers" or something similar. A couple of tools that I've used in the past (for c/c++):
      • PureCoverage from Rational. It's been a few years since I've used this, but it was handy to have. Basically, you compile the code with special instrumentation and then run the PureCoverage tool which brings up a window showing (among other possibilities) functions, lines, and number of times each was called/executed.
      • gcov (part of gcc). This provides the same basic functionality as PureCoverage but doesn't give the pretty windows (duh).

      These types of tools can also be useful for performance tuning (with gcc, gperf is also handy).
    4. Re:PC board testing analogy by andrew+cooke · · Score: 1

      Yes, they exist (at least for some languages) - search for "code coverage tools" on google

      --
      http://www.acooke.org
  99. Evolve the Tests by 4of12 · · Score: 2

    Sure, build a big suite of tests to run and check for things to go wrong. Every bug fixing process suggests it own test.

    Then you find out that you don't have the time and resources to run all the tests everytime someone makes a change to the codebase.

    So, use smaller suites of the faster tests and weed out some of the ones that have been ironclad passes for the last 5 dozen code checkins. For frequent testing it makes sense to only shake what's new and rickety, not what's stood through 10 hurricanes.

    Run the exhaustive complete test suite infrequently, say when a release is imminent, or as often as you can afford to spare the resource cycles.

    --
    "Provided by the management for your protection."
  100. Architecture Problems by peterdaly · · Score: 2

    If you test the code as much as you says you do, and are testing for the correct thing (which I do not know you are doing) the problem may be the architecture.

    Code which is "forced" into a paper architecture is sometime worse that code with no architecture at all. In many of my projects, parts of my architecture change part way through so that the code will work better. Sometime not everything can be thought of before hand. OO programs have a lot of information to fit in a human barin at one time, problems are bound to show through. I don't have any "high eng tools" to help with the architecture either, which doesn't help.

    Also, the architecture itself may suck.

    What kinds of problem are you having? I think you need to design test routines geared towards not letting the types of problems you currently have through. It is hard to have any specifics, since the post was so vague.

    -Pete

  101. never let development run the QA department. by Anonymous Coward · · Score: 0

    make QA independant from both development and operations, if you run the code in-house. Developers always SUCK at testing code, and they will rush stuff through Qa in order to meet deadlines.

  102. Typical Developer Responses by Black-Man · · Score: 1

    Most of the developers out there don't understand proper testing methodologies. Sad to say, most of QA doesn't understand either.

    Take for instance... load testing. A lot of places I have worked for didn't have the proper environment setup to even come close to doing load testing. And how is "developer testing" and "taking more walks" going to help this???

    This attitude is now starting to creep into other areas - other than software companies - and into real-time or 24/7 type systems. Bad mistake.

  103. Don't Ask Slashdot, read the stories by Dusabre · · Score: 1

    This is an Ask Slashdot?

    Wasn't there a fragging story about this yesterday which stated exactly why code sucks? And didn't that story contain the answer?

  104. very large quantity of data by oliverthered · · Score: 2

    The idea is to build up the level of test data you have,
    You could have somthing that generats loads of test data , and use a simple script to check that it's data is ok, and even see what happens when bad data is fed in.

    If someone one finds a bug, they generate test cases(and variants).

    UAT testing should generate loads of data.

    An live envoriemts give you loads of data for full-cycle developments.

    --
    thank God the internet isn't a human right.
  105. Seeings that people always blame stupid users... by j_stirk · · Score: 1

    Get a pack of users stupid enough to do the testing for free... And leave them to it... At least then you are testing for bugs with the 5% of people who do the things stupid enough to cause the esoteric ones...

    --
    [root@GRIFFIN root]# rpm -e coffee-1.22.3-1a.i386.rpm
    error: removing these packages would break dependencies:
  106. Book Recommendations? by scott1853 · · Score: 2

    You seem to know what you're talking about, so are there any good books that cover the software design process? A book that covers what should be flowcharted and how detailed it needs to be, as well as writing good specifications and what should be contained in them?

    1. Re:Book Recommendations? by SarcasticTester · · Score: 1

      How about Testing Computer Software?? However I have to say that 'Rapid Testing' did me more good, as did 'Lessons learned in software testing'

      --
      We're all out there, somewhere, waiting to happen.
    2. Re:Book Recommendations? by scott1853 · · Score: 1

      I'd rather have something about the design process. I'm a believer that the code I right can be 99.9% stable if I do it right the first time. Testing is for other people. I have to write the code which means I'm not going to be the ideal tester because I already know the implied limits of what I've written can do.

    3. Re:Book Recommendations? by SarcasticTester · · Score: 1

      If you believe your code can be 99.9% stable if you do it right the first time I'd have to say you are somewhat naive, also if your assumption is true, why do you still need books about a design process if you already think you can do it? Invite an experienced tester to test your code full-scale (so design-review, code review and all level testing) and you may find out where some flaws in your design are. Since I don't like coding I cannot help you with a title for a good design process. Unless of course you don't have 'Design Patterns' yet. good book, helped dev at my former company a lot in gaining somewhat stable code at quite an early stage in the development cycle...

      --
      We're all out there, somewhere, waiting to happen.
    4. Re:Book Recommendations? by scott1853 · · Score: 2

      I didn't say I consistently write code that's 99.9% bug free. I just believe I can if I'm awake and focused and not getting interrupted every few minutes. Of course isn't hubris one of the three programmer's virtues?

      But the problem I face at my company is that nothing is fully planned ahead of time, which means that down the road we may run across some fundamental design flaw that require completely changing several modules. Which in turn usually results in bugs. That's what I'd like to avoid.

      I think the biggest problem is convincing the boss to sit down and fully plan his ideas before asking software to be written for it. So maybe a book on upper management mental manipulation would be better.

    5. Re:Book Recommendations? by SarcasticTester · · Score: 1

      I was just 'pullin your leg'. I know and understand your problem. We usually have the same kind of troubles here at my new company. Our CEO keeps changing his mind along the projects. Really annoying and makes it really hard for me as a tester to plan ahead, let alone for dev. But like I said. The only title I know as being anything worth while is Design Patterns. But trust me when I say that having a third party, like an experienced tester, review the designs already takes out quite some problems. If you have testers at your CO Use 'em and abuse em! Test early and test often as XP says! So have them do some early stage reviews for you...

      --
      We're all out there, somewhere, waiting to happen.
    6. Re:Book Recommendations? by scott1853 · · Score: 1

      I'll look for that book. Thanks.

      Unfortunately, my company employs 4 people. 2 programmers, a bookkeeper and the president. I'm one of the programmers, but I'm also tech support and graphic/web designer. So while I'd like to throw stuff to some quality testers, it usually just ends up in the hands of the customers :(

    7. Re:Book Recommendations? by dubl-u · · Score: 2

      Please note that you are asking a question similar to "Are there any good books that cover the process of living? You know, what it's all about, and particularly what rituals to follow for success?" You are likely to get religious answers to religious questions.

      For a good overview of development practices, though, pick up McConnell's Rapid Development . The main thing to come along since then is the various agile processes like XP. For the scoop on that, pick up Extreme Programming Installed . (Don't get Beck's book, Extreme Programming Explained to start with; it's a manifesto, not a practical book.)

      As with religion, you should probably ignore the people who claim to have The Answer ("Use UML!" "Use XP!" "The word of the Architect shall be as law, and you verily must smite the coders who stray from it." "Only infidels use COBOL/VB/C++/Java!" "There shall be no editor but Emacs!").

      Instead look at it more like home maintenance or martial arts. Is a screwdriver better or worse than a hammer? Is a punch better than a kick? Those questions can be entertaining, but they are never helpful. The right questions are more subtle: "Given the problem I'm facing, what tools might help? How should I adapt them to the situation? And how can I tell when they help rather than hinder?"

    8. Re:Book Recommendations? by SarcasticTester · · Score: 1

      Ok, last piece of advise from my side than. Do you guys use Unit testing ? Avoids a lot of problems as wel. and since you only have to developers, try working in some XP ideas. That really boosts the quality of work if you do it right! I, along with a developer, introduced our former company to XP and our bug counts went down and the productivity went sky high! so try it, have a look at: http://jibe.sourceforge.org and http://XProgramming.org Jibe might help you forward somewhat... is one of our opensource projects, started it some time ago and we use it extensively, unfortunately only one active external developer at the moment though... :(

      --
      We're all out there, somewhere, waiting to happen.
    9. Re:Book Recommendations? by scott1853 · · Score: 1

      Hey wow, better advice than an Ask Slashdot response. Thanks again, I'll check it out.

      We keep saying that we'll do unit tests but never get around to it.

    10. Re:Book Recommendations? by scott1853 · · Score: 1

      Thanks. More great recommendations. I remember looking at that Rapid Development book before and I was going to go and pick up a copy but I completely forgot about it.

    11. Re:Book Recommendations? by dubl-u · · Score: 2

      But the problem I face at my company is that nothing is fully planned ahead of time [...] Which in turn usually results in bugs. That's what I'd like to avoid. [...] I think the biggest problem is convincing the boss to sit down and fully plan his ideas before asking software to be written for it.

      That's one possible solution. If your development process can't handle changing requirements, either you can a) suppress all changes after the first requirements are given, or b) change your development process to handle mutating requirements well.

      Both can work, but they have different cost/benefit profiles. You might chat with your boss about how much business value could be gained from reducing time spent in the analysis phase, and adapting more quickly to the business environment. Then you can balance this against the costs of using a more flexible process.

      I can do either, but personally I enjoy the flexible approach more. I get so tired of telling users no.

    12. Re:Book Recommendations? by SarcasticTester · · Score: 1

      If you have questions about either one, or of course about some hard core testing, let me know (mail plz). I am always willing to help out ppl. Good luck with it all! and remember: We, in a software developing company, ship latent bugs at a rate in the range of 0.2 to 20 per 1000 delivered source instructions.

      --
      We're all out there, somewhere, waiting to happen.
  107. There is never enough time!!! by MisterDuncan · · Score: 1
    In my experience of testing (in my 3rd role now in Telecoms, my first 2 were in e-commerce), the project planning never, ever allows enough time for proper testing. To make matters worse, the development invariably over-runs, the deadline cannot move and testing time gets squeezed down to a fraction of it's original time.

    In an ideal world, testing should be budgeted an equal amount of time to development. If a project will take 10 man-weeks to develop, 10 man-weeks of testing time should be budgeted. When you take into account the planning, execution, documentation, retesting, user acceptance testing and any load/performance testing applicable, this time is soon eaten up. The main obstacles stopping this from happening are: a) The project planners are often naive to the testing process. They see testing a s a quick one-day job to prove that the product works! (I have seen project plans that allocate 1 day of testing for 2 weeks of development work). b) The customer cannot justify the expense of testing. This is very common. Mr Customer will often ask: "Why do we need so much testing? Are the developers not capable of writing quality code?". c) Testers are often not viewed as a valued resource. I have often worked on projects where testing time has been added to increase the billable amount on a project, instead of ensuring the code works and conforms to the specification. d)As highlighted by the some of the writers here, some developers honestly believe that testers are not necessary if the developer writes good code in the first place...........hello? I have worked with some very disciplined and talented developers. Every one of them makes silly mistakes. There is always some undocumented issue which causes some integration to fail. There is always some misinterpretation of the specification. It happens. You cannot avoid it ;).

    What follows is a not an comprehensive list of points, but merely a few pointers for how to ensure code is tested properly:

    Ensure enough time is budgeted

    Ensure the customer is aware of development process and the importance of testing. If they are not willing to pay for so much testing, bill it under development (It is part of the same process, why bill separately at all?)

    If the code differs from the spec, document and communicate the changes. I have experienced many delays and problems during testing due to undocumented changes.

    Ensure that the developers communicate with the testers. I have always found that working in the same area as the developers works best. It also helps avoid any 'them and us' situations.

    Project managers: Be serious about testing. Your company and your job will be judged on the quality of your product. The low quoted price and the fact you met your deadline will mean nothing if the product is unstable and has not met the customer's specification. If the project will over-run, let it over-run. Don't shave off testing time to meet the deadline. It will come back and bite you on the ass very quickly!

    Be honest with your customer. let them see the bug lists. Help them understand the issues. The customer will respect you more and you will be far more likely to reach that inevitable deadline extension in an amicable manner!

  108. Test scheduling by kfsone · · Score: 1

    How do you determine how complex a software system is? Are a dozen relatively simple routines a complex system, or is the complexity weighed by how they are employed?

    The complexity of a piece of software deeply affects how it should be tested. Most software is modular and must thus be tested modularly. It can pay to start by using an automated testing system which requires functions to declare their modus-operandi, specifying constraints and boundary results, such that the testing software can determine a functional hierarchy in which to test program functionality.

    But if you're not talking commercial, highgrade custom development, then the designers and developers need to keep testing in mind before, during and after their stages of the process. If you are one of those developers blessed with the ability to go straight from concept to code, testing is just one more system component you have to mentally track: the testing stack, or some such device.

    Testing an entire system won't work - it will generate huge quantities of bugs - unless you have a testing methodology that is based on the model used to actually code the system. If your word processor works in bytes and somehow gets into writing two bytes at a time instead of one, all kinds of other problems will ensue.

    While most testers do understand the concept of modular testing, its the notion of aligning the modularity of testing with the modularity of the code that most developers *and* most testers fail to recognise. The solution: design, develop and implement with testing in mind.

    --
    -- A change is as good as a reboot.
  109. code reviews, real-life testing, incorrect data by MSUWalt · · Score: 1

    Code reviews are fine as long as you have somebody looking for bugs and quality of code and not some anal retentive jerk who thinks their way is the only way. I agree that code reviews can help eliminate errors by newbie programmers, but that tend to cause general disgruntlement among those who know what they're doing. The reduction in cost for bug fixes can be offset by the increase in cost from your experienced people sitting around angry.

    No matter how much testing you do, the best testers are customers. I've worked on projects that passed testing by myself and three other levels, only to have it go squirrely at the customer site, usually because somebody doesn't know what they're doing, or that particular customer is the one company in the industry to do things just a little bit differently. Real customer data is sometimes the only thing that will cause a bug. For those of you in support, think of the number of times you've had to work for a week to replicate a bug reported by a customer.

    There's also the definition of "bug". If a programmer gets a requirement document, and his code does what the document said, then erroneous results are due to the "garbage in, garbage out" rule, not due to faulty code. This was all too common at my last job. We did insurance software (some still do), and between all the tech folks and the customers was a thin layer of insurance professionals who knew NOTHING about software and refused to learn. It's hard to get good code without good requirements gathering, and it's hard to get good requirements gathering without people who understand the importance of it.

  110. Testing ? by Anonymous Coward · · Score: 0

    Well,

    actually the best way (but admitted overkill) would be, to formal proof every algorithm is correct. Then again, this would consume so much time, nobody really does it. Clean specifications, Proper planing etc. help alot (as mentioned by others). Linear Regressions Tests, good test samples (Which should be done by other people than programers, cuz progrmers NEVER think of ALL the strange DAU minds, which might wreck the software. This leads us to betatesters, I personally experienced that letting a complete idiot use your program shows you ways of use (abuse? :-) you would have NEVER thought of.

    Many people think, software developing is a cycle of programing followed by debugging, if debugging is meant to remove errors, programing obviously is for ???? :-)

    A common problem is: Hack the code, see if it compiles, see if it crashes, fix it. Actually one should avoid this attitude and in the first place think about the algortihms, check em, etc. before one starts the implementation.

  111. Priorities? by Anonymous Coward · · Score: 0

    People seem to think that good testing means fewer bugs. That is a myth. Even perfect testing that reveals every bug could still result with highly faulty software if the vendors decide THIS BUG ISN'T IMPORTANT ENOUGH TO FIX. The priority of shipping seems to press harder than the priority to fix problems. Ship it now and provide a patch tomorrow. Though when tomorrow comes, oops, we're too busy on the next version.

    Proper testing is vital, but only when the bug database is actually emptied as fixes are made should we expect a rise in software quality as a result to even better testing. Assuming all reported bugs are fixed before new deliveries are made, software would still be bad but not nearly as bad as it is now. (There are just too many bad programmers who actually think they did learn to program in 14 days.)

    Next, we need to teach customers to stop demanding new products that don't work, from demanding them before they're ready, and from expecting the impossible. The weak economy is fuel for the customer to be calling the shots, and companies may be agreeing to deliver software on a timeline that just isn't feasible, simply to keep business rolling. Naturally, even without great insight, it's easy to forecast the quality of such endeavors. C-R-A-P

    1. Re:Priorities? by bluGill · · Score: 2

      Unfortunatly i've come to agree that some bugs are not important enough. I have some in my code that the customer will never see just by following directions exactly, and even if seen it is a minor problem to the customer. To fix the problem though would require a major design change, and when we want to ship in 3 months there isn't time for that level of change to the code.

  112. My best way by Anonymous Coward · · Score: 0

    > What is the best way to get the biggest bang for your testing buck?

    The first step to reduce testing efforts is to use a good design and a good language.

    Since I switched from C/C++ to Ada 95 my development time reduced to about the half. Ada 95 educates to disciplined programming and the excellent GNAT compilers find many semantic errors which helps to reduce the need for testing efforts.

    http://www.adapower.com
    http://www.gnat.com
    ht tp://libre.act-europe.fr/

  113. Try programming in pairs by horse · · Score: 1

    No, it's not magic, but we have found it makes a HUGE difference in code quality. In combination with regression test scripts, it helps a lot.

    The thing about programming in pairs is that it dramatically improves general code design/implementation, and that has a big effect on bugs.

  114. PHB's cause bugs by Anonymous Coward · · Score: 1, Insightful

    I need "insert feature here" implemented in "insesert program here" done yesterday. I promised "insert very large client here" that we would be able to add these new features and still be on time with delivery.

  115. Yes, there is a thing as too much testing by pnuema · · Score: 1

    First, I'm willing to bet that your development organization is too large. The best code is usually produced by a small team of developers. Too many cooks spoil the soup kind of thing.

    Second, yes, there is such a thing as too much testing. QA Managers have a real problem to deal with - they can catch 85% of bugs with x amount of effort. However, getting that last 15% becomes exponentially harder. QA Managers often have to make the decision to let the last 10% go, because the effort to find them just is not cost effective (i.e. to test a build to 85% takes three weeks, to 99% takes a year kind of thing).

    Without knowing jack about your situation, I'd guess the problem is in your process somewhere - too much of it most likely. Too many developers, too bureaucratic of a QA process, could be many things. just my $.02

  116. XP Style uUnit tests by sjmgaut · · Score: 1

    Doing unit tests "XP Style" is a good way to solve the How-much-is-too-much problem because you'll write most of you unit tests before actually coding the implementation. Your tests will reflect the specification/requirement of the users, not more, not less.

    And because "XP Style" unit tests are generated automatically on a regular (and frequent) basis. It will prevent you from reintroducing "old bugs" as you change the actual code. That will help you to keep your defects in code closer to zero.

  117. Methodology and testing by southpolesammy · · Score: 3, Insightful

    A lot of the problem may rely on what methodology you are using to code the program, whether it is the traditional waterfall method, or the sprial method, or perhaps M$'s old sync-and-stabilize method. Whatever methodology you use will drive how you should be testing.

    With the waterfall model, you really need to know way ahead of time that what you are coding is what will be desired in the end product. It forces you to have a clear picture in your model of what you are trying to build and with each step in the process, you must develop testing procedures that address that level of the code. For example, at a high level, you may say, let's build a compiler, and following that decision, you need to devise a test that proves that the compiler works. The next phase, you may say, let's build an assembler to produce machine code for the compiler. Then you need to build tests that prove that the assembler works. This methodology continues right down to the smallest module of code, and when all of the pieces have been written, integration testing begins, and you make sure that each larger piece can correctly function based on the output of the smaller piece.

    However, in the spiral model, it allows for a well-defined core code to be produced with tons of modules that evolve as the spiral expands. Integration is a function of the spiral, and testing occurs within each iteration of the spiral loop. Code produced with the spiral model also tends to be somewhat more difficult to test in later stages, IMHO, due to the nature of the testing that occurs at each cycle in the loop. Testing becomes more critical in later stages as the previous stages become more nested into the core of the program.

    Well, enough Software Engineering for one day. Back to work....

    --
    Rule #1 -- Politics always trumps technology.
  118. Less bugs GUARANTEE by notany · · Score: 1

    Use these rules:

    1. Write less code. Line not written is line without bugs. Don't use languages that make you write lot low level code.

    2. Write programs that write code. Write your onwn program specific language or make language framework that generates the code you need. Less human written code is good.
    Investments into good code generators and frameworks pays off.

    3. Use the most highest level language possible. Pyhton, Lisp, Haskell, others.
    Use many languages if needed. Only 1-10% of code should be human written written in C, Java, C++.

    4. Code bottom up. First code utilities, libraries, language-extensions, languages etc. until you can write your applications with these building blocks easily and with less code.

    5. Work with the best! Don't hire code monkeys. Hire only from the top (1-5%) programmers. Less is more.
    Hire 50% less programmers. Pay them 300% more!
    Most employers want medicore programmers writing medicore and verbose code that looks nice with UML. That's because they want to be able to replace programmesrs easily and they can hire lots of them. They feel secure that way.

    Dont work with programmers who can't read code! This is really common problem nowdays. People just don't have concentration to read code trough, line by line.

    --
    Dyslexics have more fnu.
    1. Re:Less bugs GUARANTEE by groomed · · Score: 1
      No, use these rules!
      1. Write as much code as possible yourself. This way it snugly fits the requirements and you can absolutely verify its accuracy. Specialize as much as reasonably possible.
      2. Avoid automatic code generation and specialized languages. You will end up with huge swaths of completely unreadable code that is impossible to understand and often unnecessarily inefficient.
      3. Use the lowest level language feasible. Keep control over as much as you can afford. This is an investment that starts to pay off once libraries and auxiliary utilities start changing underneath you.
      4. Code top-down. Work towards solving the most demanding problems first, and factor frequently used functions into functional modules later. It is no use writing code to anticipate a situation that you will never encounter.
      5. Work with the best!
      Just another perspective.
  119. Keep an archive by Iscariot_ · · Score: 1

    Make sure your company keeps an archive of already tested code. This way, you don't have to retest everything you release (which takes up a lot of time). In a "get it done yesterday" market like advertising, this can be the difference between success and failure.

  120. Re:best way to test is to use automated testing by Flamesplash · · Score: 2, Funny

    Maybe when we have quantum computers we can test every single user scenario in parallel

    -flamesplash

    --
    "Not knowing when the dawn will come, I open every door." - Emily Dickinson
  121. Measurement tricks and Organization Size by Anonymous Coward · · Score: 0
    I've worked as a consultant but most of my experience has beeen with smaller companies.
    If possible have the testers be different people than the developers. As mentioned in other posts cross developer checking helps also. In small organizations, this may not be feasible (due to limited staff).

    If you have separate testing and developers, it may make sense to try the follosing:
    1. Make a regression test set, so that reported bugs can be tested for in an automated fashion. This is especially effective if the output can be checked in an automated fashion. Developers should run this periodically (say overnight).
    2. Most errors occur in the seldom run pieces of code (since they tend to be least tested). Error/exception handlers are particularly susceptible to this. Using coverage analyzers (e.g. gcov or SUN's tcov) is typically a good thing.
    3. To measure the effectiveness of your testing group, software fault injection might help. The idea is to randomly add some known bugs to the software and see if the testing unit can detect the bugs. The percentage of known bugs detected gives some sense of what the overall detection rate is.
    4. Testing on different architectures and machines is important for finding uninitialized memory values and machine dependencies.
    5. Some classes of bugs are hard to detect, the ones I find hard are:
      1. Roundoff/discretization errors - they tend to start small and accumulate over time.
      2. Date routine errors - These routines tend to be a bit tricky and often don't trigger errors until the magic time arrives.
      3. Synchronization errors - Making events happen in the same order is hard
      4. Timing Errors - Among the hardest to reproduce.

  122. Let the User's Do It by John+Hasler · · Score: 5, Funny

    "When testing code, what procedures work best for you,..."

    Make sure it compiles and runs and then upload it to Debian/unstable.

    (Yes, I'm joking).

    "...and do you feel that excessive testing hurts the development process at all?"

    If didn't hurt why would you label it "excessive"?

    --
    Warning: this article may contain humor, sarcasm, parody, and perhaps even irony. Read at your own risk.
  123. testing throughts by bons · · Score: 2

    The difference between testing expected inputs and possible inputs is that reality doesn't limit itself to expected inputs. Heck, Sometimes it doesn't even limit itself to possible inputs.

    Larger tests don't test more. What the large tests do is make sure everything works together. You need the small tests to make sure each piece actually works.

    The bigger the test, the more likely that your testing platform doesn't resemble production.

    There is a big difference between getting your test to run sucessfully and having bug free code.

    Chances are the test cases have nothing to do with hiow the users actually use the program. Chances are the programmer has never actually seen how a user uses the program. Chances are, the first time he does he'll go back to his computer and start cursing the user for not doing things the "right" way.

    If something breaks and you don't add that something to the test case you're asking for it to break again.

    Testing deserves powerhouse machines and sadistic maniacs who like to break code. People who want the tests to be sucessful and don't run them that often are obviously not going to be as nasty as the real world. Even the sadistic manic has a hard time being as nasty as the real world.

    Tests are less expensive than that production errors. But only if they find errors. Tests that prove the code works perfectly usually don't.

    No programmer likes to be told he made a mistake. On the other hand they love a challege. Make testing fun and brutal and it'll be much more productive than if you make it boring and painless.

  124. Good programers + Good QA process == Good Code by uberlinuxguy · · Score: 1

    Since no programmer is capable of producing perfect code, debugging/testing is a neccessary process. And as many people have already said, there is no such thing as too much testing. In the world of computers, testing/debugging is an always on going process. Code is only released to the public when it is determined that serious problems and/or when all of the known issues are dealt with. (Hence the nickname "undocumented feature" for bugs.)

    So possibly the best and most accurate response to how much testing you should do is one that relates to how good you think your programmers and QA processes are as well as how good they think they are. You will always see bugs and problems being reported when you release a piece of software to the public. The reason is that you have a huge amount of people looking at, playing with, and testing the limits of your code. The secret to creating a good QA and code testing process is not smacking your developers every time a bug comes in (although that does relieve some stress) or changing how much testing you do without regards to processes. The secret is to find out exactly how the person found the bug and incorporate that into your testing strategies.

    Also keep this little quote in mind that someone once told me, "A program is only as good/smart as the person(s) who wrote it." The reason you should keep this in mind is that programs, computers and anything else you can think of that interacts with your software was created by a human being. Thus, they are all subject to the flaws of human intelligence. Nothing and no one is perfect. It's when the imperfections mount to form a large mountain of problems that restructuring is in order.

    Summation: If it isn't broke, don't fix. But tweaking is always a good idea.

    --
    The Uber
    http://www.tulg.org/
    http://devurandom.livejournal.com/
  125. Less code is LESS bugs by warhaeden · · Score: 1

    Your development team should not be writing code for a single task. Code for a specific task / requirement is by its very nature, bug filled code. All code should be written to be re-usable code. Once the re-usable, library routines are written and debugged, simply reuse that code as it will not introduce additional bugs into the system. The only part of the application that would not be library routines is the "glue" code that maps the interface to those routines.

    --
    This was a real question from a job interview! Q: What area of programming do you consider yourself not to be good in?
  126. Mostly Harmless by el_jake · · Score: 1

    "A common mistake that people make when trying to design something
    completely foolproof was to underestimate the ingenuity of complete fools."
    - Douglas Adams, Mostly Harmless, 1992

    Mr. Adams is right, you can't completely avoid errors !

    But a good approach to (near) failsafe software is to let non software engineers/pros test your solution, because they allways end up doing something completely foolish and crash the app.

    Jake.

    --
    In order to form an immaculate member of a flock of sheep one must, above all, be a sheep.
  127. The point of testing is to FIND the bugs by alanjstr · · Score: 2

    If you're not finding the bugs, then you're not doing a good job testing.

  128. hardware verification automation by guybarr · · Score: 1

    for automation of some parts of the verification process in hardware see:

    http://www.verisity.com

    software and hardware verification share much in common. Actually the product is used to test itself.

    (disclaimer!! I was an employee of verisity , before turning to other areas, and continue to hold her stock )

    --
    Working for necessity's mother.
  129. testing does not cure sloppyness by Anonymous Coward · · Score: 0

    A good testing approach does not cure automagically bad code.

    If you guys have means to tie defects not only back to the parts of the system, but also to specific builds then you should be able to link bugs with teams or persons. This info could be used to establish e.g. peer pressure with the goal of fostering an environment where dilligence and low defect rate is valued and their advantages can be seen (e.g. less time wasted on last minute integration bugs).

    Be glad that you have a good QA process in place. Now you need to integrate the results of the QA process back into the development process.

  130. Testing? by Anonymous Coward · · Score: 0

    What's that?

    How does that fit into the Big Ball of Mud programming?

  131. I find that.. by MarvinMouse · · Score: 2, Interesting

    When I code programs that are used by the general public. I find double-blind testing, and black-box testing works best. With software that means life or death or something severe I will also do white-box testing.

    double-blind testing is when you give the code to a willing party and just let them work with it like they normally would for business purposes, without letting them know it is a beta testing. You have to also include some type of bug report that people can fill in if they wish, but try to encourage them not to cause bugs, and just work with the program as if it was normal. This allows you to see if any of the normal functions that people use everyday would be buggy.

    Black-box testing works great to Just test the programs function calls and modules. When I do BBTesting I usually give it to another party with instructions as to how the functions are called and utilized. This party knows how to test the extremes and the common values and give me the best testing.

    White-box testing is testing that involves intricate knowledge of the code. When I do this it is usually in development. At the end, if I feel like I enjoy pain I will do a through white-box testing suite for the program, but that has only happened once or twice.

    In expenses, the cheapest form of testing is BB testing, followed by Double Blind, and then WB. Since white box testing takes a long time to design run and analyze the results I find.

    There's some thoughts for you though.

    --
    ~ kjrose
  132. More testing != Better Quality by Digital_Quartz · · Score: 5, Interesting

    There are two subjects I want to discuss here. First of all, I'm going to present the "jelly bean model" of defect discovery, then I'm going to talk about why the "testing to improve quality" model is fundamentally flawed.

    The Jelly Bean model goes like this: Let's suppose you have a big vat of red and blue jelly beans. Your objective is to remove all the blue beans. You do this by reaching in, grabing a hand full of beans, throwing away all the blue ones, and dumping the red ones back in.

    At the begining, it will be very easy to find the blue beans (assuming the blue-bean density is high), and towards the end, it will be very difficult (since the blue-bean density will be low). If you graph the cumulative number of blue beans you remove each day, you'll get a exponential curve; quite steep at the begining (high rate of discovery) and which flattens out as you approach total bean removal.

    Software defect discovery follows this model exactly. Defects are easy to find at the begining if there are a lot of them, and hard to find towards the end. This means that if your defect discovery rate is pretty much constant (with respect to the number of hours of testing you've done) then you're probably still way down in the very first part of the curve, and your number of defects is probably very high.

    Here's the important thing to remember though; the quality of your product has nothing to do with how many defects you find and fix during testing. The quality of your product is determined by the number of defects remaining! If you find and fix 10,000 problems, you might think you're doing very well, but if there are 10,000,000 defects remaining, your product is still crap.

    You can estimate the number of defects remaining by trying to fit the number of defects you've found so far onto that exponential graph I mentioned above. The most popular method to use a Weibull curve, or Quadradic Regression.

    Now, why is testing to improve quality a bad plan?

    Let's say you worked at Ford, and roughly 50% of the cars you turned out had something wrong with them. You get lots of unhappy customers demanding their money back. Is your problem:

    a) That you have a design defect in your car.
    b) That you are introducing defects in production.
    c) That you are testing cars insufficiently.

    Most people realize that to test every car as it comes off the line is futile. There's too many of them, with too many potential points of failure. There's no way you can test them all. The root cause of the problem has to be in either a or b, and if you're looking to improve the qulaity of your cars, this is where you would spend your money. This isn't to say that Ford doesn't test their cars, I'm sure they do, but testing should be a means of verifying quality (IE, 1/1000 cars tested had a defect, our goal was 1/500, so therefore we can stop spending money on finding design and production faults), and not a means of improving it.

    It's so easy to see this when we're talking about cars. Why does everyone get it backwards when we start talking about software?

    Not only is it impossible to test every possible combination of inputs to most software, it's also very expensive to find and fix problems this way. If you find a problem in design review, or code inspection, then you have your finger on it. You know EXACTLY where the defect is, and how to fix it. On the other hand, when you say "Microsoft Word crashes when I try to select a paragraph and make it Bold", you have no idea where the fault is. Any one of several thousand lines of code could be the problem. It can take literally days to track down and fix the defect.

    Your testing should not be a means of finding faults, but a means of verifying the quality of your product. Testing is not part of the development process.

  133. Fascinating! by MatthewDunbar · · Score: 2, Insightful
    Dear Egg,

    Thank you for your interesting and insightful treatise.

    Clearly, with your keen grasp of the history of programming, and your understanding of VB and HTML, you will someday make a fine salesman or mid-level manager. You already exhibit the skill and insight used by management at most companies to plan their projects, procedures, timelines, and budgetary requirements.

    Many programming issues would clearly benefit from simplification, and perhaps you are on to something. By reducing the number of tools a language attempts to implement, it clearly decreases the number of distractions for the programmer. If you wish to pursue this concept further, you may perhaps wish to research another foundational language called Logo.

    Good luck in your next class!

    Billbert, PhB, TFIC
    Redmond, WA

    P.S. - A side note regarding the original article:

    A firm understanding of your process for code development, and a clear design for your testing procedure are essential.

    If you spend some time in advance on planning, your code will benefit. Also, a good test plan should include a measure of the relative impact of a 'bug' or 'defect' to help determine priority of response by your programmers.

    By focusing on your programming objectives from the beginning, and maintaining that focus throughout your entire design lifecycle, you should be able to identify underlying problems in your current development model and use them to improve your entire process, with a goal of helping prevent errors in design, and catching errors in code before going to test.

    Peer review at each stage prior to testing (planning, functional design, algorithm design, coding, and test design) will also help catch errors in advance, and lead to the development of much better code. It may sound like it will take longer and cost more, but it saves time and money in the end in terms of not having to rewrite and maintain poorly implemented code.

    Cheers.

  134. Automated testing does indeed work by Junks+Jerzey · · Score: 2

    Though remember, this is Slashdot :) Automated testing is common in embedded systems programming, and all but non-existant for any kind of Open Source desktop applications (gcc is an exception).

    You write test cases as you go. You make sure you can run an automated regression test at any time. If you don't do this, then any time you change code you might break old code and you won't realize it. Just doing spot checks at the keyboard isn't good enough. And the programmers need to be writing these test cases first, and they need to be kept separate from tests written by external groups.

  135. Tried Cleanroom? by CyberGarp · · Score: 2, Informative

    My personal recommendation is the "Cleanroom" methodology. You create a functional specification with a mathematical guarantee of completeness and consistancy. Auditable correctness is also a part of the process. Then when it comes to testing you generate test cases that cover all states, all arcs and then do statistical test case generation based on a usage model. The overall cost of this process is a bit more up front, but studies have shown that the process far more than pays for itself in greatly reduced maintenance/debugging costs.

    So to answer you question is that to generate a decent set of test cases, you really have to understand the problem space and have mapped out the state-space in some manner. Trying to derive this without a methodical approach and ones testing will be spotty. The worst I've seen so far was a random state-space walker (ala Brownian motion). Statistically this approach avoids all the difficult cases in the far corners of the state-space.

    Now for the bad news: Cleanroom is quite tedious for the programmer. The enumeration phase takes seemingly forever and can be mind-numbingly boring.

    Here's the amazon link on the layman's book on Cleanroom: Cleanroom Software Engineering: Technology and Process by Stacy J. Prowell, Carmen J. Trammell,Richard C. Linger, Jesse H. Poore

    And now for the shameless self promotion bit with a long winded sales pitch for executives on Cleanroom: my own Cleanroom company: eLucidSoft.

    Just chant over and over: "Hire eLucid, play golf."

    --

    I used to wonder what was so holy about a silent night, now I have a child.
  136. Document your thought process by marko123 · · Score: 2, Insightful

    At the time that you are coding, every assumption is going through your head. This is time to write it down, either on paper, in a document, or in comments in the code. The mental state you are in when designing test conditions cannot come close to the state of mind you are in when coding (if you are concentrating :) . You are mentally closer to a problem when you are coding than when you are designing, and you can take the shortcomings of the platform you are working on and pair it with the shortcomings of the design.

    Any consideration you have during the writing of a single line of code is gold. And like a great dream, if you don't get it down when you think it, you will lose it in a day or two.

    My 2 cents.

    --
    http://pcblues.com - Digits and Wood
  137. zerg by Lord+Omlette · · Score: 2

    MSDN used to have a column called Stone's Way or something, and in one of them they discussed user case testing: set up a video camera to record the user as he/she uses the program OR masquerade as a nondeveloper and spy on the user as he/she uses the program.

    If you're just looking for regular bug testing, assume it's a given that the user will not report bugs to you and have the program automatically email you a core dump and/or stack trace and/or any appropriate data if an unhandled exception occurs.

    --
    [o]_O
  138. What's your methodology by anomaly · · Score: 2

    I work for a large company with a large number of internally developed applications.

    I am shocked at how frequently our developers don't have a good understanding of their architecture, or sometimes even the problem that they are trying to solve. As a result, when they go do do "testing" they are frequently performing tests that are not valid.

    For example, they might create a new build and test that build only on their development workstation before full deployment of the application.

    Naturally the development box has different resources from that of a standard production machine. Many developers don't seem to understand this.

    Another example - frequently boundary conditions, or interfaces to other applications are not fully tested.

    Using bad methodology, all of the time that you spend testing is wasted.

    Management tends to feel that testing time is wasted because their experience is that the time that they have invested in the past has been fruitless.

    Please develop:
    valid test cases,
    valid test plans, then

    execute them,
    find gaps, then

    use the gaps to learn how not to make the same mistakes in the future!

    Phooey.

    Anomaly
    PS - God loves you and longs for relationship with you. If you would like to know more about this, please contact me at tom_cooper at bigfoot dot com

    --
    But Herr Heisenberg, how does the electron know when I'm looking?
  139. Know the boundaries by Chacham · · Score: 1

    I think bounds checking is the main part.

    1) Find out what the program is supposed to do.
    2) Find out the exteremities for values.
    3) Test the extremeties.
    4) Test outside the extremities.

    For example. If a program asks someone to enter their age, you need to check for:

    1) something
    2) that is a number,
    3) that qualifies as an age.
    4) The lower boundary for an age is 0,
    5) the upper boundary should be unlimited.

    Test for the following.

    1) Entering nothing at all.
    2) Entering various non-number entries.
    3) Entering non-whole numbers.
    4) Enter 0, and negative numbers.
    5) Enter insanely large numbers.

    One failure of coders, is that they assume that entering data is only done through cannonized ways of the program. For example, they expect a user to use the keyboard, but don't take the clipboard into consideration. So, in case 3 above, the program may rely on a control to not accept keypressed decimals. And thus the program is "safe". However, if you can get it there from the clipboard, the program may break.

    So, when testing, you need try your hardest to enter bad data in order to test how the program deals with it.

    Another example. If the program is actually a web page, it may rely on a combo box to have only specific values. However, I can rewrite the page myself, and add any value I want. And, it gets even easier if the next page allows GETs.

    On another point, the test routines should be written *before* coding is done. If afterwards, you may only test what you already thought of fixing. If you force yourself to think of tests before the program was written, you have a good change of testing more.

  140. code reviews and test suites by rtphokie · · Score: 1

    Instituting a program of code reviews (best if done for everything including minor bug fixes, at least for major functionality additions) will catch a lot of stuff up front. But nothing gives a bigger bang for the buck that developing/purchasing an automated test facility that can run test suites that you develop. Still, those tests will only be as good as your test suites so use a code coverage tool from time to time to make sure you are doing thorough testing.

  141. Some Reference on the Limitation of Testing by mpsmps · · Score: 1

    If you want bug-free software, you won't get there just by testing. According to "DeMarco. Controlling Software Projects, Management, Measurement, and Evaluation. Yourdon Press, 1982", at least half of all bugs cannot be identified no matter how much testing is done. Another classic reference is "Thayer, Lipow, and Nelson. Software Reliability, A Study of Large Project Reality, North-Holland, 1978", which studies the residual bugs in a large programming project and concludes that even full path and parameter testing would not have identified about 30% of the bugs that were experienced in the field.

  142. Software Inspections by dwheeler · · Score: 2
    If you want to get rid of defects, you need to review your software. There are a lot of quantitative studies that show that software inspections (a particular way to do a peer review of software) are very effective at finding defects.

    Here are some experience reports showing software inspections to be effective: (1) G.W. Russell's "Experience with Inspection in Ultralarge-Scale Developments" (IEEE Software, Jan. 1991), (2) E.F. Weller's "Lessons from Three Years of Inspection Data" (IEEE Software, Sept. 1993), and (3) Grady and Van Slack's "Key Lessons in Achieving Widespread Inspection Use" (IEEE Software, July 1994).

    There are many other such articles; I'm highlighting the IEEE Software articles because they're easy to get. Full disclosure: I co-edited a book on software inspections, titled "Software Inspection: An Industry Best Practice" (IEEE Computer Science Press, 1996; edited by David A. Wheeler, Bill Brykczynski, and Reginald N. Meeson, Jr.). That book reprints the most interesting articles on software inspection of the time, many of which are quite hard to get hold of, as well as additional material not found elsewhere that gives you the "big picture." Unfortunately, that book is now out of print and getting increasingly hard to get, but you might be able to get a used copy (or convince IEEE to reprint it).

    --
    - David A. Wheeler (see my Secure Programming HOWTO)
  143. If you dont want to find any bugs in your code... by LordZardoz · · Score: 2

    Then dont test it. The problem isnt that the testing is reporting too many non-bugs. The fact that your finding a large number of bugs means simply that a large number of bugs exist. Less testing does not reduce the number of bugs in a program, it simply reduces the bug count.

    I will admit that bug testing often results in many non-bugs being reported. But that does not mean that testing is a bad thing. If anything, testing should be started as early as possible, and be carried out frequently. The earlier that bugs are found, the easier it is to fix them.

    END COMMUNICATION

  144. Design For Test and Earlier by technoCon · · Score: 1

    I think testing should considered at the very beginning of the software development cycle. When we decide "what" the software should do, we need to identify a way to prove to ourselves it happened and it was right. (Requirements.) When we decide "how" we'll implement our requirements, we need to identify a way to prove that design is working. (Design.) When we code, we need to identify the procedure we'll follow to make sure all of the above is proved correct.

    Personally, I prefer automated tests because testing always occurs at the end of the test cycle when deadlines are bearing down, and the pressure to put a fork in it is high. People under pressure are wont to do the least possible to get the job done. If testing is automated, it's relatively painless and quick, thus more testing occurs for unit time.

    Of course, if you want to automate testing of some GUI oriented program, you have to think about how you'll do that (scripting anyone?) at the early requirements and design phases. I try to put a scripting interface in every app I write so I can run a test batch file.

    If my characterization of the s/w devel process sounds too waterfallish, I'm sorry, I've been doing this for 20 years and I'm stuck in a rut.

    steve poling
    grand rapids, MI

  145. Re:Code Review (input from non-programmer!) by stnls_steel_mouse · · Score: 1

    While I am a developer, my wife is a graphics artist who did a lot of ad & copy writing for various catalog and advertising firms.

    She is still stupified at the idea of a programmer testing their own code. It was a firing offense at her firm to proofread your own copy and approve it. You always had to have another pair of eyes look over your work, since if you wrote it wrong, you would read it wrong when looking it over.

    Programs working fine on test data the programmer wrote, then crashing horribly, are so common as to be legendary.

    I have recently applied XP write tests first techniques to COBOL programs, of all things, and have been pleasantly surprised at how well it has worked.

  146. Test First! by Dragonshed · · Score: 1

    Methodologies like Test First have been gaining popularity, along with their supporting tools like JUnit and NUnit, to help solve the testing dilemna. Normally when you're coding strictly against the compiler, and perhaps some defined design, the only errors you'll see are compile time, and in the case of java or (insert scripting language here), run time errors. Logic and design errors are revealed through testing your software, usually in the form of unit and/or integration tests, figuring out if your software does what it's actually supposed to do.

    The Test First methodology actually takes this process one step further, elevating logic errors to the level of obviousness that compiler errors have. This is key, because it helps break the mindset of the assuming programmer that if it compiles, it must be fine.

    Unfortunately, the tools I've seen that support test first only work in the context of testing Java or .NET (C#, VB, etc) code. Because of the complexities involved, I doubt a generic CUnit or C++Unit could ever be engineered for generic distribution. The best support I've found is just to get the developers to think within the guidelines of test first.

    I personally think this methodology, like any other should be viewed as a possible tool to use to solve some problem, in your specific project environment and schedule and what have you. But thinking along the lines of trying to test your software before you build your software will help you to write more robust code.

    -ds

    References:
    http://www.junit.org/news/article/t est_first/
    http://junit.sf.net
    http://nunit.sf.n et

  147. Re:Test smarter, not harder? Test the components. by Anonymous Coward · · Score: 0

    Look at how complex mechanical products, like cars, are designed and tested. There are are vast number of components and subsystems in a car. Each component and is specified, and tested to its spec. If the component fails, redesign it, and test it again.

    Each subsystem is made up of tested components. Test the subsystems, to find any "bugs" that did not show up at component level. These are often specification bugs. Finally, put it all together, and test the whole car. At this stage, almost all the debugging has been done, so you do not get "millions of bugs".

    I think the software testing problems described in the question arise from doing all the testing at "whole car" level, instead of incrementally, as the code is written.

    • Bugs are much easier to find if you test early, rather than late.
    • Spend more time testing things that are fundamental to the whole operation, and less time on non-essential "bells and whistles".
    • Code and test the novel ideas first, as these represent the highest risk.
    • Design the whole project as a hierarchy of specifications and tests, so you can build a complex whole out of simple, tested, parts.

    By the way, I am an electronics engineer more than a software designer. I applied the above approach to a little C++ project for my own interest, and I found that applying electronic engineering methodology to the design and testing worked well for me.

    Glyn

  148. THERE'S ONLY ONE SOLUTION by jimdesu · · Score: 1

    Pardon the shouting, but I mean it. Testing as is mostly done in the coding shops is the detection of what bugs got introduced in the code. Quality code production doesn't mean finding the flaws, but keeping them from occurring in the first place. There is only one way to accomplish this, and that is to make testing a design criterion. There is no substitute for specifying design invariants and coding to assure them. This is where specification languages like Z come in handy, and why the Eiffel wankers are so in love with their language.

    All locating failures does is locate failures; it does not ensure success. The only way to ensure success of a system of any complexity is to define what correct operation is and ensure it. There are brainiacs from the planet Smartron-Five that are good enough at their formal logic to actually prove whether a piece of code is correct or not. That's great if you can do it, otherwise, you're stuck with ASSERTs or JUnit or somesuch. But you can't do any of that meaningfully without a rigorous understanding of what it truly means when you say "it works".

    --
    --- The reclining dragon deeply fears the blue pool's clarity.
  149. Do XP Unit Testing by sohp · · Score: 2

    It has to be said -- maybe if you did do XP-style unit testing you'd get better results?

  150. Post Review, Post Review, Post Review by Anonymous Coward · · Score: 0

    The halting problem is not NP-complete. The halting problem is undecidable which means no solution can exist (and problems in NP have a solution by definition).

    Proving two statements are the same is not equivalent to the halting problem in general. You can prove two statements equivalent either exhaustively (only if there's a finite number of cases!) or axiomatically as long as you don't run afoul of the Incompleteness theorem. However, the number of statements found to not be axiomatically deriveable is quite small and I've yet to see one in a computer program :)

  151. You shouldn't ignore your bugs by ggruschow · · Score: 1
    Yet the number of defects reported is so large that I wonder how much testing is too much? ... I wonder if the testing procedure itself may be part of the problem.

    The goal of testing is to find bugs. If you're finding lots of bugs, then the testing is being done at least passably.

    If the number of legitimate bugs is so large that you think your testing procedure is broken, the actual problem is that your development procedure is broken.

    The only case that your testing procedure is broken is if you want to ship bugs. There are cases where this is desirable, but it's really hard to get management to admit it in clear language.

    I'd seriously reconsider your development process first. At a bare minimum, read at least 3 of the following books:

    • Rapid Development by Steve McConnell
    • Mythical Man-Month by Fred Brooks
    • Peopleware by DeMarco & Lister
    • Code Complete by Steve McConnell
    An eXtreme Programming book wouldn't hurt either, but the XP recommendation is little more than "follow all the recommended practices religiously".

    The first thing you should learn from those books are that bugs cost an order of magnitude more to fix as they past through each stage in development. Further, bug fixes often introduce more bugs. This can easily leads to a project killing feedback cycle.

    After those notions are beat into your head, they'll clue you in to moe really useful truths. Here are a few examples:

    • The more people read the code, the more errors they'll catch -- meaning stepping through your own code in a debugger, code reviews, or pair programming.. this isn't telling you to open source your project.
    • Design things to be testable -- I've thrown out numerous designs just because they'd be hard to test.. Places where you think you need multithreaded or reentrant code are especially good things to reconsider. This can be extended to design things to past tests as in XP.
    • Programming requires concentration -- I learned long ago that any code I write past 8 hours in a day might as well be burnt later.
    • Programming is done in a chaotic world -- Virtually nobody has decent requirements up front, programmers get demotivated with distant goals, and people make design errors... all of this leads to emphasis on iterative development of some sort.
    If anybody in the Chicago area is in an organization that understands all of this, please let me know: gruschow_resume at yahoo.com
  152. Which level of bugs? by bluGill · · Score: 2

    My code comes back from test with three levels of bugs.

    Problem 1: A crashing processor doesn't show up on the GUI. Turns out that I told the GUI that a porcessor crashed, in testing I saw something come out on the command line, and didn't notice the mispelling, but the GUI didn't know what to do with it. Took longer to open the file than to fix the bug. These should all be fixed, unfortunatly they are all minor enough that if caught late in the test cycle they are defered.

    Problem 2: After causing failure A, failure B wasn't detected, it turns out the code to detect failure B is the same as failure A, and once A occures the code stops watching for B, even though the two are not related. This is a fundamental design problem, and can only be fixed by a re-write. (My excuse: someone else wrote the code and quit, I maintain it, but I have to impliment feature gamma before I can fix this problem...)

    Problem 3: Tester pulls the ethernet cable between two nodes, and the complains that we said the node broke instead of the ethernet cable. This can be fixed, but we need some other way of determining that the other node is still operational we just can't communicate with it.

    the first one is easy to fix, the second is solvable, but takes a lot of time, and the third can't be solved. When you come across the third, I hope you have better luck that me with people noticing the bold letters in your documentation noting that additional hardware is needed to solve that problem.

    1. Re:Which level of bugs? by gerardrj · · Score: 1

      Or just fix your code in #3 so that you state "communication lost to node B, please check the network and oprerating status of node B.

      Your code could even see if node B was still alive at any level:

      Is the remote Application responding?
      Is Node B responding to ICMP?
      will node b respond to a MAC broadcast or ARP request?
      Is the link up?
      Is node A (myself) responding to MAC/ARP requests?
      Am I responging to ICMP? Can I ping myself?
      Can I talk to myself on the port node B would be sending me data?

      This code could take a few hours to do well, but it would be portable to most any other network app you wrote.

      --
      Article X: The powers not delegated... by the Constitution...are reserved...to the people
  153. Test in small chunks by Cro+Magnon · · Score: 1

    I like to get something that compiles & runs ASAP, test what I have, add a little code & test that, add some more code & test that. That way, when something breaks, I know it's probably the last bit of code I added.

    --
    Slow down, cowboy! It has been 4 hours since you last posted. You must wait another few hours.
  154. The People Factor by Anonymous Coward · · Score: 0

    It's been long been understood that your biggest variable is PEOPLE. Process, is in comparison, a much weaker factor in the software development equation. A QA process that includes multiple-levels/stages of testing will only be as good at uncovering bugs as the quality of the test cases written (breadth and depth), the people that exercise them, and the tools that automate the task. But note, testing isn't meant to find bugs. V&V is intended to test adherence to requirements and conformance to specs.

    People possess/display varying levels of skill, motivation, knowledge, and self-discipline. If you want better software, then get better people. What do popular authors like McConnell and DeMarco write about? Why in there increasing demand for certification and professionalism?

  155. Testing is not supposed to....... by QueueEhGuy · · Score: 1

    Create defect free software. Too many people (developers, PMs and Clients) that I have worked for as a consultant think that. It doesn't matter how good your testing procedures are if there are no good procedures up to that point. I agree with those who have said that most defects are a result of poor communication, I've got the numbers to prove it. I also agree that sometimes developers are put on the defensive when testing takes place. Here's how I get around it: Create a logical flow of data from the people who create the requirements to the testers. Support it with documentation. (Use Cases, Object Models, Interaction Diagrams, etc) Build accountability into the process for everyone involved. This way everyone is clear who has what deliverable. Continuously check back with the business owners to make sure that you have a clear understanding of what they want, or at least they have repeatedly said that you do. (CYA!) Track each requirement though the process, from specification through testing and sign off. If your organization is small enough, let the developers sit in on the meetings where the original requirements are developed. I can't stress enough how well good communication reduces the number of defects. The fact of the matter is that defects will happen. They will not be as frequent, however, if you are able to track down the reason easily, as all involved parties will be getting feedback crucial to their development as a team.

  156. Some coding techniques. by lordmage · · Score: 1

    1. Use a compiler with all warnings turned on.
    2. Always have a default case in a switch statement, with a syslog or other line in it stating there is an error. Never rely on a default case either.
    3. Do in-range checking on the passed in variables BEFORE you act on them. Is the passed in variable too large? etc.
    4. string code always needs double checking (strcpy, strcat, strlen). Overwritting is a COMMON mistake.
    5. Be careful about simple things that should make sense but does not. sizeof a string returns 4 because its a pointer, but strlen of a string returns the length.. but the length of a string is actually one more than strlen tells you. So that means to allocate the correct memory you need strlen of the string +1. Simple, but serious errors happen due to this.

    Okay.. now there are common error URL's out there.. search them out and look at them.

    --
    I can program myself out of a Hello World Contest!!
  157. Re:best way to test is to use automated testing by EriondII · · Score: 1

    How well does this product work? Does it involve a lot of configuration? Do you have to devote someone to maintaining this? We use Rational Rose, but not this product and I would appreciate some feedback.

  158. Simple. by Anonymous Coward · · Score: 0

    Excessive testing is never bad for your defect rate. If you have unlimited time, test for as long as you need to. However, improper testing is time wasted. If you spend 99 hours testing, and 98 of them were done according to an ineffective testing policy, then you've really only spent 1 hour testing.

    In short, no, your problem isnt that you're testing too much, it's that you're testing wrong. Testing should be finding these defects, if it is not, your testing procedures are not sufficient.

  159. problem bigger than testing by Anonymous Coward · · Score: 0

    Good solid code isn't just about testing. It's about each engineers belief and effort to code to the highest standard. Without engineers that place quality as the first priority, you're never going to get bug free applications.

  160. Testing is essential, BUT... by William+Tanksley · · Score: 2

    From experience, we know that testing is essential for maintainable code, but the practice which REALLY catches defects is peer review, not testing.

    Two effective ways, both tried and true:

    1. Take your code to your coworkers (at most two at a time) and have them go over it with a checklist of common defects and goals. Then explain the code (while they still have the checklist, so they can make additions), then have them explain the problems they found. Look up "formal reviews" for more info.

    2. Pair program at all times. Follow the basic XP guidelines for this: be sure to rotate teams. This is usually harder to arrange than #1 (it takes more management support), and it doesn't provide recorded numbers for analysis, but it squashes a similar number of bugs, and has other benefits (for example, knowledge about every chunk of code is present with at least two people on the team, rather than just one).

    -Billy

  161. Design smart, Code smart, Test Smart by SloppyElvis · · Score: 2
    How could testing less possibly solve your problem!?

    Test smarter, not less. Many of the above posts have shrewdly indicated good method of preventing bugs (an ounce of prevention, anyone?), and below I have some ways you may want to consider in testing your software. Sadly, the poster didn't give a whole lot of information to go on, so this offering is a bit vague, I'm afraid.

    At our shop, we invest a good amount of time in developing test modules for all interfaces in the project, almost as much time as it takes to write the modules themselves. Every night, an automated build machine builds and installs the latest version from source control, and initiates a test script that invokes the test driver suite which loads and tests all public interfaces. Every function is tested with expected input versus expected output, and further by sending unexpected input (like that of a malicious user, or failed communication). All exceptions, assertions, and incorrect output is checked as well, as any memory leaks, by the C-runtime debugging utilities, and Bounds Checker will soon be in use as well.

    This approach serves 3 purposes:
    1. It readily finds crashes that human testers may not find, since it checks every public function with varietal input.
    2. It aids regression testing for modules that have been changed.
    3. It checks for leaks, which can cause problems that may be evident only after extended execution times (doesn't apply if your language is garbage collected)
    Further, by having an automated build every night (that emails everyone on the project, including the project manager, ehhem), developers are careful not to "break the build", and thus pay attention to details before committing their code.

    This method is only a preliminary test; however, and it cannot find every bug that may or may not exist. All code is audited to ensure it meets coding standards. You'd be surprised how failing to meet standards often evidences a piece of code that was written in haste, and as such, is a good place to looks for bugs. Also, we employ code testers who run the software through use cases (which are sequences of actions determined to be general ways in which users want to use the software). These testers also put the software through non-use cases, in which the actions do not follow expected sequences.

    I hate to point out the obvious, but it is important to test software freshly installed on "clean machines", not development machines.

    In the end, if it is at all possible, it is nice to have users who are in some way affiliated with the software company to give a "field test" so-to-speak on alpha and beta versions of the software. In any complex piece of software, there will be a chance for hard to find bugs (relative to the developer) to occur. Tolerant users are the best and last resort to finding any obscure bugs before the general public gets their click-happy hands on the software.

    Conclusion: design smart, code smart, follow standards, test smart, test everything, and track all bugs (as if that is news to anyone).
  162. bebugging by Martin+Spamer · · Score: 5, Insightful

    How can you be sure you are 'Properly Testing Your Code'?

    Actually you can do this by adding more bugs, yes adding them, The technique is called bebugging and the is basicly:

    1) Produce code, it contains an unknown number (N) of bugs.
    2) Programmer (or bebugger) seeds the code with a number (B) of known new bugs, the number and type of bugs should be determined from bugs found in previous debugging cycles.
    3) Code is submitted to testing and some bugs are found (F).
    3) The bugs found are examined and categorised as either real bugs (FN) or bebugs (FB).
    4) Number of real bugs (N) can be found as the ratio of found bebugs (FB) to unfound bebugs (F).
    5) Don't forget to remove all the bebugs.

    1. Re:bebugging by regen · · Score: 2
      Almost Right...
      4) Number of real bugs (N) can be found as the ratio of found bebugs (FB) to unfound bebugs (F)

      Should read:

      4) Estimate of number of real bugs (Estimate of N) can be found as the ratio of found bebugs (FB) to unfound bebugs (B) times the number of real bugs found (FN).

      4a) Testing can be considered complete when number of real bugs found (FN) equals Estimate of number of real bugs (Estimate of N).

    2. Re:bebugging by Crispy+Critters · · Score: 2
      Parent said
      seeds the code with a number (B) of known new bugs, the number and type of bugs should be determined from bugs found in previous debugging cycles.

      In other words, you are introducing bugs that you already know your testing can find. But you are assuming that any real bug is equally as easy to find as the bebugs. This may work if your app is full of really brain-dead errors, like buttons that don't do anything or menu selections that crash the app. It doesn't tell you anything about whether subtle errors are being found.

      Beware a fool armed with an equation.

  163. Same deal by tulmad · · Score: 1

    We're actually going through the same sort of questions right now where I work. In the process of testing a new piece of software, my small group has been finding defects in a piece of software that has been in our system for more than 4 years. That piece of software also controls our prime interface, the one that is pretty much the reason for our system. My group has decided that the only reason we're finding these bugs is that the the developers didn't do thorough enough testing the first time around. What happens is that someone writes some test cases, then only tests those cases. If the cases work, then the software passes and goes into the system. The problem is that test cases are never thorough enough, and never catch the really obscure bugs (like the ones we're finding).

    The trick is to not stick to test cases. Test everything you can possibly test in the time allowed. We've told management a number of times recently that we're trying not to stop until we have it as accurate as we think it can be. We're still under a fairly strict deadline, but they're allowing some slippage in order for us to get it right.

    --
    "In case of emergency, break glass. Scream. Bleed to death."
  164. Be like Microsoft by gwayne · · Score: 0, Redundant

    and let your customers do the testing/debugging for you!

  165. Don't become a slave to methodology by groomed · · Score: 1

    One thing that I've found to be useful in general is this: don't confuse the goal with the metric.

    It's fine to have a methodology in place to try and minimize the number of completely obvious faults and mistakes. But don't become a slave to the methodology. The user does not care that you have followed every rule in the book if in the end the program does not work.

    Mistakes can be costly. Guidelines help prevent some of them. But institute an elaborate framework to idiot-proof your development process and the world will build a better idiot.

  166. waterbed syndrome by OpenMind(tm) · · Score: 1

    One project I was working on made it pretty much impossible for the number of bugs to go down. The codebase was about 15 years old, about half a million lines of code, and maybe 10,000 global variables. Testing would identify a bug. A programmer would find the problem and fix it. Then three other features, wriiten years ago assuming that the bug was standard behavior, would break. The people fixing these bugs were often ignorant of the efforts of the last programmer, so as often as not the would go in and re-enable the old bug. Even if they didn't, their fix would break something else. Spaghetti code such as is common in some of these old code bases is often harder to debug than it would be to rewrite.

    1. Re:waterbed syndrome by gerardrj · · Score: 1

      Sounds like the bug here wasn't so much the code, but the process.

      Sending more people to hack on spagetti code is a waste of time. Leaving the running code running in a known state (perhaps with a known but survivable bug) would be my choice. Obviously the thing's been running for 15 years, it can't be that bad.
      Now... take all those people fixing these bugs and have them document the code. You know the standard stuff. identify the function of the variables, the parameters of the functions and return values, what gets input from where, and what gets output to where.
      Now graph/chart it.
      Before you fix ANY bug, you can look at the chart and identify all the ramifications of any change.
      In your documentatation you should for example be able to look up a variable, know what it does, and all the functions that take, or change that variable.

      The only reasons I can see continuing down your current path are ignorance or job security.

      You can then take all those "extra" people and start re-coding the functions and eliminating the globals. Perhaps port the entire application(s) to another language/platform.

      --
      Article X: The powers not delegated... by the Constitution...are reserved...to the people
    2. Re:waterbed syndrome by OpenMind(tm) · · Score: 1

      Well, this is not a project I'm working on any more, and management was dead-set against any real attempt to fix the problem. This was an application in use by customers, so they expected quick fixes for the bugs they found. The company was on the cheap side, so they didn't want to dedicate any staff time for the rewrite that the system desperately needed. I think applying modern programming practices would have taken it from ~500000 lines of code down to ~100000. They also denied any of my proposals to reorganize, document, or increase the quality of the codebase in any way. They were dead set on the test/bugfix paradigm. This might have something to do with the short period I chose to remain with the company.

  167. They aren't bugs... by Dave21212 · · Score: 1



    Tell the users that they are simply "Undocumented Features"



    (Ok, someone had to say it...)

    --
    "Whoever would overthrow the liberty of a nation must begin by subduing the freeness of speech."--Benjamin Franklin
  168. Re:bebugging - I actually do this... by Dave21212 · · Score: 1



    I actually do introduce, or leave in, certain bugs. It's not so much to get a definite percentage of bugs found or anything. I do it to get a feel for how extensive and how detailed the testing was performed.

    Amazingly, I was once asked to help fix a production application so I decided 'kick the tires' a bit. The very first button on the very first screen was broken...

    I'm glad none of *MY* (Lotus Notes) applications have these problems ;)



    (If a bug is embedded in a system, and no user ever triggers it, is it really a bug ?)

    --
    "Whoever would overthrow the liberty of a nation must begin by subduing the freeness of speech."--Benjamin Franklin
  169. Non-XP unit testing by aggressivepedestrian · · Score: 1

    What exactly is non-XP style unit testing? Unit testing is unit testing, regardless of your development methodology.

  170. testing by jacobm · · Score: 2

    Our testing philosophy:

    1. Test every branch. (This goes hand in hand with making sure you have small enough functions that they only have one or two branches apiece.) Sounds like overkill, but when you're writing a function it's easy, if a little dull, to write test cases for each branch. It's much harder to fix a bug in a given section of code if all you know is that one of the sixteen functions it calls has a bug, and that bug is in one of seven functions that code calls, etc.

    2. Maintain your test suite. Every test we've ever written is still in our test suite, and every time a bug comes in, that bug gets its own set of tests and goes into the suite.

    3. Run your test suite regularly.

    This works well for a lot of things; the big area in which it doesn't work is very complicated 'mathy' algorithms for which you don't really know what the correct answer ought to be other than by just running your program and seeing what pops out and stochastic algorithms. Stochastic algorithms in particular are a total bitch to test. But, for the other stuff, there's really no better solution.

    --
    -jacob
  171. Code Review AND testing by mughi · · Score: 2
    My experience has shown that the number one way to find defects is code reviews performed by other developers who can read the code and also understand the intended functionality. This will catch 90% of all defects before they are even released to QA.

    Overally, good testing catches perhaps 63% of all defects. Code inspections alone catch about 63%. Combined on a project, they catch about 95+% of all defects. That's the key. (My copy of Code Complete is at the office and I'm still at home, but that has the exact numbers and study).

    And remember, a good testing regiment will include all kinds of testing. Unit tests and integration tests are both needed (Usually it's only the latter that happens in QA). And it's quite handy to have started the unit tests before you start coding the units.

  172. Test cases are useless by bstrahm · · Score: 2

    Outside of creating an automated regression suite, I don't see much use in test cases. I mean so you test 10, 100, 1000, 100000000000000 things that the user might do... That leaves a lot of room for creativity on the end user. I actually had a manager who tried to say since a bug wasn't covered in a test case, it didn't need to be fixed. WOW.

    I think there should be about 20% of time dedicated to running testcases/regression tests 60% of the time to automating the above tests, and 20% of time dedicated to allowing testers to just beat on the product... Get creative and think like a user...

  173. I would go one step further... by freeBill · · Score: 3, Insightful

    ...and say, "Developers should write their test suites BEFORE they write their code."

    We have a fairly large open source project with contributors coming in and going out all the time (well, not a lot going out; but any number is a problem there). Our experience shows that if you can't write a test suite you're not ready for anything more than a crude prototype. The problem with test-after-coding regimes is the testing gets short-circuited. You've already got working code. You "know" it works. You're just proving it works. So you test the obvious stuff that proves this.

    Since we have instituted this policy, coding efficiency has actually improved. Coders who have tried to devise a complete set of tests have formalized their understanding of the requirements in a sense which the most complete requirements doc will never do. We include the test suite in CVS. Nobody commits until their update passes the entire test suite. This results in an enormous (but complete) test of everything done so far. But you can't imagine the thrill of seeing your patch pass that many tests the first time.

    All of which is completely separate from what a QA process is for.

    --
    Eternal vigilance only works if you look in every direction.
  174. Testing considered harmful by Bastian · · Score: 2

    I have to agree about the code reviews. There have been plenty of studies showing that frequent code reviews just work better - think of it as a way to suck up a large number of the advantages of pair programming without actually doing it.

    Speaking of pair programming, it's also been shown that you'l save a lot of time and effort if you use pair programming to do the complicated or difficult chunks of code. Yeah, there's the cutting-your-productivity-in-half argument, but that really only holds true if you don't know how to use pair programming. If done correctly, you'll save more than enough time to justify the cost later on when you don't have to put nearly as much effort into debugging that code.

    As for testing, it's overrated, almost worthless. I realize you gotta do it, but it does so much to distract from the best way to keep bugs out of your program (which is to not put them there in the first place), that I wonder if testing doesn't in some wierd indirect way actually create more bugs than it discovers.

    Heck, with code reviews, your programmers will probably start writing better code just so they don't hvae to stuffer the embarassment of having someone notice a particularly stupid algorithm design flaw in the middle of a code review.

  175. Excessive Testing?! by cthrall · · Score: 1

    > and do you feel that excessive testing hurts
    > the development process at all?

    No. What the original poster described doesn't sound like excessive testing. At one of my former jobs we did unit testing and automated black box (compared output with diff, crude but it worked) and white box (tested C API w/C test harness) testing. It was a lot, and kept three or four folks really busy, but it kept defects reasonably low for the amount of hacking that was going on.

    I don't think excessive testing means you miss defects. I think high numbers of defects reported by QA means you're doing something wrong on the development side of things, and high numbers of defects reported by users means you're doing something wrong in QA - maybe not testing like a user would.

  176. User testing.. by Anonymous Coward · · Score: 0

    If its software intended for interactive use,
    stick a person that never seen the program before in front of it. Make him do whatever he wants, by
    the end of the day, you'll have dozens of bugs to fix, and even more usability problems to sort out.

  177. Experience counts by Anonymous Coward · · Score: 0

    An experienced developer, whether thru a stated methodology or a more holistic approach, will have the objects, data structures and procedural program flow set up so that bugs are less likely. This can save a lot of time. There are working practices as simple as taking a little extra time to enforce naming standards and coding styles that significantly decrease the bug count at every stage. These vary by area but usually involve structural choices like one table versus many, not overloading objects too much, etc. It does make a difference and it's hard to measure.

    Also it really pays to front-load a project (spend a lot of time designing) and very important, prototyping. Remember, and this was researched pretty thoroughly by IBM at one point: $1 to fix a bug in the design phase, $10 in development, $100 in testing, and $1000 in implementation.
    So design very carefully and you won't have to spend as much time later... but it's not usually done that way (sigh). And be willing to redo the design process as carefully when modifying as in the initial design phase. If it takes longer, let it; you'll make it up later.

  178. Alternatives? by raytracer · · Score: 1
    I'm not sure that I understand the question that is posed in this article. If your QA teams are still finding lots of bugs, why do you think that testing less will be good for either your development team or for your customers?


    The simple fact of the matter is that no amount of testing does anything to reduce the defect rate of software. If your software has lots of defects when it reaches QA, then it is due to a failing in design and implementation. To fix
    such problems usually requires going back to basics: developing robust specifications, robust
    designs and robust implementations. Testing
    in the ideal merely verifies functionality. In
    the best of all real worlds, it uncovers bugs in implementation. In the typical/worst case
    scenario, it uncovers bugs in design.

  179. Testing Quote by Anonymous Coward · · Score: 0


    Testing cannot show the absence of defects, it can only show that software defects are present.

    We cannot test quality into a product, we have to design it in.

  180. Re:best way to test is to use automated testing by caferace · · Score: 4, Insightful
    Of course properly written functionality test scripts (doing what the user does) will find most bugs.

    I beg to differ. This is how most developers test their code as well, though manually.

    If you're just testing to make sure your code does what it is supposed to do you are likely in BIG, BIG trouble. Users (and black hats) do just the opposite.

    Focus just as much on making sure your code doesn't do things it WASN'T designed to do. Or risk a CERT or Security Focus advisory...

  181. Step 1: write better code in the first place? by patbob · · Score: 1
    Just have the developers test every branch they put into their code and verify that it performs the desired action correctly. This won't prevent design flaws, and it won't prevent the code from crashing elsewhere, but in my experience, such written code rarely fails directly even with unexpected input or failures (although often it causes less robust code elsewhere to behave badly).

    Doing this won't prevent defects in the code, but it will make it more robust out at a customer site. It also doesn't seem to add significantly to project completion time as the heavy duty hard-to-fix bugs are reduced.

    If I had a choice between getting developers to code this way or increasing the testing of the code, I'd prefer the developer solution.

    --
    Welcome to the net of 1000 lies. Upgrades are scheduled soon that should bring us to the 10,000 lies mark.
  182. And that sums it all up by Programmer_In_Traini · · Score: 1

    You are so right........sooooooo right.

    So far, I've been involved on 3 major projects and I have four years of experience as a programmer.

    At first all I wanted was to code, code and code again.

    The hell with the analysis, once in the code, all is fine.

    Man was I wrong, I think I'll put that in my life's lessons bag.

    While on my first 2 projects, analysis was being done properly. Meeting clients, white-board designing, use cases, sequence diagram, class diagrams then again.....Meeting clients...etc.

    always putting the work back on the bench before even writing a single line of code.

    When we started coding, it didn't went all so smoothly, we had our share of technical problems but we knew exactly what we were aiming and why we were. If the programming seemed too hard then we'd go back to design thinking that if its so hard its because we didn't think it right.

    Ironically, now that I have a good understanding of the need to design, design, design ever and ever again I find myself on a pretty big project where the boss does not seem to understand the needs for design.

    And man....how many time did I say : "Designing an architecture is not simply designing a database structure".

    Often, too often, we have to come back on decisions we took because we forgot this or that business rule.

    ...and every time I keep "whining" for more design and he keeps saying that this is not how things works nowadays.

    So now....we have a working product. All patched up to make up for the things we forgot. I did the best I could with what we had while respecting my boss's decisions.

    ...but, I don't even want to my name associated with it.

    Honestly? I'd be ashamed if my boss would be in front of a crowd and said : "Look, its thanks to him if we have a system now"

    Oh well...sorry for the rant, didn't mean to but hey....I simply wanted to tell just how right you are.

    --
    If you look like your passport photo, you're too ill to travel. - Will Kommen
  183. Or... by krow · · Score: 2

    Perhaps you just load up your software on a populor website and wait for bug reports? You know if your audience is addicted enough to the site this just might work.

    --
    You can't grep a dead tree.
  184. WHAT?! by mstorer3772 · · Score: 0

    Only if the reviewers are:
    a: Lazy. They didn't really read the code before hand and just ripped through it in the review meeting itself. Been guilty of this a few times myself.
    b: Morons.

    Any code that disagrees with its comment is a problem. Whether you need to change the code or the comment is something that needs to be decided on a case-by-case basis. THIS case is pretty obviously a code flaw.

    I think your hypothetical example is doing a disservice to your coworkers. VERY FEW people would let that slide if they actually looked at it.

    --
    Fooz Meister
    1. Re:WHAT?! by bluGill · · Score: 2

      Okay, the example was a little obvious, and likely would be flaged. I wanted an obvious example that even non-programers are likely to understand. 20 lines of comment and 10 lines of code with a subtile logic error that work 99% of the time through all brances except when some unchecked condition exists are really hard to write on the fly, much less so that everyone can understand why *foo would not be null and yet have invalid data...

  185. Detachment from your code... by sterno · · Score: 2

    One of the big problems that comes up with developing is that the people writing the code have two big strikes against them for testing their own code:

    1) They know how it is supposed to be used
    2) They want it to work

    The side effect of this is that frequently the code will give every impression of working perfectly until somebody who isn't familiar with the code tries to play with it. Then suddenly they are doing unexpected things, entering blank spaces, wierd characters, and other things that can be expected to happen in the real world.

    So, in any system you are developing it is very useful to have the developers try to break eachother's code. People don't want to break their own code, so generally they don't.

    --
    This sig has been temporarily disconnected or is no longer in service
    1. Re:Detachment from your code... by Krazymage · · Score: 1

      Of course this invokes the paradoxical "Expect the unexpected." I once had a VP tell me that, and it took quite a while to explain to him that it is a logical impossibility. Once you expect it, it ceases to be unexpected. Typical cliche ridden mind...

      What I have found helpful in my projects (which are usually small teams of 10 developers) is to have another developer work on parts of the system that I have "owned" for a while. If someone is adding a new feature to my structure, its a fresh mind and a fresh pair of eyes. It breaks the code out of my paternal grasp.

      Its emotionally taxing, but it's for the best.

  186. testing is nice, but reviewing is better by spiffy_guy · · Score: 1

    Where I work we do code reviews. Small changes are reviewed by at least 1 person, and large changes are reviewed by many people. Because the reviewer is also responsable for any bugs this code creates we spend a great deal of time reviewing the code in depth.

    We catch really picky stuff like variable names that aren't descriptive, doing the same thing in both the if and the else case instead of once outside the condition, taking locks a few lines earlier than necessary, indentation, etc. I've had code rejected for mispelling in a comment.

    Because we pay such careful attention to details really serious things that would actually be bugs rarely make it past us. It still happens, but usually the really subtle bugs are all that remain. The kind that out of your thousands of customers one will have occur every month or so of constant run.

    We do all the testing too. Heck, we have a huge testing organization. They even find bugs. But they miss a higher percentage than code review.

    --
    Anyone who cannot cope with mathematics is not fully human.
  187. Testing don't get no respect by Wansu · · Score: 2

    So, it isn't done well, if at all. QA isn't taken seriously. Regression tests, if they exist, are poorly maintained. Then people wonder why something wasn't caught before it went out.

    Put the QA department in charge of nightly builds, testing, docs and shipping. Allocate sufficient time for a thorough testing. Give them the power to hold up a release. Hire good people to do this, people who are good developers themselves. Pay them well and listen to them. Don't second guess and overrule them.

    --
    Wansu, th' chinese sailor
  188. User Report: Bug Found by Tower · · Score: 1

    Type: Grammar/Syntax
    Severity: 2
    Area: Subject Line
    Detailed Description: "Let the User's Do It" contains the following error: "User's" should be "Users". This bug seems to be a case of apostrophe misuse, one of the more common comment bugs.

    Suggested solution: Comment writer re-education along with a moratorium on all unreviewed use of said apostrophes.

    [Score: -1, Not even funny]

    --
    "It's tough to be bilingual when you get hit in the head."
  189. Design bug detection into your code by Anonymous Coward · · Score: 0

    As many developers here have said, code reviews are the most effecive testing techniqe.

    Another approach that I swear by is writing debugging code into the program and designing code that is testable. There is a good book on these techniques called "Writing Solid Code". At the very least your developers should be putting asserts into their code.

    Many shops take this to the next level. Some examples:

    When writing the Excel recalculation engine Microsoft wrote two versions of the engine. The first version was lightning fast written in hand coded assembler. The second version was written as simply as possible in C++. When a recalculation occured, the two versions of the engine would both do the calculation independently and compare their answers at every step. If they ever disagreed then error messages would appear. For the production release the slow engine was disabled. Techniques such as this are a bit more work up front, but they pay off in spades down the road.

    Another example: It is easy to look at a datamodel and see what the valid values and constraints are for the various fields. It is also easy to write an "integrity checking engine" that runs on a background thread and traverses the data model every few seconds looking for inconsistancies. If anything is inconsistant then errors messages appear. Such a checking engine will find most bugs shortly after they are introduced.

    Look at your test scripts and data constraints to see which checks can be automated. Automating as much as possible will save an enormous amount of manpower down the road.

  190. Regression tests don't work !! by matsh · · Score: 2
    OK, this may come as surprising to many, and it sure did to me, but my experience is that regression testing doesn't work, i.e. it doesn't find bugs.

    I had this grandiose idea that we would run all our unit tests as one big regression test every night, and it would alert us when our server broke. It didn't turn out that way. Instead, when the server was changed, we ended up having to rewrite the unit tests, and in many cases that turned out to be a royal pain. So we stopped maintaining the unit tests. When one, and later two, unit tests were constantly failing, then nobody cared any more about broken regression tests.

    There are benefits with unit tests, though:
    1. If you write the unit tests before you write the code, then you will force yourself to specify (in code) how your system will be used, which is way better than stupid UML diagrams. Yes, I don't like UML.
    2. Testing your code before you ship it makes perfect sense, of course. It will catch many bugs.

    So, my experience is that stringing unit tests together into a regression test suite is not worth the effort. Sorry JUnit, I also loved the idea when I first read about it, but I don't think it works.

    Mats
  191. Code review is a fraud! by Anonymous Coward · · Score: 0
    (I'm not trolling, but I _am_ venting.)


    I've worked for years in large and small companies. And I have experienced various levels of SEI/ISO process conformance.The fact of the matter is that the whole conformance issue is a fraud; done primarily, hence cosmetically, to win contracts. As such, tailoring the process to make it _effective_ is never properly carried out.


    I am disappointed to see so many people on /. espousing the tired gospel of Process. It's the accepted dogma, despite all _practical_ evidence (don't even quote surveys to me; you can 'prove' anything if you're bent on selling it), and everyone parrots it blindly.


    As for code reviews, only incompetent parrots see significant ROI on the time spent on code-level reviews. To illustrate, the fact of the matter is that most/all projects simply do not have the overlap of expertese it takes to assess someone else's work -- let alone the issues of needed time, and constructiveness of the feedback. As such, most review results boil down to cosmetics; at best, trivial returns on the time spent.


    And don't even get me started on Metrics.

  192. "Start writing code...." by HWheel · · Score: 1

    Many, many years ago I worked with a developer who had a cartoon taped to his file cabinet. In it, a mid-level-suit-looking guy was standing in front of a bunch of developer-types. The caption said, "Start writing code. I'll go find out what they want." This summarizes the vast majority of projects I've worked on. And it despite all the talk about why software sucks, it seems to be getting worse lately.

  193. Testing advice for Delphi programmers by ManxStef · · Score: 1

    Just thought I'd drop a few links that those of us using Borland's fantastic Delphi should definitely check out:

    • DUnit- is an Xtreme testing framework, very similar to JUnit for Java (on which DUnit is based). The basic idea is that you develop appropriate verification tests at the same time you develop your code, and then use these test to make sure you haven't screwed anything up inadvertantly! Free and Open Source (Mozilla 1.1)
    • PASDoc is the Pascal equivalent of JAVADoc, which lets you automatically generate HTML and LaTeX documentation directly from your Pascal unit source code files. Nice!
    • GPProfile - a nice free and Open Source profiler for Delphi. Does what it says on the tin.
    • MemCheck is a debugging tool which hunts memory leaks, memory corruption, use of an object after its destroying, etc. Very useful, if a bit archaic to use. Free and Open Source.
    • OptimalCode is a fantastic site dedicated to high-performance Delphi code. If you need to optimise a routine so it's faster than sh*t off a shovel, this site'll show you how.

    That should be enough to get your code into shape, get cracking :)

  194. Don't duplicate tests! by bob_jenkins · · Score: 1

    Yes it's possible to test too much. For example, if it takes 15 minutes to fix a bug but a week to run the required regression tests for touching that area of code, that's way too much. There's a tradeoff between correctness and turnaround time.

    A really bad way to write a test is to take an existing test, copy it, turn on your feature in the copy, then add the copy to the existing test. Or equivalently, call the same test twice with different parameters. It doubles the running time of the test and doesn't give you significantly better coverage. 100 iterations of that gives you a test that wouldn't finish in a trillion years.

    A really good way to test orthogonal features is to write a test that turns on half the features all at once. Choose the half at random when writing the test, but avoid any combination that raises an error. Then write another the same way, and another. 50 such tests will cover 99.9% of all triples of features. Much faster than 2^^#features tests, or (#features choose 3) tests. If you add a feature, add it to half the existing tests. That means the test changes over time. That's OK because they were blackbox tests to begin with.

    Error cases and bug testcases are different. They're whitebox, you know what you're testing for. Those testcase can't change over time. Don't copy them (exponential growth!). Use the simplest testcases possible.

  195. Depends on your particular situation by Anonymous Coward · · Score: 0
    The fact that you are finding lots of bugs indicates success, as far as your testing efforts are concerned. It suggests that your testing program is quite thorough. Finding bugs prior to shipping to a customer is good.


    Finding an abnormally large number of serious defects, however, does speak to some failure in your software development proceses. What is precisely wrong in your case can only be determined by you, or your colleagues. You need to do some analysis to determine what the source of the defect was.


    That is, did the defect occur because requirements were poorly defined? Did the defect occur because of poor technical design? Or are most of the defects just simple "typos" in the code?


    After you have done this analysis, it should be clear where changes are required. There is no magic process that a Slashdot reader can identify for you that will instantly give you results. You'll have to do the investigation yourself.

  196. Debug *before* you write by stand · · Score: 1

    I've seen a lot of people who code empirically. They rely on a fast compile run cycle and just make changes until the code does what it is supposed to do. Perl coding is especially susceptible to this problem. What's wrong with this style of programming is that you often don't really understand what the code is doing. This is a good way to introduce bugs.

    Make sure you understand the problem space before you write the code that navigates through it. And don't code blindly. If you don't understand how a given function or class works, write a test program that explores how it works.

    --
    Four fifths of all our troubles in this life would disappear if we would just sit down and keep still. -C. Coolidge
  197. I just want to be happy by Anonymous Coward · · Score: 0

    I have been developing software for 29 years now.
    I once (only once, never again) took a job as one of more than 100 of testers of a huge product.
    We were all very busy sending memos with charts indicating testing percentage coverage and bickering about responsibilities for testing sub-components of the product. With a huge headcount dedicated to testing, it appeared that less and less actual testing was being done as the various test groups (System Test1, System Test2, Integration, Certification, Packaging etc,.) were all consumed in administration and self-justification.
    We managed to ship a version of the product which DIDN'T WORK AT ALL. No-one felt individually responsible.

    I carefully write and thoroughly test my own code. I don't release code until I am satisfied, despite the pressures of the business to deliver. I take great pride in my work. I regard each bug found by others as a personal failure and examine how it could have escaped my attention. I submit my designs and code to my peers for review because I want to get it right.

    My attention to detail and pride in my work has paid off financially for me.

    If you know you are doing a good job, you will be happy. I just want to be happy. Every year, I am testing my code more thoroughly than ever.

    Now all you developers get back there and stop skimping on the testing (self included). You'll feel much happier.

  198. Have I got a book for you. by loren · · Score: 1
    I hate Microsoft as much as the next guy, but "back in the day" they wrote some (at least one) pretty darn good books. It's easy to scoff at the title of this book, but Writing Solid Code: Microsoft's Techniques for Developing Bug-Free C Programs
    by Steve Maguire is probably the best book I've read (ok... I only read about half of it yet) on bullet proofing your development process. The book is a bit focused on C, but most of it's techniques can be adapted in C++ or any other programming language.


    Anyone who comments on how bad this book is (because it's written by Microsoft) that hasn't at least flipped through it: YOU ARE A TROLL!



    Hope that this helps.

    --

    Loren Osborn

    Software isn't software without source code. -- NASA
  199. Multiple levels of testing by J.+Patrick+Graves · · Score: 1

    Sound like you might be on one of my former projects :-)

    If you have multiple levels of testing, (e.g. unit testing, integration testing, acceptance testing, performance testing, etc.), then you are in a large, complex environemt. This environment probably has had several hundred developers working on a few thousand different programming modules at different release levels. Unlike a program like a browser that may have 50 or so basic functions that it can perform, this environment has probably several thousand function points that span an enterprise.

    Each level of testing is designed to catch different types of errors. A program that passes a proper unit test should have bug free code, i.e. no core dumps or segmentation violations and proper exception handling.

    A set of programs are tested together in integration testing to verify that the programs are calling each other properly and are performing basic business functions, e.g. adding a new user, maintaining account info, routing calls, etc.

    Acceptance testing is designed to ensure that the user of the system can perform his mission critical business tasks with the new system. Acceptance testing will also allow the end users to verify that what they are getting is what they asked for. Every business case scenario should be performed during acceptance testing by the ultimate users of the system.

    Performance testing is used to identify bottlenecks when running the system against a fully loaded database/system. When a programmer is building the initial program, the test bed used is only a fraction of the size of the ultimate database to handle tens of millions of customer accounts.

    There are several problems that manifest in these environments. First and foremost is sheer incompetence, from management to designers to programmers to database and system administrators.

    These large, complex environments allow for incompetence to go unfettered under the cloud of technology. Errors that are made often go unchecked and when they are discovered, there's no accountability to the individual that made the error.

    Programmers rush to meet deadlines and don't properly test their code. A designer may not include certain business functions that are required to complete a business scenario. Management may make decisions based on trade magazines or a sales pitch and those decisions could introduce instability into the product (i.e. use MS in a clustered 24x7 SQL Server environment). You get my drift.

    Second is empowerment. A programmer may know of buggy code and even identify the bug, but code is locked down and has a defined migration path that has to be adhered to. Applying a quick fix and throwing the code to a location available to all programmers is not facilitated. Most of these enviornments have not made the paradigm shift from a traditional version control tool like SCCS or PVCS to the open source approach of CVS. With CVS a programmer can't lock the code in a project.

    Anyway, these levels of testing are essential in delivering enterprise wide solutions. Unfortuanately, the levels of testing in themselves do not ensure success. Without proper quality assurance (e.g. peer reviews of test plans, detailed designs, technical architecture approach documents), good communication and life-cycle accountability (sure you completed it on time and within budget, but it was crap - you're fired!), buggy code will prevail.

    Cheers

    jpg

  200. Many bugs is good. by bluGill · · Score: 2

    I was once on a project where very few bugs were found in testing. Eventially we shipped and discovered that the testing group wasn't doing a good job of testing.

  201. Take Small Steps and Test Often by RAMMS+EIN · · Score: 1

    The approach that works best for me is writing small pieces of code at a time, and then testing those. Additionally, I always have others (both hackers and laymen) test the program from a user's perspective -- sometimes they find obvious bugs that I overlooked. One caveat here: I usually write very small programs, my experience with large projects is very minimal.

    One very good piece of advice that cannot be stressed enough is STAY ALERT. Don't just keep going, but take breaks often, and get some exercise. Physical exercise is the only thing that really clears all the programming stuff from my mind, so I can make a fresh start again. This drastically reduces the number of bugs made. Another thing that helps is design everything in a modular fashion -- that way you won't break any pieces you have already written.

    --
    Please correct me if I got my facts wrong.
  202. Testing's like believing in god by YetAnotherName · · Score: 1

    In other words, you've got nothing but faith that some kind of test harness will shake out the bugs. Faith sucks. Far better to do code reviews or Cleanroom style development. Takes only a bit longer, and with far fewer bugs.

    As Ron Grimes rhetorically asked in 1994, "If you don't believe it's correct before you start testing, what could possibly convince you?"

  203. Requirements by andymac · · Score: 3, Insightful
    Hi there --

    I'm certain someone has already said this, but over 80% of defects come from crappy requirements. Forget about your design & analysis, your coding practices, inpsection techniques, debugging and testing abilities - if your requirements are not CLEAR, CORRECT, ATOMIC, UNAMBIGUOUS, and CONSISTENT, you might as well start burning money.

    NASA correlated a $1 cost to correct a "defect" in the requirements stage (here a defect can be any requirement that does not meet all 5 attributes I listed above) to several hundred to thousands of times over when addressing the same defect at the testing stage. Crappy requirements and crappy specifications are a big part of what makes your code buggy and expensive.

    LA Times posted a study last year that showed that the average US programmer only coded for 51 days a year. 51 days!! One fifth of your working year spent writing new code. The rest of the time? DOING REWORK.

    Biggest cause of rework?

    UNCLEAR AND AMBIGUOUS REQUIREMENTS.

    Spend the time and effort to beef up your requirements gathering and management processes. You'll get your ROI in ONE project cycle.

    --
    "Content's a bitch."
    1. Re:Requirements by andymac · · Score: 1

      Forgot to add that test design is driven almost entirely by requirements, that is, the requirements are the primary artifact consumed by test planners designers...

      --
      "Content's a bitch."
    2. Re:Requirements by lgordon · · Score: 1

      LA Times posted a study last year that showed that the average US programmer only coded for 51 days a year. 51 days!! One fifth of your working year spent writing new code. The rest of the time? DOING REWORK.

      As one of my friends always says, "It doesn't matter if I'm writing code or re-writing code, I get paid exactly the same."

  204. My recipe by proxima+centauri+(W) · · Score: 1

    First, there are two types of tests: Unit Tests and Functional Tests. The first type, unit tests can be measured and rather easily implemented as part of your coding process. This is, to test every function of your libraries, and if you're up to it, you should even write these tests before implementing the functionality to be sure it measures up to your expectation of what it should be doing. These tests must be run before putting anything on the source code database by the programmer and should also be automatically run periodically to asses that the code is still perfect. The idea is NOT to test everything, but to test the limit and probable problems that you think you could encounter. As you find programming but, you should ADD a test to make sure that the bug never crawls back in your code. That being said, it does not make your code full proof and neither TESTED! It only makes you, the coder, more confident that your code "works". That is a great achievement though... how many times has your boss ever asked: "So, does it work?" and you say...: "Huh... well, it worked when I tried it..." now you can tell him/her... I've tested it within reason and it works perfectly fine. That should never take the place of Functional Testing. Some stuff cannot be tested programmatically, for example, you cannot really test much of anything having to do with communication ports and communication errors. These should be done by hand by somebody who is from the QA department (if you're lucky enough to have one ;-) If there are major bugs at this stage of testing, you probably had a bogus design to begin with as most of these bugs should be faily minor. just my thoughts...

  205. Downside to Code Reviews by Raedwald · · Score: 2

    Many others have pointed out that studies consistently show that formal reviews (especially of specifications and designs) are the most cost effective ways of removing defects. Others have provided references to the classic books on the subject. Anyone considering doing formal reviews should read them. I personnally like Tom Gilb's books.

    There is a downside to consider, however, which is little mentioned, even in the formal review literature. Formal reviews require a particular type of company culture, and not all companies have or want that kind of culture. Trying to introduce formal reviews in a company that has an incompatible culture will be some mixture of painful, counter productive and political suicide.

    The idea that a company would, in any way, be opposed to using the most cost effective way of removing defects seems bizarre. The truth is, not all companies care about product quality. Sure, everyone will say they care, but words are cheap. To find out what a company really cares about, see what decisions they make under pressure. See what they sacrifice, and what they keep.

    • Do they cut testing to release the product on time? That means schedule is more important than quality.
    • Do they refuse to return an error riddled specification to the customer so the errors are corrected before work even begins? That means saying yes (a 'can do' attitude) is more important than quality.
    • When engineers start pointing out defects, are the whistleblowers labelled as 'troublemakers'? That means internal politics or a harmonious working environment are more important than quality.

    The difficulty is, that before you can introduce formal reviews into an organisation, that organisation must already be highly committed to quality. Quite simply, many organisations have to introduce other, fundamental, improvements before they can use the advanced technique of formal reviews. The Capability Maturity Model (CMM) produced by the Software Engineering Institute (SEI) is a useful way of prioritising these improvements. I recommend it; I've used it in a project, and ISO 9001/9000-3 in another, and I conclude that CMM is the better of the two. They have a website.

    --
    Ne mæg werig mod wyrde wiðstondan, ne se hreo hyge helpe gefremman.
  206. My thoughts... by Anonymous Coward · · Score: 0

    Have a plan for whatever you are going to code. (In other words, design your program.)

    Test and document your code as you are going along. Double-check everything. This will make your coding somewhat slower but it will be more deliberate.

    Don't just trust any external data. Check it. Always think about any exploit you can when your code deals with external data. Think about user input, data files, external programs, remote hosts (which could be bogus, unreachable, or hax0red), etc. Consider external data untrustworthy.

    I recommend giving nice verbose error messages when something goes wrong. (Example, "loadfile.c, line 299: couldn't load file bogus/path/to/blah.cfg specified in the $BLAH environment variable. file stats: etc etc")
    Stack traces are also good.

    Always keep resource limits in mind.

  207. minimizing defects by Anonymous Coward · · Score: 0

    Testing quality into a product is extremely unrewarding

    1) review early and often
    requirements, architecture, code, etc. - it's cheaper to catch defects before they escape the phase in which they are generated

    gather metrics on how long it takes to fix a bug, and the impact on testing and release schedules to prove this to yourself and others

    1.5) review bugfixes - the "cure" may be worse than the disease

    2) assuming your regression and new-feature testing is reasonably complete, the rate at which you're finding defects is probably closely linked to the number of defects left in the product

    you probably need historical data from comparable projects to be able to make good predictions, so start gathering data

    as for your current project, try to plot your error find rate to get an idea of "quality"

  208. Correctness... by richieb · · Score: 3, Funny
    Building correct software from requirements is as easy as walking on water. As long as they are frozen. :-)

    --
    ...richie - It is a good day to code.
  209. Hogwash by Anonymous Coward · · Score: 1, Interesting

    I've tried literate programming, XP, and several flavors of traditional strategies, all of which purport to be the "answer" to your needs. It's ALL a load of crap. If there's any one answer, it's this: there is no one testing methodology that outperforms any other in EVERY testing situation. In my own personal development, I have come to rely on several beliefs/prtactices that have sustained the test of time over my 20 years of programming (and have made life much easier when coupled with a reliable testing methodology):

    • At any point in which data enters the system from an external source, validate it in every way possible. For example, if you take an input from an operator, don't simply check its type and move on; check that it satisfies every requirement that might be placed upon it as it journeys through your code. To this end I have written entire subroutines that are devoted to validating a single input at the point of entry. This affords you, to a very measurable degree if the validation succeeds, the confidence to make assumptions about that input that you would otherwise be unable to make. The end result is that code deeper in the system, when operations typically become more complex, can be simplified as much as possible.
    • Truly self-documenting code is not only possible, but in many cases conveys a higher quality of developer-usable information than thrice the amount of written documentation.
    • Customers should supply three pieces of information: the input to be supplied, the output needed, and any special theorems, equations, etc. required to produce that output. All other matters of development (including the method of input) should be primarily the responsibility of the development team.
    • Time spent developing code used to generate random testing inputs and conditions is a wise investment; it is a necessity if the development language is not strongly-typed.
    • Bugs discovered should never be solved at the point at which they occur, but rather as early as possible in the system. Referring back to my first point above, I have found that I am able to eliminate even the possibility of many bugs by simply putting forth extra effort at data point-of-entry.
  210. developers testing more == best value by patSPLAT · · Score: 1

    I second this opinion.

    From my experience, the benefits of a test suite increase dramatically the closer you get to full coverage. Some tests are always better than none at all: 25% coverage is better than completely untested. But 50% coverage is much better than 25%, and the closer you get to 100% the greater the benefits you will encounter.

    There are obvious benefits of high coverage, such as the ability to refactor with confidence. But high coverage has unexpected benefits. For example, reorganizing hard to test code often has the benefit of reducing unnecessary dependencies.

    Unfortunately, getting high coverage requires discipline. Test first coding is a good guideline to achieve higher coverage.

    Also, INHO, the testing program should start from the developers pov, not from the clients. The business problems of programming originate in the programming process, not idiot clients. I believe you get a better value by improving the programming process, then adding other QA processes as needed.

    i.e., test first coding will pick up a large percentage of your qa issues. Issues that are not picked up by test first coding should be addressed by other processes. However, in many common small scale efforts test-first coding will take care of enough issues that another formal process is not needed.

    1. Re:developers testing more == best value by Anonymous Coward · · Score: 0

      Now all you need to do is give us good links!

      Everyone is really good at parrotting the lines I've read multiple times:

      "Write test cases and test all the time!"

      But noone seems to have a site that shows HOW to write good test cases. What makes a good piece of testing software? Do I just code up:

      for (int i=0; i256; i++)
      MyIntegerFunction(i);

      No, because this only tests that I can call my function with every known integer. How is that a test? It's not.

      So where do we go to learn how to write effective tests? How do we apply this philosophy properly? I can TELL that it's a good idea - make the computer test my code for all sorts of things - but I don't know how to put it into practice in a useful way.

  211. Re:best way to test is to use automated testing by Daetrin · · Score: 1
    The whole idea behind automated testing is that the computer will try all the possible inputs the user will be able to do, but _not_ in the order the programmers expected to do them. Programmers get into a mindset of "this is how it's supposed to work" and sometimes it is hard to break out of that mindset for testing.

    So if you're working on a database program, you make an automated tester that puts in random types of information in random orders, if you're working on a console game you write a program that generates random controller inputs (i know a guy who did that last one.) This random generator will come up with combinations of input that you as a programmer would never have thought to test for.

    You let the random input generator run overnight, and come back in the morning. If the program crashed, you've got a serious problem you need to deal with. If it didn't crash (and even if it did) you go back through the logs and see if it got into any weird states or gave any bad output, in which case you check what inputs generated that, and protect against that type of case.

    It probably won't catch _all_ the errors, but it will catch a great many of them, leaving the testers to look for the more subtle errrors.

    --
    This Space Intentionally Left Blank
  212. Code Complete Rocks! by alouts · · Score: 1
    I know you already got a lot of comments here, but not a one has backed you up on your support of Code Complete.

    It is by far the best generalized programming book I have ever seen, and after almost 10 years writing code, I have gone through two copies of my own and bought it with money out of my own pocket for at least 6 people I have worked with. The best way I have heard it described is as a giant compendium of common sense, none of which anyone pays attention to until it's all laid out in front of them.

    If there is anything I wish people on Slashdot would get religious about it would be writing excellent code and understanding what exactly makes their code excellent. If they did, surely Code Complete would be their bible. I know it's mine. Keep preaching, maybe you'll get a convert or ten!

  213. Checkthisout by Anonymous Coward · · Score: 0

    http://www.technologyreview.com/articles/mann0702. asp

    MIT's site gives a quick discussion about the current problems of buggy software. It is a fairly good read.

    For those of you are engineers you do wear that ring for a reason.

  214. Code Reviews by cant_get_a_good_nick · · Score: 2
    In my opinion, one of the best ways to get rid of bugs is code reviews. I've been in a couple organizations, and we did code reviews at both. Both helped getting better code out, and had other side enefits.

    Plusses
    • Analysis doesn't just catch bugs, but design decisions. No amount of QA of compiled code will show you a bad design, yet this is where a lot of problems occur.
    • Careful analysis finds bugs that are hard to test, like when the world is crashing around you. How often do you simulate low memory situations?
    • It helps disseminate knowledge in the organization. Someone has a technique or an algorithm. It comes up as a suggestion in a code review, and now others know of it too. I learned a few things in code reviews I never knew to ask. Some developers will never ask because of ego issues, but will hear of them in code reviews.
    • Fosters a sense of responsibility in the code. If someone is going to see tis, then the code has to be of better quality. I can't just write garbage and hope it gets by QA.


    Problems? of course...
    • Managing egos, easily the biggest problem. Have to reinforce that this isn't a witch hunt, just to get better code. The code review leader can't let himself get caught in an argument, cause it will disrupt the meeting and foster resentment in the developer.
    • Time. Developers hate meetings. It's best to have a few developers in the meeting, the many eyes approach, but how do you get some guy on a deadline with his stuff to look though someone else's code? Need to foster a team feeling, hard to do sometimes. Also, make sure you limit the time in the meeting, you get diminishing returns after a while, an hour, maybe two. Anything more is a waste of time.
  215. Coverage testing tools by BruceRD · · Score: 1
    A more sophisticated tool could go beyond lines of code and into log the various logic combinations exercised in "if" statements, etc. [...] Do these kinds of tools exist, and if so why aren't they more widely used?

    Such tools certainly do exist, including the more advanced variants you suggest. For example, Cantata++ provides not only the basic statement coverage you suggest, but also decision coverage (%age of true/false branches executed for all decisions, including ?:), call-pair coverage and boolean effectiveness coverage. (Disclaimer: I work for this company so you'll want to do your own research.)

    These sorts of tools are infact fairly widely used. When doing unit testing the tools are normally used as part of an automated unit test script which checks the coverage and fails the test if insufficient coverage is achieved. They are probably the best way of measuring the effectiveness of unit tests.

    Some coverage tools (<shameless-plug>including Cantata++</shameless-plug>) can also be set to simply log coverage as the program is run normally (e.g. through a user acceptance test) and the thoroughness of this test can then be evaluated (or checked, if the principle measure of thoroughness is requirements driven) by examining the coverage data gathered. Obviously this impacts on the performance and memory footprint of your acceptance test - so it doesn't work in all cases. When developing for targets with limited memory, tests are often run with coverage instrumentation in a development host environment and then re-run without coverage on the target to prove correct execution.

  216. The sad part of this is.. by paranoic · · Score: 1

    Is that my boss, how reads Slashdot, doesn't have a clue as to how to implement any of the great suggestions put forth by y'all. And isn't interested in being told how to do it.

  217. Another problem is... by Anonymous Coward · · Score: 0

    the number of three tier systems we work with these days. We use MQ Series and C++, some Java, etc within a pretty big point-of-sale application where I work. Testing the integrity of each piece and then the integration of all of the pieces can be a huge headache.

    When you add to it the fact that we get periodic updates from IBM for MQ Series with bug fixes, compiler changes, class library patches it is sometimes hard to know if the bug exists in our code or some of the middleware. We have had to bounce some of our servers periodically for wierd message response timeout situations and now it looks like it may be an MQ Series bug...

    Whoever writes the song sometimes pays the singer in unexpected ways....

  218. Code reviewing tools + unit testing by Anonymous Coward · · Score: 0

    As mentioned by a heap of posts above, code reviewing can make a huge difference to software quality, in an addition to unit tests. Check out http://codestriker.sf.net as an example code reviewing tool.

  219. testing? we don't need to stinking testing! by Anonymous Coward · · Score: 0

    i do bugger all (ha ha!!) testing and produce hardly any bugs

  220. yes, testing can hurt by ummit · · Score: 1

    One way testing can hurt is if developers assume that it's the tester's jobs to catch the bugs.
    Developers who don't have testers to lean on have (potentially) more of an incentive to figure out how to introduce fewer bugs in the first place.

  221. whoops by Anonymous Coward · · Score: 0

    ha. what a silly bunt! of course, i meant to say "we don't need no stinking testing!" pity my english isn't as free of bugs as my code!

  222. Careful design, automatic regression testing by Anonymous Coward · · Score: 0

    Nothing can replace
    1) Well written requirements
    2) careful design
    3) peer reviewed design
    4) peer reviewed code
    5) manually built regression test scripts (insert favorite testing tool here)
    6) Building often on every platform (nightly!)
    7) Perform user scenario testing with memory tools (Purify is my favorite)
    and
    8) Running the regression tests for every build.
    8a) The build isn't complete until the installation packages are created for every platform just as if you were going to ship it to a customer. Copying a newly linked DLL or .so doesn't cut it. You need the full package for testing from start to finish.
    "We don't have time for all that" is a poor excuse. If even 1 bug is experienced in the first week by a customer, you've lost their trust. Good reputations are easy to lose, but very difficult to get back.

    I've just unlocked the secrets to successful software development. That will be $20k please.

  223. Dont test more. Heres why by mnmn · · Score: 1

    1) The bugs created are made during the programming and compiling phase, and prevention is better than cure. I develop some small progs in bsd and do a cc -Wall -ansi -pedantic -O to make sure things are good, and this is after a thorough lint stops giving errors and warnings.

    2) Modular progs should be preferrably compiled etc on similar or the same machine.

    3) And probably the most important, the programming style. Be very clear about what you're programming and decrease the places where the prog can break to a zero. Use libraries that have proven to be resilient etc and the final application no matter how complex should give little or no errors.

    PS dont forget a thorough script based testing system to test the app and leave it for a few nights to test all possible inputs/loads etc.

    Hope this helps.

    --
    "Give orange me give eat orange me eat orange give me eat orange give me you." -Nim Chimpsky
  224. No one should run ANY tests. by Sax+Maniac · · Score: 2
    Seriously. Manual tests are waste of time. The only test worthy of running is an automated test. If it's not automated, then somebody can forget to run it. If somebody can forget to run it, then you're not really testing it, are you?

    If you have to have X people run tests at cost Y, then adding more tests makes it more expensive! What kind of screwed-up logic is that, when a computer can do better at 4am while you sleep?

    Any tester worth his salt is not a button-pusher/bug-report-writer. A real QA person writes automated tests and checks them into the code base so that it runs automatically when building. Flame to death anyone who checks in code that breaks a test. The optimum situation is that all developers are testers: they write tests and code and check them both in simultaneously.

    If you're finding that tests are showing up lots of bugs, you're finding the symptom. It might be you're finding bugs and fixing them will reduce the amount. However, if you find that your development team creates bugs faster than it can fix them, then it means your organization doesn't know to code it's way out of a paper bag and shouldn't be programming. No amount of tests will fix it. The only thing that will work is refactoring, and most managers in such places erroneously think refactoring is the devil.

    Not all software is equally testable. You have to write to so that is testable. If you want to read a great book on how to test your software, I recommend John Lakos' Large Scale C++ Software Design. Testing techniques apply to most other languages, not just C++. Personally, I've unscientifically found that every hour writing automated tests pays back at least 10 in saved future effort. YMMV will vary on the complexity of your project.

    --
    I can explanate how to administrate your network. You must configurate and segmentate it, so it can computate.
  225. The testing processess is what is wrong by Anonymous Coward · · Score: 0

    The idea behind testing in the corprate environment is kind of messed up. The people who test applications are PAID to test applications. This is their job. Hence you have whole departments, in some cases, who's job is to test software. Don't let them do it!

    The problem lies with the general public, and the people who market the software.

    Reason the general public is a problem - they have a tendancy to do stuff the creator of the application, or module expected. To fully test software, it must either be done 'in the wild' in userland, or in a controlled userland where the participants are as educated as they typically are when they start using an application - this is little to no education. Basically sit them in a room with the software and watch what they do, and see if it breaks.

    If you wrote the software and THINK its broke, check it! If you think it works, then let the users tell you if it does or not. This does two things, it allows you to test the code in a real environment, and also allows you to see if the user interface is as 'intuative' as you say it is.

    This is the second problem - MARKETING. Why do you put out BETA releases of software? To test it out in the wild to find out if something is broken, or will break other things. But the probelm with this is MARKETING. You put a company with a cool new program (which is really a BETA release) and they marekt it as open to the genral public, put it on websites all over the place, etc. and people expect it to work. Even if it is BETA, or they expect it not to cause problems on their system. When they do they complain to the people who made it, to the manufacture of the PC, etc.

    Make good software, test it, and when you release a BETA version, change the public understanding of what BETA really means.

  226. Orthogonal Array Based Robust Testing by yokimbo · · Score: 2, Informative

    I'm sorry, but I didn't have time to read all the other responses. The replies I did read were mostly questions back at you and clarifications to other replies. So, here is my attempt to answer your questions.

    do you feel that excessive testing hurts the development process at all?
    Yes, of course it does. You could, theoretically, test code for one program for the rest of your life and still not discover all the bugs. That would be excessive testing and would definitely be a bummer to the development process. I think what you really mean is how do you determine how much testing is enough. For this I refer you to a few good testing books because frankly speaking, people have made careers out of this sort of thing :)

    Books: The Art of Software Testing (hard to find and a little expensive) by Glenford J. Myers; The Complete Guide to Software Testing by William Hetzel; Code Complete : A Practical Handbook of Software Construction Steve C McConnell. These are some good options to get you started.

    What is the best way to get the biggest bang for your testing buck?
    I would take a serious look at Orthogonal Array Based Robust Testing. A method of testing developed by Taguchi and Konishi, and using orthogonal arrays to determine test cases. I don't have enough room here to get into details, but basically this type of testing guarantees detection of atleast 1st and 2nd order defects with the minimal amount of test cases. Madhan S. Phadke's Quality Engineering Using Robust Design mentions this type of testing. Also Bell Labs has been so kind as to publish online some fairly heavy strength Orthogonal arrays, so you don't have to calculate them. My employer uses this type of testing on many of its projects and it's a huge time saver. I just learned about it in an onsite class by our top tester and am going to pitch it to my project soon.

    Good luck, sorry for being so vague in places, and finally, if you have more questions about Orthogonal Array Based Robust Testing, please let me know: redundant_pleonasm@hotmail.com

    1. Re:Orthogonal Array Based Robust Testing by yokimbo · · Score: 1

      Here is a site about Dr. Taguchi:
      http://www.dti.gov.uk/mbp/bpgt/m9ja00001 /m9ja00001 11.html

      Here are some other sites; these ones are lists of books about the Taguchi Methods:
      http://www.johnstark.com/pb50.html
      http ://www.rkroy.com/wp-txt.html

      An outline to the steps to this type of testing is as follows. First, you have to know how many inputs you'll have for your unit under test as well as the number of values for each input. Then, using this information you'll select the appropriate orthogonal array and use it to build a preliminary test case matrix. Once the unit has been coded, you can then adjust the number of test cases as needed. The trickiest part of the testing is determining how many meaningful values each input parameter has and then picking your orthogonal array. Depending on the strength of the array you use, you are guaranteed a certain order of testing will be covered. It really is quite brilliant.

  227. This can be a Fla*mebait but by WetCat · · Score: 1

    ... may be your programmers are using wrong language? Too low level, like Java or C++? May be better to switch them to Prolog, PHP or TCL/incrTCL? They will produce less lines of more functional code then...

  228. Code Review by tpv · · Score: 1
    but if you account your hours precisely enough, the results WILL speak for themselves

    IFF, you can relate future costs back to the original development.

    When I do code reviews, I'm often looking at:

    • Correctness - does it meet the specification correctly. Getting this right saves time during testing (or sometimes during production), so you need to be able to tie your testing costs, and the business cost of having an incorrect implementation, back to the development time, in order to see that the code review saved time/money.
    • Robustness - will this code handle the exceptional circumstances? Again, the saving is in test/prod not in development per se.
    • Supportability - when this code is running in prod, will those supporting it be able to know what is going on? We write a lot of batch processing, and someone is on call at night in case it fails. If production goes down, the on-call person needs to get it back up ASAP. Good code with good logging, and clear algorithms aids that a lot. But it's hard to relate the saved downtime to the development process.
    • Maintainability - will the next sucker be able to make changes? How do you track the future development costs back to the original development costs? Most people can point to a block of code that was written in a death-march. The original project came in under budget, and now we're all paying for the fact that one guy wrote all the code in about 24 hours without sleep.
    • Reusability - are we going to have to solve this problem again? Does this solution support that? Getting this right will save you money down the track, but will people recognise that project Y was completed 1 week earlier because project X spent 1 day on code review?

    You need to account for you time very well, and with a good tie back to the original development to truly realise your saving.
    Or, you need to do a complete switch for at least 6 months, and see how much better you get overall.

    --
    Read more of this story at Slashdot.Read more of this story at Slashdot.Read more of this story at Slashdot.
    1. Re:Code Review by Xentax · · Score: 2

      Yeah -- our numbers can definitely highlight where review time correlates with testing/support time. But, as you said, breaking that down into whether the code's robustness vs. support/maintainability is a little trickier.

      And I agree about reusability -- hand-in-hand with that is using 3rd party solutions when appropriate. Forget solving the problem twice or even ONCE if someone else has done it for you (and you can legally and ethically use their solution, of course, e.g. we found using ACE on a C++ project to be well worth it).

      Luckily, we have a leg up on most places for these issues -- we can generally use Java and C++, which lend themselves to maintainable, supportable code far better than C or assembly, and we make the effort for our code to be readable and understandable if at all possible.

      Xentax

      --
      You shouldn't verb words.
  229. brutal but full by ironfroggy · · Score: 1

    a little overkill, but i usually make a very tiny program to test every function in my project. tell it what to give the function and what the function should do back. lets you control the testing alot. now, if i had a team, id have someone take the code documentation and do all this, so i can code more. but this works for me.

  230. Jeez by Smid · · Score: 0, Offtopic

    Another slashdot stories which says

    "Jeez, maybe I should have trained in the stuff before trying to do it as a job"

  231. Laws of Software Testing? by Peahippo · · Score: 2, Interesting

    From my experience testing at PictureTel and DEC in Mass., I found out that the usually-understaffed test team runs into the Laws of Software Testing: Law #1: Most of the time, you are not testing. You are obtaining (beg, plead, cajole) equipment and software, and you are configuring and fixing software, just so that the environment is ready for the software testing to occur. Law #2: When testing, most of the time you are not testing anything that matters. Sure, scripts are great, but they are very narrow, and bugs are sneaky. Running a limited variety of scripts across some clients and servers only gives the impression of coverage ... kind of like the concept of "busy work". Law #3: When you find a bug, most of the time it can't cross the political barrier. After all, bugs are rated and prioritized, and that is the domain of management, who is overwhelmingly concerned about release dates. Law #4: The bugs you don't find will reach the customer and will return as the highest-priority bugs that will usurp other bugs in the ongoing process. Fixing customer problems is of course a priority, but it landslides into the current product's production.

    --
    [also misbehaves on Kuro5hin as Peahippo]
  232. Testing: wasting time and not doing assigned work by lpq · · Score: 1

    Until companies and individuals are held accountable, any testing, other than 'getting it to work', may be "too much.

    That's the message I have gotten over the years. Some managers believe it 'fine' to call a project 'done' that hadn't been given any SMP, boundary or stress testing. It might not meet the original design specs, but still be acceptable if it was shippable. I ported some third-person code to a new OS. I found built-in kludges, one of the heinous being a check for a data-object stack overflow that quietly stopped keeping state and kept only 'nesting level' beyond a several-item hard-coded limit. This effectively hid imbalances of pushes-pops in the code something not readily observable unless you
    did thorough testing for expected output and then only if rare routines were called.

    During my work, I found and reported problems and fixed them as part of the porting process. This stopped as the manager reprimanded me for not staying on target and getting the port done. He compromised by allowing me to file the bugs in the bug database but still counted much of that as wasted time.

    The result: the original coder was 'great' and I was a someone who rocked-the-boat and didn't strictly follow orders.

    Other managers have chosen to ignore bugs in hopes that they won't be found because the cost-to-fix was 'too high' (manager might not make his 'schedule'). "Bugs", however, are expected and folded into schedules later on -- they aren't regarded as a negative against the manager or programmer -- they just "exist" like thunderstorms and wind -- random events beyond our control. Keeping schedules, however, is a metric that can be used to evaluate performance.

    It's rare to see metrics on bugs/program or project or /# lines or by department or programmer. Often, looking for why a bug exists or who wrote the code is often seen as "searching for someone to blame". What is important is fixing them. We are not to care why they exist. Speaking of someone's bug-laden code is 'bad-mouthing' them and considered 'unprofessional'.

    What is one to do when market pressures care about who's first -- who's the market leader? Who provides feature "X" first? Who is "innovative" -- and who can get their hands into customer pockets first?

    Often programs are outdated within a few years, so if you can get it out fast and do a few patches for high-profile bugs, that is often more cost effective than more thorough testing up front. Often customers are migrated to 'upgrades' before fundamental flaws in the old
    software become a problem.

    Customers can be forced into new versions by the company just declaring the old version is no longer supported -- and then you have to upgrade to a new version which may not work as well as the original. Then the company stalls for months while working on a patch that, sometimes, you have to pay extra for, via a support contract!

    No *real* warrantee other than maybe being offered a refund -- but if you wanted a working program? Sorry, that's sometimes not available at any price. :-(

  233. Yes, you can over-test by Anonymous Coward · · Score: 0

    I have had to do some off-the-wall things to reproduce bugs found by our test team. Sometimes the attacks the testers launch against our system are just ridiculous, especially for a desk-top app with no connectivity. If the user rapidly clicks his mouse in a concentric pattern at 11:59:59 while humming the star-spangled banner and pouring Mountain-Dew on the keyboard - focus may be set to the wrong field on the UI - sorry but it's going to happen. The problem is that we are compelled to fix all these bugs and fix them quickly. We won't refactor designs or redesign at this point so everything is a hack - we are just making more bugs! I think Hack Attacks are just the way that testers survive their boring mundane jobs. Test the boundaries and stress test but realize that the development team had to meet dead-lines. I have seen test teams test code for 4 months when I only had two weeks to write the code. Guess what? They found bugs.

  234. This is why I love Slashdot by sidecut · · Score: 1

    This is online community at its best. I bookmark disussions such as these because they help me with my job.

    If only I could cite Slashdot to my skeptical PHB. Such is life.