By the end of this chapter, you will be able to:
Mastering these skills helps you create reliable and high-quality desktop applications that work exactly as intended in the real world.
Compiled by: Stephen Mbugua
Debugging desktop applications is a critical skill for software developers in Kenya’s growing technology sector. With increasing reliance on desktop software in banks, hospitals, educational institutions, and government offices, ensuring code quality through effective debugging enhances product reliability and user satisfaction. This chapter delves into practical approaches to identify and fix bugs, starting with source code inspection and extending to the use of advanced debugging tools, equipping developers with techniques essential for professional software delivery.
Checking source code for bugs and errors is the foundational step in the debugging process. This activity involves systematically examining the code to detect mistakes that can cause the application to behave unexpectedly or fail. In Kenya’s competitive software development environment, especially in firms developing desktop solutions for sectors like finance and education, early detection of errors reduces costly post-deployment fixes and improves software quality.
Static code analysis refers to the automated examination of source code without executing the program. It helps identify potential errors, code smells, and security vulnerabilities early in the development cycle.
For instance, a software house developing a desktop inventory system for a retail chain in Nairobi utilizes tools such as SonarQube integrated into their CI/CD pipeline. This setup automatically flags issues every time code is committed, allowing developers to address problems before integration.
Manual code review involves developers examining each other’s code to detect logical errors, design flaws, and adherence to best practices. This collaborative process enhances code quality beyond what automated tools can achieve.
In Kenyan software firms, time constraints and skill disparities can hinder thorough reviews. To mitigate this, some companies schedule dedicated review periods and provide training on code quality standards, enhancing overall team competence.
Create a free account to open more of this chapter.
Free: practical guides, quick cards, workplace scenarios and more.
Create a free accountThis chapter explored the essential processes involved in debugging desktop applications, starting with methods for checking source code for bugs and errors. It examined techniques for static code analysis that help identify potential issues without executing the program and highlighted the value of manual code review practices in detecting logical and syntactical mistakes. The discussion then moved to the use of debugging tools, providing an overview of popular options such as GDB and Visual Studio Debugger, and outlined best practices for their effective use, including setting breakpoints, utilizing step options, managing runtime commands, and examining variables and expressions during execution. The chapter also covered regression testing, differentiating between automated and manual approaches, and explained strategies for selecting appropriate test cases to ensure that recent changes do not introduce new faults. Finally, it emphasized the importance of documenting source code changes through version control systems like Git, along with best practices for maintaining clear and concise documentation to support ongoing development and collaboration.
Type: Individual
| Tools & Equipment | Materials |
|---|---|
| Computer installed with Visual Studio 2019 or later | Notebook and pen |
| Printed source code listing |
| S/N | Item | Quantity |
|---|---|---|
| 1 | Computer installed with Visual Studio 2019 or later | 1 Pc per Candidate |
| 2 | Printed source code listing (buggy desktop application) | 1 Set per Candidate |
| 3 | Notebook and pen for manual notes | 1 Pc per Candidate |
| Items to be Evaluated | Marks Available | Marks Obtained | Comments |
|---|---|---|---|
| TASK 1: Review Source Code for Bugs and Errors | |||
| Wears appropriate PPE (e.g., safety goggles if applicable) (Award 1 mark for wearing PPE or zero) | 1 | ||
| Carefully reads through the entire source code (Award up to 3 marks based on thoroughness of code review) | 3 | ||
| Identifies syntax errors such as missing semicolons, unmatched brackets (Award 1 mark per correctly identified syntax error, up to 3 marks) | 3 | ||
| Identifies logical errors such as incorrect conditionals or loops (Award 1 mark per correctly identified logical error, up to 3 marks) | 3 | ||
| Identifies runtime errors such as null reference or division by zero risks (Award 1 mark per correctly identified runtime error, up to 2 marks) | 2 | ||
| Lists at least 10 distinct bugs or errors clearly in the notebook (Award up to 5 marks depending on number and clarity of bugs/errors listed) | 5 | ||
| Sub-Total | 17 | ||
| PRODUCT CHECKLIST | |||
| A clear, neatly written list of at least 10 bugs and errors related to the source code (Award 8 marks for a comprehensive and accurate list matching or exceeding 10 bugs/errors) | 8 | ||
| Sub-Total | 8 | ||
| GRAND TOTAL | 25 | ||
Type: Individual
| Tools & Equipment | Materials |
|---|---|
| Computer installed with Visual Studio 2022 | Source code files of a desktop application in C# |
| Static code analysis tool (e.g. SonarLint for Visual Studio) | Rewritable Compact Disc (CD-RW) |
| S/N | Item | Quantity |
|---|---|---|
| 1 | Computer installed with Visual Studio 2022 | 1 Pc per Candidate |
| 2 | Static code analysis tool (e.g. SonarLint for Visual Studio) | 1 License per Candidate |
| 3 | Source code files of a desktop application in C# | 1 Set per Candidate |
| 4 | Rewritable Compact Disc (CD-RW) | 1 Pc per Candidate |
| Items to be Evaluated | Marks Available | Marks Obtained | Comments |
|---|---|---|---|
| TASK 1: Setup and run static code analysis | |||
| Opened source code project in Visual Studio (Award 2 marks) | 2 | ||
| Installed and configured static code analysis tool correctly (Award 3 marks) | 3 | ||
| Executed static code analysis scan on the source code (Award 3 marks) | 3 | ||
| Generated report listing detected code issues (Award 2 marks) | 2 | ||
| Sub-Total | 10 | ||
| TASK 2: Analyze and document code issues | |||
| Categorized issues by severity (e.g. errors, warnings, code smells) (Award 3 marks) | 3 | ||
| Provided clear descriptions for at least 5 identified issues (Award 1 mark each for 4 or 5 issues) | 4 | ||
| Suggested possible corrective actions for each issue documented (Award 3 marks) | 3 | ||
| Sub-Total | 10 | ||
| TASK 3: Save and submit analysis report | |||
| Saved the static code analysis report in PDF format (Award 2 marks) | 2 | ||
| Copied report and source code files to CD-RW (Award 2 marks) | 2 | ||
| Ejected and labelled the CD-RW correctly (Award 1 mark) | 1 | ||
| Sub-Total | 5 | ||
| PRODUCT CHECKLIST | |||
| Report contains correctly identified code issues with severity classification (Award 5 marks) | 5 | ||
| Report includes clear descriptions and suggested corrective actions for issues (Award 5 marks) | 5 | ||
| Report and source code files are saved on CD-RW and labelled properly (Award 5 marks) | 5 | ||
| Sub-Total | 15 | ||
| GRAND TOTAL | 40 | ||
At the start of this chapter we promised you would be able to:
Tick each one you can genuinely do.
So, are you there yet?
You're competent when you can confidently do 50% or more of what this chapter promised.
Sign in to record how you're doing.