Programming Concepts: IDEs, Debug. Paulo Penteado. (http://phdcomics.com/comics/archive.php?

Similar documents
NetBeans Tutorial. For Introduction to Java Programming By Y. Daniel Liang. This tutorial applies to NetBeans 6, 7, or a higher version.

Supplement H.1: JBuilder X Tutorial. For Introduction to Java Programming, 5E By Y. Daniel Liang

Supplement II.B(1): JBuilder X Tutorial. For Introduction to Java Programming By Y. Daniel Liang

Using a debugger. Segmentation fault? GDB to the rescue!

Unit 13. Linux Operating System Debugging Programs

tutorial : modeling synaptic plasticity

Introduction to Python Part 2

Before you start with this tutorial, you need to know basic Java programming.

IDE: Integrated Development Environment

Using the Command Line

Eclipse Tutorial. For Introduction to Java Programming By Y. Daniel Liang

What s NetBeans? Like Eclipse:

CSE 374 Programming Concepts & Tools

Unveiling Zend Studio 8.0

GETTING STARTED WITH ECLIPSE Caitrin Armstrong

CSCI0330 Intro Computer Systems Doeppner. Lab 02 - Tools Lab. Due: Sunday, September 23, 2018 at 6:00 PM. 1 Introduction 0.

LECTURE 3 ADMINISTRATION SECTION -A

The C Programming Language

An Introduction to Software Engineering. David Greenstein Monta Vista High School

CSE 374 Programming Concepts & Tools. Hal Perkins Fall 2015 Lecture 15 Testing

Scientific Computing: Lecture 1

LABORATORY OF DATA SCIENCE. Python & Spyder- recap. Data Science & Business Informatics Degree

Introduction to Software Systems Unix C + GNU HTML Perl Python

Module Road Map. 7. Version Control with Subversion Introduction Terminology

Coding Tools. (Lectures on High-performance Computing for Economists VI) Jesús Fernández-Villaverde 1 and Pablo Guerrón 2 March 25, 2018

Objects and Classes Lecture 1

FEATURES EASILY CREATE AND DEPLOY HIGH QUALITY TCL EXECUTABLES TO ANYONE, ANYWHERE

JDB - QUICK GUIDE JDB - INTRODUCTION

Scientific computing platforms at PGI / JCNS

1 Introduction to MARS

Section 2: Developer tools and you. Alex Mariakakis (staff-wide)

Introduction to the basics of UNIX

Eclipse CDT Tutorial. Eclipse CDT Homepage: Tutorial written by: James D Aniello

What Is NetBeans? Free and open-source based > Open source since June, 2000 > Large community of users and developers

Heat An Interactive Development Environment for Learning & Teaching Haskell

Python Training. Complete Practical & Real-time Trainings. A Unit of SequelGate Innovative Technologies Pvt. Ltd.

Software Engineering Testing and Debugging Debugging

Program Design: Using the Debugger

Continue: How do I learn C? C Primer Continued (Makefiles, debugging, and more ) Last Time: A Simple(st) C Program 1-hello-world.c!

Under the Debug menu, there are two menu items for executing your code: the Start (F5) option and the

Today s Topic. Software Engineering Testing and Debugging Debugging. Today s Topic. The Main Steps in Systematic Debugging

WRITING CONSOLE APPLICATIONS IN C

Course Introduction and Python Basics

Introduction to IDL. 1 - Basics. Paulo Penteado

Python for Finance. Introduction and Basics of Python. Andras Niedermayer

Testing, Debugging, Program Verification

Semester 2, 2018: Lab 1

Code::Blocks Student Manual

CUDA Development Using NVIDIA Nsight, Eclipse Edition. David Goodwin

Intermediate Python 3.x

10/9/2012. Sample C# program:

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 2: SEP. 8TH INSTRUCTOR: JIAYIN WANG

Unit 10. Linux Operating System

Scientific Computing

Computational Mathematics with Python

From theory to practice: Standard tools Software carpentry, Part II. Pietro Berkes, Brandeis University

Weekly Discussion Sections & Readings

IBM VisualAge for Java,Version3.5. Distributed Debugger for Workstations

CSE 4/521 Introduction to Operating Systems

An Introduction to Komodo

25. DECUS Symposium THE Application Development Environment for OpenVMS

1.00 Lecture 2. What s an IDE?

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer

1. Introduction. Java. Fall 2009 Instructor: Dr. Masoud Yaghini

Introduction to Python for Scientific Computing

Installing Enterprise Architect inside WINE

C++ for Everyone, 2e, Cay Horstmann, Copyright 2012 John Wiley and Sons, Inc. All rights reserved. Using a Debugger WE5.

JUCE TUTORIALS. INTRO methodology how to create a GUI APP and how to create a Plugin.

PTN-202: Advanced Python Programming Course Description. Course Outline

SQL Server 2017: Data Science with Python or R?

Introduction to Java. Lecture 1 COP 3252 Summer May 16, 2017

Table of Contents HOL-SDC-1422

Principles of Bioinformatics. BIO540/STA569/CSI660 Fall 2010

Episode 1 Using the Interpreter

Getting Started with Python

Hello World! Computer Programming for Kids and Other Beginners. Chapter 1. by Warren Sande and Carter Sande. Copyright 2009 Manning Publications

There are a few important ways that Smalltalk is different then other languages:

52 Remote Target. Simulation. Chapter

Python for Finance. Introduction and Basics of Python. Andras Niedermayer

The Computer System. Hardware = Physical Computer. Software = Computer Programs. People = End Users & Programmers. people

Command Line Parameters Linux Copy File To

PYTHON FOR MEDICAL PHYSICISTS. Radiation Oncology Medical Physics Cancer Care Services, Royal Brisbane & Women s Hospital

Center for Systems and Software Engineering University of Southern California. Center for Systems And Software Engineering. UCC v.2011.

Javadocing in Netbeans (rev )

Embedding Graphics in JavaDocs (netbeans IDE)

Debugging (Part 1) The material for this lecture is drawn, in part, from The Practice of Programming (Kernighan & Pike) Chapter 5

II. Compiling and launching from Command-Line, IDE A simple JAVA program

Introduction to Computation and Problem Solving

CS 190C: Introduction to Computational Thinking

dbx90: Fortran debugger March 9, 2009

Using the Debugger. Michael Jantz Dr. Prasad Kulkarni

News in RSA-RTE 10.2 updated for sprint Mattias Mohlin, May 2018

Slide 1 CS 170 Java Programming 1 Duration: 00:00:49 Advance mode: Auto

Scientific Programming, Analysis, and Visualization with Python. Mteor 227 Fall 2017

Python Documentation For Windows Xp 32 Bit Full Version

Introduction to IntelliJ

Reviewing gcc, make, gdb, and Linux Editors 1

Introduction to Problem Solving and Programming in Python.

Setting up a compiler

Manual Eclipse CDT Mac OS Snow Leopard

Transcription:

Programming Concepts: IDEs, Debug Paulo Penteado http://www.ppenteado.net/pc/ (http://phdcomics.com/comics/archive.php?comicid=1690)

IDEs Interactive Development Environments Exist for every language (even stuff like LaTeX, HTML, CSS). Provide a single environment for editing compiling / packing running debugging file inspection (any file, not only source files) documentation access profiling (performance measurement) interactive use GUI (graphical interface) building The IDE knows the language being use. Very useful, often ignored tool (when one uses, instead, text editor + command line). Some IDEs are multilanguage and multiplatform.

IDEs Main examples: Eclipse nearly any platform and language (even obscure ones like IDL, R) Spyder multiplatform, Python only Enthought Canopy multiplatform, Python only MS Visual Studio - Windows, C, C++, VB, C#, and several others (only the Express version, more limited, is free) NetBeans any platform, Java, C, C++, e several others Xcode - Mac, C, C++, Objective C, Java, and several others Solaris Studio (old Sun Studio) - Linux, Unix, C, C++, Fortran C++ Builder (old Borland C++) - Windows, C, C++ (commercial) The editors in the IDEs are the most capable, because they know the languages: Syntax highlighting. Context help. Integrated debugger setting and using breakpoints, looking up variable values. In some languages, show error codes live errors, similarly to spellcheckers (not only syntax errors: might show errors in function arguments).

IDEs example (Eclipse, integrated to IDL 7)

IDEs example (Spyder)

Not quite an IDE IPython notebook

Debug what is a debugger? The most helpful tool to diagnose and fix bugs. (specially if used in an IDE). Provides a live and interactive analysis of the program execution. Like seeing what goes on inside a machine, while it runs. Much easier to see where the problem is. The most common debugging approach: If the program crashes, see which line of code caused it. Inspect the program's variables, and how they change during program execution. A common, slow, tiresome alternative is fill the program with prints, to know where it is, and the values / characteristics of some variables. Debuggers allow interactive inspection, much faster and more flexible than prints.

Debug what does a debugger do? Runs the code, observing where it goes and what it does. When an interruption happens (error, interactively, or reaching a breakpoint), the debugger provides: Contents, type and dimensions of every variable in scope. Evaluation / visualization / function calling / analysis of expressions with the variables. Arguments used when the current function was called. Call stack the sequence of function calls that led to the current point. Call stack navigation change the current scope among different points in the call stack. Incremental code execution take gradual steps, to see the changes that happen when each [line / function / code fragment] is executed. Possibly skipping lines that cause trouble. Change the values in some variables, before resuming execution.

Debug example (Eclipse, integrated to IDL 7)

Debug example (Spyder)

Debug example (IPython) [penteado@javelina r4]$ python -m pdb /home/penteado/mod/acepairs.py -f 56570.8292426.sex > /home/penteado/mod/acepairs.py(4)<module>() -> import sys, re, string, os, getopt, math, numpy (Pdb) b /home/penteado/mod/acepairs.py:890 Breakpoint 1 at /home/penteado/mod/acepairs.py:890 (Pdb) c [ 56570.8292426 56570.8311639 56570.8330852 56570.8350065 56570.8369278 56570.8388491 56570.8407704] starting to find pairs > /home/penteado/mod/acepairs.py(890)find_pairs() -> T1 = KDTree(self.pos[group]) (Pdb) dir() ['group', 'i', 'llim', 'pair_1st', 'pair_2nd', 'rad', 'self', 't', 'ulim'] (Pdb) ulim 56570.831163899995 (Pdb) bt /share/apps/local/ureka/python/lib/python2.7/bdb.py(400)run() -> exec cmd in globals, locals <string>(1)<module>() /home/penteado/mod/acepairs.py(940)<module>() -> process() /home/penteado/mod/acepairs.py(82)process() -> pairs = dataset.find_pairs(opt.maxpairsep) > /home/penteado/mod/acepairs.py(890)find_pairs() -> T1 = KDTree(self.pos[group]) (Pdb) dir(self) [' doc ', ' init ', ' module ', 'clubs', 'data', 'diff', 'filename', 'tbins', 'times']

Debug programming pearls Don't debug standing up. It cuts your patience in half, and you need all you can muster, Dave Storer, Cedar Rapids,Iowa Testing can show the presence of bugs, but not their absence. Edsger W. Dijkstra, University of Texas Each new user of a new system uncovers a new class of bugs. Brian Kernighan, Bell Labs The first step in fixing a broken program is getting it to fail repeatably. Tom Duff, Bell Labs http://users.erols.com/blilly/programming/programming_pearls.html

Some references Tutorial: Debugging your Python Applications with pdb https://www.youtube.com/watch?v=bzztekprslq The IPython Notebook (including video demo): http://ipython.org/notebook.html The Notebook Gallery (including the book Lectures on Scientific Computing with Python, written as IPython Notebooks): https://github.com/ipython/ipython/wiki/a-gallery-of-interesting-ipython-notebooks Spyder video tutorial: https://www.youtube.com/watch?v=4iu7urzxzey (one of several from Firebox Training, http://www.fireboxtraining.com/blog/python-tutorials)