Home > Ask the Software Quality Experts > Software Testing and Quality Assurance Questions & Answers > What are some debugging shortcuts to reduce frequent debugging?
Ask The Software Quality Expert: Questions & Answers
EMAIL THIS

What are some debugging shortcuts to reduce frequent debugging?

John Overbaugh EXPERT RESPONSE FROM: John Overbaugh

Pose a Question
Other Software Quality Categories
Meet all Software Quality Experts
Become an Expert for this site


Software quality news and advice
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


>
QUESTION POSED ON: 07 April 2009
Debugging takes up a lot of my team's time. What are some shortcuts, process changes or alternatives that can reduce the need to debug frequently? How can TDD or IDE help?

>

I'm going to assume that, by debugging, you mean stepping through code to find the source of a bug. This can definitely be an expensive activity, and there are ways to prevent it from happening -- but the root is preventing defects. Not a lot of engineers (especially testers, but engineers in general) think of themselves as defect prevention experts, but this is where I expect myself and my engineering teams to be. Our job as a unified team is to think about patterns, practices and processes which reduce the defect introduction rate -- because a defect not written is GUARANTEED to be a defect not shipped!

A reactive approach to reducing your debugging time is to ensure you have sufficient logging enabled. Some tools I've worked with have only been debuggable through "print screen debugging" or execution-time logging. By logging more robustly you'll provide more info in the form of logs, sometimes providing visibility into what you need without requiring a debugging session. A couple of things to consider: make your logging levels run-time switchable. This allows you to move from error-only to assert to deep logging. Set your default logging level to the lowest possible level -- this adheres to Microsoft's recommendation of "secure in deployment." Often, deeper logging reveals information assets such as user names and other object-level values. By specifying the lowest level by default, you reduce the risk of accidental disclosure in production. And make sure your logging is in an easy-to-read format.

One proactive way to look at the solution is, rather than looking for shortcuts around debugging, to look for shortcuts which are resulting in defects. Are your developers writing solid unit tests? You mention test-driven development (TDD), which may be a good step toward reducing defects, depending on how seriously the development team takes them. Basically, any activity you do which focuses on defect detection and defect prevention will result (if done right) in fewer defects and less debugging. Any time the engineering team gets lazy and takes shortcuts, defects will result. It's the same as a machinist who gets lax on the job and turns out parts which are just slightly off. Engineering takes discipline and consistency!

The next thing to consider is configuration management. Today's J2EE and .NET environments are complex and evolve rapidly. One of the key sources of defects in these environments is poor change management -- a piece of code might function in the development sandbox but fails to even boot (or, worse yet, shows infrequent, random unexpected behavior) in the test bed. This is often caused by poor configuration management. Some configuration management issues need to be fixed at the development level -- for instance, if there are hard-coded environmental variables in source code, they need to be moved into configuration settings. In other cases, automated configuration scripts can be beneficial. By automating your configuration, you guarantee the same settings will be applied in each environment. Manage your configuration scripts just like source code -- keep them in a repository, check them in when finished, and include comments in them. Automated configuration reduces variables -- it reduces the defect rate and the "surface area" for debugging, should a defect be discovered.

Also, consider your data. With data, one of two things can cause defects: not having production-like data in your development environment, which allows defects to slip by in development which are caught (hopefully) in production, or having a bunch of automated data in development which causes false defects because the data was poorly modeled. I generally like to see small databases freshly created at the unit and functional test level, and then I like to see production-influenced databases (if not the production database itself) at the system and customer acceptance test level. Those small, clean databases reduce the likelihood of a defect cropping up and allow development to focus on delivering customer stories. Often what you'll see, however, is that a clean database in the development sandbox does not accurately reflect what's out in production. Modeling and deploying a production-like database at the dev level takes investigation, but by modeling your data and deploying it in development, you can capture the most common data structures without having to keep a production database around (and without the security issues which are potentially associated with having production data in your development environments).

Finally, what does your code look like? In agile and waterfall alike, your code is your heartbeat; you live and die by it. If your code is "spaghetti code" (weaving and winding all over the place) and difficult to read, not only will it likely have a higher defect rate per KLOC, but it'll also take forever to debug. If developers aren't commenting code sufficiently, even the cleanest code can be a challenge for someone to debug. As engineers, we need to consider our legacy -- and that legacy is printed in our code. Good teams will take time to comment code clearly. Good teams will also refactor when code trends toward unreadable. I have seen testers post and stand by defects related to code complexity, code readability and code commenting. And I support them as they do this -- in most cases, it makes more sense to take a little extra time and write readable, maintainable code during implementation than to breeze through the code and pick up the pieces later on. The refactor is easier when the code is fresh in the mind -- if you have to return to code you authored nine months ago, well, your ability to read it will be challenged!

So consider your debugging in terms of reactive approaches (increased logging) as well as proactive defect-prevention. The steps you take now to cut down your defect rate will reduce the time you spend debugging and will produce more elegant code.


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google



RELATED CONTENT
Software Testing and Quality Assurance
Why do performance testers write new scripts so often?
How to create performance testing workload models
Fixing Web application performance troubleshooting problems
Expert advises on implementation of Selenium IDE for effective software testing
When should regression testing occur in an automated test plan?
Achieving peak performance in integration testing
Getting answers about OpenSTA script problems
Defining core software regression tests
Breaking in functionality on UI application pages
Where to find good methodology guides for software testing

Software bug tracking
Developing test design driven software
Inexpensive phase of SDLC to catch and fix bugs
Using virtual lab management tools to stop developer, QA conflicts
Social engineering training could disrupt botnet growth
Cybersecurity czar candidate questions clout of new position
10 steps to acing Web app security assessments
Budget-friendly Web app performance testing, monitoring tips
Improving problem resolution through automation
Benefits of a bug diary
Software bugs, errors and defects: What's the difference?

Software configuration and change management
IT operations get help testing software, infrastructure changes
Business mashup assists application release process
AccuRev software configuration management tool links to IBM's ClearCase
Software patching principle

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
cruft  (SearchSoftwareQuality.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary



Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice



Software Quality - Software Maintenance, Software Requirements, Software Standards
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2006 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts