se-edu / guides

Style guides and tutorials for SE student projects
MIT License
7 stars 26 forks source link

[AB3: Tracing Code] Add Debugger features section #20

Closed ruishanteo closed 1 month ago

ruishanteo commented 3 months ago

Current:

Debugger features introduction

image

Problem:

The use of the debugger features is relevant and crucial to the tutorial, but usage of these features are scattered with no explanation of what it means to show execution point, step into a method call, step over logging code or step out.

Proposed:

Include a section at the beginning to introduce features of the debugger and what they are used for.


Understanding Debugger Features

Before diving into tracing code with IntelliJ IDEA’s debugger, it’s essential to understand key debugger features and their purpose. These features help you step through code systematically, inspect variable values, and understand program flow during execution. Here are the primary debugger features you'll use:

Setting Breakpoints

Purpose: Breakpoints pause program execution at specific lines of code. Usage: Place breakpoints at critical points where you want to examine the program state, such as method entry points or before complex operations.

Showing Execution Point

Purpose: Shows the current line of code where the debugger has paused execution. Usage: Helps you navigate directly to the line where the program is halted, providing context for the next step.

Stepping Into a Method Call

Purpose: Steps into the implementation of a method called at the current execution point. Usage: Useful for delving into how specific methods work, especially when you want to understand detailed functionality.

Stepping Over Code

Purpose: Executes the current line of code without stepping into method calls. Usage: Used to skip over lines of code that are not critical for understanding the current flow, such as logging or simple getter/setter methods.

Stepping Out of a Method

Purpose: Executes the remaining lines of code in the current method and returns to the caller. Usage: Useful when you've stepped into a method and want to quickly return to the higher-level context without stepping through every line.

damithc commented 3 months ago

@ruishanteo I've added a Intellij debugging tutorial here Currently it has just a video (this is the same video given in week 6 topics)

Perhaps you can send a PR to add the content you proposed above to the same tutorial page?

damithc commented 2 months ago

I also came across this video https://www.youtube.com/watch?v=IeUZZoZE3sU Do you think this is better than the one we use currently in https://se-education.org/guides/tutorials/intellijDebugger.html?

mfjkri commented 2 months ago

I’d like to share my thoughts on whether we should swap the tutorial video from the original to the new one. Here’s a comparison of both videos based on my observations:

Original Video

Pros:

Cons:

New Video

Pros:

Cons:


TLDR, I think both videos have their strengths and weaknesses. For newer users (which should be the target audience of this guide), the original video might be better as it explains the concept of debugging and illustrates it usefulness slightly better (imo). I think we can still include timestamps for the other features not covered (execute expression and exception breakpoints) as part of the additions.

Let me know what you think!

ruishanteo commented 2 months ago

@mfjkri Thanks for the insights!

I do agree that the battleship example is more complex and thus harder to follow. I thought that the original video went through each feature separately quite well and I do prefer it as well.

I'll include another section in my PR as an extension, for additional information like execute expression and exception breakpoints, linking to the new video.