Presentation is loading. Please wait.

Presentation is loading. Please wait.

BRYN MAWR Identifying and Correcting Java Programming Errors for Introductory Computer Science Students Maria Hristova, Ananya Misra,Megan Rutter Rebecca.

Similar presentations


Presentation on theme: "BRYN MAWR Identifying and Correcting Java Programming Errors for Introductory Computer Science Students Maria Hristova, Ananya Misra,Megan Rutter Rebecca."— Presentation transcript:

1 BRYN MAWR Identifying and Correcting Java Programming Errors for Introductory Computer Science Students Maria Hristova, Ananya Misra,Megan Rutter Rebecca Mercuri, Ph.D. Mathematics and Computer Science Department Bryn Mawr College

2 BRYN MAWR Java Programming Errors SIGCSE 2003 Purpose of the Study Beginning programmers often find it difficult to understand some of the linguistic constructs in the C/C++/Java family of languages. This results in certain common errors during the coding process. Students may be further confused from cryptic diagnostic messages issued by the compiler. We wanted to study this problem using Java in the CS1 environment.

3 BRYN MAWR Java Programming Errors SIGCSE 2003 Project Funding Support was provided for 3 Bryn Mawr Math/CS students (2 Seniors and 1 Junior) to perform this research with their Professor. Funding was received from the Collaborative Research Experience for Women (CRE-W) program, part of the Computer Research Association (CRA). The students received academic credit for this project.

4 BRYN MAWR Java Programming Errors SIGCSE 2003 Project Goal The creation of an educational tool that would help students identify and fix their programming errors, and also teach them how to avoid making these coding mistakes again.

5 BRYN MAWR Java Programming Errors SIGCSE 2003 Project Phases I: Identification of Errors Java professors, TAs, and students were surveyed from 50 schools. They were asked to identify the most common programming errors made by introductory students, as well as the hardest ones to find, after compilation reported their mistakes. 62 errors were identified, 20 deemed essential to the project.

6 BRYN MAWR Java Programming Errors SIGCSE 2003 Project Phases I: Identification of Errors II: Choice of Implementation Existing educational tools were examined: TA Online, DrScheme, BlueJ Intention was to create a tool that could be used in the early stages of learning programming. The tool should do a better job generating understandable error messages than existing compilers, and provide suggestions regarding how to fix the code.

7 BRYN MAWR Java Programming Errors SIGCSE 2003 Project Phases I: Identification of Errors II: Choice of Implementation III: Implementation “Expresso” -- a multi-pass Java pre-processor, written in C++: –strips comments, retains line numbering –removes whitespace and tokenizes the file –detects and reports mistakes in additional passes Created a test suite of short programs to exercise the individual errors that Expresso could identify.

8 BRYN MAWR Java Programming Errors SIGCSE 2003 Project Phases I: Identification of Errors II: Choice of Implementation III: Implementation IV: Evaluation TAs for the Fall’02 CS1 Java course were provided with copies of Expresso for experimental use. More extensive testing in the programming laboratory setting will be explored.

9 BRYN MAWR Java Programming Errors SIGCSE 2003 Types of Errors Implemented: Syntax - spelling, punctuation and order of words in the program Semantic - likely to ensue from a mistaken idea of how the language interprets certain instructions Logic - tend to arise from fallacious thinking by the programmer rather than from language peculiarities Unimplemented: –Already identified well by the compiler –Don’t apply to introductory students –Can’t be checked by preprocessor

10 BRYN MAWR Java Programming Errors SIGCSE 2003 Syntax Errors 1. = versus == 2. == versus.equals 3.mismatching, miscounting and misuse of ( ), [ ], { }, “ “, ‘ ‘ 4.&& versus & and || versus | 5.semicolon after if/for/while test 6.wrong separators in for loops 7.if followed by { instead of ( 8.keywords used as method or variable names 9.invoking methods with wrong arguments 10.forgetting parentheses after method call 11.incorrect semicolon at end of method header 12.leaving space after period when calling method 13.= incorrect operators

11 BRYN MAWR Java Programming Errors SIGCSE 2003 Semantic Errors 1.invoking class method on object

12 BRYN MAWR Java Programming Errors SIGCSE 2003 Logic Errors 1.improper casting 2.invoking a non-void method in a statement that requires a return value 3.flow reaches end of non-void method 4.confusion between declared and passed parameters 5.incompatibility between declared return type of a method and its invocation 6.class declared abstract because of missing function

13 BRYN MAWR Java Programming Errors SIGCSE 2003 Sample Run Code // sample run import java.awt.*; import java.applet.*; import java.awt.event.*; public class SampleRun extends Applet implements ActionListener { Label sampleLabel = new Label("Sample Label", Label.LEFT); Panel samplePanel = new Panel(); public void init();{ samplePanel.setLayout(new FlowLayout(FlowLayout.LEFT)); samplePanel.add(sampleLabel); add(samplePanel); repaint(); } public void paint(Graphics g){ char bear = 'p'; String cheese = "appleSauce"; computeSum(cheese, bear); } public int computeSum(int apple, int sauce){ int appleSauce; if (apple = sauce){ appleSauce= apple + sauce; } else if (apple > sauce);{ appleSauce == apple - sauce; } else{ appleSauce = 49; } return appleSauce; }

14 BRYN MAWR Java Programming Errors SIGCSE 2003 Sample Run Output

15 BRYN MAWR Java Programming Errors SIGCSE 2003 Demonstration

16 BRYN MAWR Java Programming Errors SIGCSE 2003 Results The list of common errors and the test suite can be useful educational tools for CS1 students. The Expresso project was a tremendous learning experience for the students who performed the research. Further assessment of Expresso in classroom and laboratory environments will help improve and evaluate the tool’s utility.

17 BRYN MAWR Java Programming Errors SIGCSE 2003 For Further Information Dr. Rebecca Mercuri Bryn Mawr College rmercuri@brynmawr.edu http://mainline.brynmawr.edu/~rmercuri

18 BRYN MAWR Java Programming Errors SIGCSE 2003

19 BRYN MAWR Java Programming Errors SIGCSE 2003 Theoretical Framework Pea and Kurland – Cognitive Aspect –Define programming as both a mental mode and a skill like reading –Define the need for a tight bond between an instructional and programming environment Du Boulay – Language-Independent Aspect –Defines the five language-independent areas of difficulty and three kinds of corresponding mistakes Fleury – Java Aspect –Creates a list of the four most common “student-constructed rules” in Java –Explores how students understand Java code and what their misconceptions might be

20 BRYN MAWR Java Programming Errors SIGCSE 2003 Our aim in this project was to create an educational tool that would not only help students identify and fix their existing programming errors, but also help prevent them from making them again in the future. We accomplished this by compiling a list of common Java programming errors made by introductory students, designing and coding a program that identifies these mistakes and returns instructive error messages, and testing our program on our test suite. We believe that our resulting project will prove to be a very useful tool for future introductory Computer Science students.


Download ppt "BRYN MAWR Identifying and Correcting Java Programming Errors for Introductory Computer Science Students Maria Hristova, Ananya Misra,Megan Rutter Rebecca."

Similar presentations


Ads by Google