Download presentation
Presentation is loading. Please wait.
Published byMarsha O’Neal’ Modified over 8 years ago
1
Debugging using By: Samuel Ashby
2
What is debugging? A bug is an error in either a program or the hardware itself. Debugging is first locating and then fixing or bypassing bugs. Need to isolate the source of the problem.
3
Text Editors IDEs are complicated and take time and patience to learn to use its features. When learning a language a text editor hides nothing and can help a programmer become more proficient with the language. An IDE won’t fix terrible code.
4
PyCharm Benefits It takes a lot less time and effort to develop an application in PyCharm or any IDE than not using one at all. The tools and features that come with an IDE provide shortcuts to commonly used code or other code you may have already done. Less time is spent debugging because the IDE catches onto mistakes. Project management is easier because you don’t need to go back and forth looking in the file system for something you need to edit.
5
Starting Off Need to create a new project once in PyCharm. It is also possible to just open a file. Using a project rather then a single file makes project management easier.
6
Project Interpreter What is a project interpreter and why is it needed? The interpreter is what is actually compiling the python code to run. Get the interpreter download from http://python.org, they have a download tab on the main page. http://python.org Select python.exe from its directory for use as the project interpreter in PyCharm.
7
PyCharm Assistance All syntax errors are underlined with a red wavy line. Will make smart suggestions. PyCharm integrates with PEP8 to guard code integrity and report any code style violations to you.
8
Running your application Example: Syntax Error after running
9
Debugging Options Finding the origin of the bug yourself by using the information given to you in the console after the run-time error. OR Open a debug session in PyCharm.
10
What is a debug session? It is working with a interactive debugger console that PyCharm provides that enables you to view the output and messages. The interactive console has features like typing and executing commands in its own pane, load source code from the editor into the console, view a history of commands, and basic code completion.
11
Breakpoints Breakpoints are markers in your source code that trigger actions during a debugging session. A breakpoint is displayed in the left gutter area and it will have a small icon denoting its status. Clicking an icon removes the breakpoint. Alt-Clicking on an icon toggles its state between enabled and disabled.
12
Interface Frames Pane: shows a list of threads in your application. Variables Pane: lets you examine the values store in the objects of your application. Watches Pane: here you evaluate any number of variables or expressions in the current stack frame.
13
Overview of Options The debugger is graphical and has features like breakpoints, frames view, and watching/evaluating expression that you didn’t have otherwise. Extra features may get in the way of simpler bug fixes. May help with bigger projects that you can’t easily find the origin of bugs. Clean code always prevails.
14
The takeaway? IDEs like PyCharm have plenty of features to aid in the process of coding and debugging without doing enough that would make the programmers job useless.
15
Questions?
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.