CSC 216/s08/on good terms: Difference between revisions
Chronomega1 (talk | contribs) |
Chronomega1 (talk | contribs) |
||
Line 26: | Line 26: | ||
<br>Projector | <br>Projector | ||
Participants will need Eclipse installed on their computer and have downloaded this package here (the testing code mentioned in the video | Participants will need Eclipse installed on their computer and have downloaded this package here (the testing code mentioned in the video [http://courses.ncsu.edu/csc216/lec/001/video/1/g1/ArrayExercises.java Code]). The video can be watched by clicking here [http://courses.ncsu.edu/csc216/lec/001/video/1/g1/Debugging.swf Video]. | ||
The Code | The Code | ||
import java.util.Random; | |||
public class ArrayExercises { | public class ArrayExercises { | ||
private int [] grades; | |||
public ArrayExercises () { | |||
// Create an array of 10 grades | |||
grades = new int[10]; | |||
Random r = new Random(); | |||
// Fill the array with random numbers from 1 to 100 | |||
// ...use r.nextInt(100) method | |||
for (int i = 0; i < grades.length; i++) { | |||
grades[i] = r.nextInt(100) + 1; | |||
} | |||
} | } | ||
/** | |||
* Calculate and return the average score | |||
* | |||
* @return average of all scores in the grades | |||
*/ | |||
public double getAverage () { | public double getAverage () { | ||
int sum=0; | int sum=0; | ||
Line 99: | Line 100: | ||
} | } | ||
} | } | ||
Revision as of 01:10, 5 April 2008
Eclipse is an open source community whose projects are focused on building an open development platform comprised of extensible frameworks, tools and runtimes for building, deploying and managing software across the lifecycle. A large and vibrant ecosystem of major technology vendors, innovative start-ups, universities, research institutions and individuals extend, complement and support the Eclipse platform.[1]
Formatting Resources
Formatting Help Guide from MetaWiki
DEBUGGING IN ECLIPSE FOR DUMMIES!!
The problem
Debugging: to search and eliminate malfunctioning elements or errors
Shotgun debugging : the making of relatively undirected changes to software in the hope that a bug will be perturbed out of existence. This almost never works, and usually introduces more bugs.
Many students have been using shotgun debugging to solve errors in their code. One of the leading benefit in using Eclipse is it's debugging feature.
Our Mission
We will teach students to utilize the debugging feature in Eclipse. Using a test script of code, a user can follow a video and learn some of the features that goes along debugging in Eclipse.
Participants and props
3 students
Camtasia Studio 5
Projector
Participants will need Eclipse installed on their computer and have downloaded this package here (the testing code mentioned in the video Code). The video can be watched by clicking here Video.
The Code
import java.util.Random;
public class ArrayExercises {
private int [] grades;
public ArrayExercises () {
// Create an array of 10 grades grades = new int[10];
Random r = new Random();
// Fill the array with random numbers from 1 to 100 // ...use r.nextInt(100) method for (int i = 0; i < grades.length; i++) { grades[i] = r.nextInt(100) + 1; } }
/** * Calculate and return the average score * * @return average of all scores in the grades */ public double getAverage () { int sum=0; for(int i=0; i<300; i++) { sum = sum+grades[i]; } double average = sum/grades.length;
return average;
} /** * Count the number of scores greater than or equal to 90 * * @return count of A's */
public int countTheAs () {
int countA= 0;
for(int i=0; i<grades.length; i++)
{
}
return countA;
}
/**
* Test the methods
* @param args not used
*/
public static void main (String [] args ) {
ArrayExercises a = new ArrayExercises();
System.out.println ("Average = "+ a.getAverage());
System.out.println ("Number of A's (must be >= 90) is " + a.countTheAs());
} }
Common Practices
*Step Execution *Breakpoints *Evaluate expressions *Scrapbooking live code *Hotswap bug fixing
The script
Follow along with the video, using the sample code provided. Should aid students in awareness of debugging benefits when using Eclipse.
Debugging Perspective
- Two ways of Accessing
- Introduction to the panes in this view
Three Common Practice
- Breakpoints
- Step Execution
- HotSwap Bug Fixing
Simple Demonstration of Bad Code corrected
- Load the file
- Code Objective
- Start Debugging
References
external resources and links to Eclipse Debugging Tutorial