What I Built
I built DebugBuddy, a beginner-friendly AI debugging assistant designed around a common problem faced by a friend who is learning Java DSA: understanding why a solution produces the wrong answer.
While learning DSA, it is common to understand the problem but still get stuck when the code does not work as expected. DebugBuddy is designed to make that debugging process easier to understand.
The user provides:
- A DSA problem
- Their Java code
- What they are stuck on
DebugBuddy then provides:
- Problem Understanding
- Hint
- What's Wrong
- Dry Run
- Correct Approach
- Time Complexity
- Space Complexity
- Practice Question
The goal is not just to provide an answer, but to help the learner understand why their code failed.
Demo
I recorded a short demonstration of DebugBuddy analyzing a Java DSA problem involving finding the maximum element in an array.
In the example, the code initializes max to 0, which produces the wrong result when all the array elements are negative. DebugBuddy identifies the issue, performs a dry run, and explains the corrected approach.
Demo video:
Code
The complete source code is available on GitHub:
GitHub: https://github.com/ChikkalaSukrutiNaidu/DebugBuddy
How I Built It
I built DebugBuddy using Python and Streamlit for the application interface.
For the AI component, I used the open-weight model:
Qwen/Qwen2.5-Coder-7B-Instruct
through the Hugging Face Inference API.
The application sends the DSA problem, Java code, and the student's difficulty to the model and requests a structured debugging explanation.
I designed the prompt so that DebugBuddy focuses on:
- Identifying the primary bug
- Using the submitted code as the basis for the explanation
- Performing a faithful dry run
- Avoiding invented bugs
- Separating the primary bug from edge cases
- Providing a corrected Java approach
- Explaining time and space complexity
- Giving a related practice question
The project intentionally keeps the architecture simple. It does not use Ollama, LangChain, LangGraph, FAISS, or a database.
Why Does Open Innovation Matter?
I chose an open-weight model because open models give developers more flexibility when building AI applications.
With an open-weight model such as Qwen2.5-Coder, developers can experiment with the model and evaluate it for their own use cases. Open models can also provide flexibility around model choice and inference setup.
For DebugBuddy, I currently use Hugging Face hosted inference. This means students do not need a powerful local GPU just to experiment with the application.
At the same time, using an open-weight model gives the project a foundation that can be explored and adapted further as the project develops.
My Agent Session
I used AI assistance during development to help with implementation, debugging, documentation, and testing.
The development process included testing DebugBuddy with Java DSA examples and refining the instructions given to the model so that the generated explanations would stay focused on the submitted code.
Conclusion
DebugBuddy is my attempt to make Java DSA debugging more understandable for beginners.
Instead of simply showing the final solution, it focuses on the reasoning behind the mistake — including hints, dry runs, corrected approaches, and complexity analysis.
Top comments (0)