levo

Problem Solving and Programming

Programming techniques: Use of an IDE to develop/debug a program

  • 1 thing to know
  • Component 02

Overview

Recall questions on integrated development environments, breakpoints, stepping into and over, watch windows, the call stack view, syntax and error highlighting, auto-completion, refactoring tools, and debugging logic errors and stack overflows.

What you need to know

Answer each one before you reveal it.

Your recallNot started
Key term

What is an IDE, and what does it bring together in one place?

Questions from this subtopic

Each one with the model answer underneath.

  1. 1

    What is an IDE, and what does it bring together in one place?

    Model answer

    An Integrated Development Environment is a single application providing the tools needed to write, run and debug programs. Typically: an editor with syntax highlighting, auto-completion and automatic indentation; a built-in translator (compiler or interpreter) and a run-time environment, so code can be executed without leaving the tool; a debugger with breakpoints, stepping, watches and a call stack view; error diagnostics as you type; refactoring tools; and usually a project and file manager, version-control integration and often a drag-and-drop interface designer. The point is that the whole edit-run-debug cycle happens without switching between separate programs.

  2. 2

    What is a breakpoint, and what would you use one for?

    Model answer

    A marker placed on a line of code; when execution reaches that line the program pauses instead of running on, and you can inspect the values of the variables in scope at exactly that moment before continuing or stepping forward. You use one to stop just before the part of the program you suspect, rather than seeing only the wrong answer at the end. For a loop producing the wrong total, a breakpoint on the first line inside the loop lets you see the values going into each addition. Conditional breakpoints, which pause only when a stated condition is true, let you jump straight to the awkward record in a run of thousands.

  3. 3

    Debuggers offer step into and step over. What does each do, and when would you use each?

    Model answer

    Stepping runs the program one line at a time so you can watch the flow. Step into follows execution inside a subroutine call, so you walk through that subroutine line by line — use it when the subroutine itself is the suspect. Step over runs the whole call as a single step and stops on the next line of the routine you are in — use it when you trust that subroutine and want to stay focused on the code you are debugging, which saves wading through library routines. Most debuggers also offer step out, which runs the rest of the current subroutine and pauses as soon as it returns, for when you have stepped into something by mistake.

  4. 4

    What do a watch window and variable inspection give you that reading the code cannot?

    Model answer

    They show the actual values the program is holding at the moment it is paused, rather than the values you believe it should hold. Variable inspection lists the variables in scope at the paused point with their current contents; a watch lets you nominate specific variables or expressions and see them update as you step. Together they let you catch the exact moment a value goes wrong: step through a loop watching the counter and the running total against your own hand calculation, and the iteration where they first disagree identifies the faulty line. They also reveal the values of parameters actually received, which often differ from those intended.

  5. 5

    What does the call stack view show, and which kind of bug does it find fastest?

    Model answer

    It lists the chain of subroutine calls that led to the point where the program is paused or crashed, innermost call first, together with the line each call was made from. It answers the question 'how did the program get here'. It is the quickest way to diagnose a stack overflow caused by runaway recursion, because the list shows the same subroutine repeated over and over, which points straight at a missing or unreachable base case, and the parameter values shown for each frame reveal whether the argument is failing to move towards the base case. It is also how you find which of several callers passed bad data into a shared subroutine that is itself correct.

  6. 6

    Syntax highlighting and error highlighting are different facilities. What does each do for you?

    Model answer

    Syntax highlighting colours the different elements of the code — keywords, strings, comments, numbers — so its structure is visible at a glance and mistakes stand out visually: a string that stays coloured past where it should end reveals a missing closing quote, and a block of code coloured as a comment reveals a comment that was never closed. Error highlighting is the IDE actively checking as you type and marking, usually with a coloured underline, code it cannot make sense of — a name that has not been declared, an unmatched bracket, the wrong number of arguments in a call — so that errors of form are found and fixed before the program is ever run.

Other ways to work this

The same content, four other ways.

What is inside Levo

Six ways to work the same material.

1Closed book
2Open book
3Closed book

The 3-step method, run for you

Answer cold, learn it, then prove it stuck. Levo tracks the jump between your first attempt and your last.

Processors: Structure, Performance and Types
Input, Output and Storage
Systems Software
Applications Generation

Cram a whole paper in one sitting

Sort every topic into what you know and what you do not, then drill only the weak ones.

If it matches, the search .
succeedsfailsrestarts

Blank Blitz makes facts automatic

Rapid timed gap-fills on the terms and numbers you need to recall without thinking.

A0 + 0 gives 0.
B0 + 1 gives 1.
C1 + 1 gives 0 carry 1.

Build It gets the exam shape right

Assemble a full-mark answer from its marking points, in the order an examiner wants them.

A global variable means a variable reachable from anywhere in the program.
TrueFalse

Test It catches misconceptions

Spot the fault in a statement. The traps are the mistakes students actually make.

721941163128510

Brain Breaks between sessions

Short focus games to reset attention, so the next set lands better than the last.

Every question in Problem Solving and Programming, on a schedule.

Attempt a question from memory, write the correct version, then attempt it again. Levo records the jump between your first attempt and your last, and brings each question back on the day you are due to forget it.

Or £46 a year, about £3.83 a month. Cancel anytime.