Debugging strategies in software engineering
Change Language. Related Articles. Table of Contents. Improve Article. Save Article. Like Article. Debugging : Debugging is the process of finding and resolving defects or problems within a computer program that prevent correct operation of computer software or a system.
Challenges in Debugging: There are lot of problems at the same time as acting the debugging. Debugging is typically performed under a tremendous amount of pressure to fix the supported error as quick as possible. It can be difficult to accurately reproduce input conditions. Compared to the alternative software program improvement activities, relatively little research, literature and formal preparation exist at the procedure of debugging.
Debugging Approaches: The following are a number of approaches popularly adopted by programmers for debugging. Brute Force Method: This is the foremost common technique of debugging however is that the least economical method. Functions also allow a program to operate the way software developers and engineers intended. Breakpoint: When you use a compiler to execute program code, you can use breakpoints to stop the code from running in sections that contain a previously identified error.
People typically use breakpoints while investigating an exception or a similar event during the debugging process. Input: This word refers to the coding language that instructs a program to complete a certain action or function. You can input a coding language into a compiler to see if a program works. Output: This represents the coded data a program creates after you execute it using a compiler, and it typically looks different from the input because of how the functions in the code interact.
People typically debug a program to make the output reflect an expected arrangement of data. Debugging is important because it allows software engineers and developers to fix errors in a program before releasing it to the public.
It's a complementary process to testing, which involves learning how an error affects a program overall. If you examine each section of code, you can discover which variables and functions to adjust systematically. Debugging can also improve the quality of a product, which may increase the number of positive reviews a company receives. Here are some examples of common errors you can encounter while debugging and how to address them:.
Syntax errors are grammatical interruptions in a line of code. For example, an extra bracket or period might cause a syntax error to occur. A compiler can often recognize a syntax error then notify you in a separate message screen about where it is in the code and how to fix it using a debugging tool.
Some compilers also highlight them when you first load the program's code into the system. Logic errors are issues in the code's algorithms. They can occur when a program's code produces an unexpected output or causes the program to stop working. For example, adding two number-type variables when you intended to divide them might cause a logic error.
You can resolve logic errors by using a debugging tool to carefully examine the variable causing the issue in a line of data. Run-time errors occur when a person uses the program and they're detected by the computer executing it. They can still appear after you finish an initial debugging process because a computer might interpret the program's code in an unexpected way. For example, an operating system might format code in a certain configuration that renders it unusable.
To address these errors, it's important to ensure an operating system has the information it needs to run a program correctly. Interface errors involve a disconnect in an API, which means one or both coding languages in an API cause this error to occur.
For example, an API might have certain requirements that are only present in the code of one program. To address an interface error, compare and contrast lines in your code with the other.
Be sure to have records of any debugging and testing processes you completed in the past to help streamline this step. Consider the following list of eight debugging strategies to try:. Most debugging tools have a particular feature that allows you to debug sections of code using your own methods. This strategy might be especially helpful if the code produces unexpected results outside of a compiler's capacity to find and address them.
To use debugging mode, identify the proper steps in your specific software. In this course we will use Stendhal as an example to help you develop better debugging skills, see figure 3. Figure 3. Debugging xkcd. Before the workshop begins, please follow the instructions below to prepare your machine for the activities we will do in the workshop today.
We are going to use the Stendhal code base to illustrate the topics under discussion. This will involve you reading the Stendhal code, and making some small changes. To prepare for the workshop, you need to clone the repository and import it into your preferred IDE. If you are using Eclipse and need a reminder of what to do, you can follow the steps we took in the Week 1 workshops, when we cloned and imported the Marauroa code base.
Eclipse users will need to create a new workspace to import this project into. In this workshop, we will look at techniques for debugging unfamiliar codebases such as those encountered throughout the COMP marauroa and stendhal , when contributing to open source projects or when working with other legacy codebases e.
Note that unlike the other COMP workshops so far, this workshop will focus on debugging the stendhal codebase rather than marauroa. This workshop should have direct application in the first team coursework exercise. The workshop builds on techniques given in Workshop 2 for navigating large, unfamiliar codebases. In this workshop you will:. As in prior workshops, there will be scope to work through the task at your own pace. This is an ambitious workshop task. However, you should aim to have completed steps by the end of the workshop, or at least to have narrowed down the source of the problem considerably.
Ideally, you would have a clear idea what fix should be applied. Note that although these are represented as six distinct steps, the reality is that there are times when some of the steps may overlap. For example, if you decide to add test cases to help you stabilise your understanding of the problem 2 ; this will probably require you to take some steps towards isolating the source of the problem 3 as you will need to decide which portions of the code should be subjected to the test cases you are going to write.
It should be relatively intuitive to figure out how this quest should work. However, we want to avoid assumptions and so you are strongly encouraged to view the stendhal documentation for this quest: stendhalgame. For a full list of admin commands and details of how to make a player an admin user see: stendhalgame. Following an initial confirmation that there is some odd behaviour with this quest, we now need to develop a more detailed understanding of the problem.
What are the cases in which this quest behaves as expected? When does it not behave as expected? Note also that your problem statement will likely continue to be revised as you work through the rest of the process. To locate the parts of the computer system in this case software that are causing the problem, we first need to select one or more strategies and tactics that we will use as tools in our investigation.
For the purposes of debugging, you should think of a strategy as a broad approach, and tactics as the set of specific actions or equipment you will use to follow the strategy. Note that not all strategy—tactic pairs will make sense to use together.
0コメント