Preparing and Submitting Programming Assignments

Steven J. Zeil

Last modified: Jul 27, 2020
Contents:

This document explains the procedures for preparing and turning in programming assignments in this course. For information on non-programming assignments, see here.

1 Walking Through A Typical Assignment

  1. Read the assignment itself. Most assignment pages describe the purpose of the assignment (e.g., practice using the C++ standard list), describe a problem and related program, and provide one or two examples of program inputs and outputs.

  2. Set up your assignment directory. Most of my assignments provide a set of starter code and a makefile for building the code on *nix systems.

    Get the provided code. Read through it, comparing it to the problem description. Look to see what changes you are likely to need.

    You may want to try compiling the code “as is”. On some assignments, this will work without errors. In many cases, missing or incorrect components will result in error messages. But those messages may help you identify what you need to add or fix in the program.

  3. Write your solution.

  4. Test your solution.

    Don’t be satisfied with the one or two examples given on the assignment web page. Make up your own test data. Proper choice of test data was discussed in the prerequisite courses CS250/333, and I expect you to exploit those skills.

    How can you be sure you know the correct output for a test case that you yourself created? In all assignments, I provide you with a compiled version of my own solution. Run your tests through your code. Run the same tests through my solution. The outputs should match.

  5. If your testing reveals a problem, debug your code (also here (250/333), here (252) and here (252).

    Once you have fixed the current problem, go back to the previous step and re-test.

  6. (Optional but recommended) If you have been working on a non-Linux system, transfer your code to one of our Linux boxes and compile and re-test it there.

  7. Submit your code using the button or link provided on the assignment page.

  8. Read the grade report.

    You should have a grade within the hour. The results of the compilation and testing will be

    • emailed to you (at your @cs.odu.edu email account)
    • will be available on the website Grades page.
      • This is updated about once an hour.
      • Click on the numeric score to see the detailed grade report.
    • and can also be found by returning to the assignment’s submission page and selecting the “View Grade Report” button.

    If you aren’t satisfied, and there is time left before the due date, and you have not exhausted your allowed submissions, you may back up a few steps and try again.

  9. Now return to the assignment’s submission page, click the “Look at Solution” button. This provides you both with the code of my own solution and the tests that I used to evaluate your code. The tests may be simple data files or may be shell scripts that set up a test and then run it.

    If your code failed any tests, you can re-run those tests yourself to see what your program does. You can also run them through my solution to compare the outputs.

    Compare your code to mine. Are there differences that you don’t understand? Then email me or come to office hours and ask.

2 Policies

2.1 Why are the Programs used in Assignments so Big?

Most of the assignments in this course will involve making small changes to a set of code for a nearly complete program, or altering a completely working program to take advantage of some new data structure or algorithm we have studied. This feels “wrong” to some students, but, when I give an assignment, it’s designed to exercise a specific lesson you have just read. I want you spending your time and effort on that lesson’s material, not on writing yet another main() function, lots of basic I/O, or any of the other myriad details that suck up your time when writing a program from scratch.

As it happens, that’s probably a more realistic approach. Most real-world programming projects will not involve creating an entire program from scratch. Far more often, you will be asked to modify, fix, or enhance existing code.

So you may not be writing that much code in any given assignment, But part of the challenge in working with programs at this scale is that you have to develop a knack for reading existing code and seeing where you need to make changes and what you need to leave alone.

2.2 The Grading Platform

Grading is performed on the CS Dept’s Linux servers. You may do your development work on the CS Dept’s PCs, or on other machines more convenient to you. It’s a good idea, though, before you submit your work, to upload your code to the CS Unix network and check to be sure that it still works after doing so. This is not something you should take for granted!

 

The official C++ compiler for this course is the Free Software Foundation’s GNU g++ compiler, whatever version is currently installed on the CS Dept.’s Linux servers. This compiler is available on the CS Dept’s Linux workstations and Windows PCs. You can also download this compiler for free and install it on your own PC.

 

The official Java compiler for this course is the Oracle javac compiler, whatever version is currently installed on the CS Dept.’s Linux servers. This compiler is available on the CS Dept’s Linux workstations and Windows PCs. You can also download this compiler for free and install it on your own PC.

It’s important that you not only use the same compiler that we will use to grade your code, but that you compile your code the same way we will be compiling it – using the same commands and options. This will be easy for you to check. Each assignment will be supplied with a makefile. On *nix systems, you can compile your code by simply giving the command

make

If you are on a non *nix system or using an IDE that doesn’t play well with makefiles, you might want to try running a compilation via make once on one of our Linux machines just to see the sequence of commands issued and the options used on each command. Then try to match those in your own environment.

g++ options: For most assignments, I recommend the following options:

-g -std=c++11 -Wall -Wextra -Weffc++

The -W… options add warning messages for a variety of common errors. They are warnings, not errors, and will not actually prevent your code from compiling. They can alert you to potential problems, but only if you actually read and consider the warning messages.

2.3 The Grading Criteria for Programming Assignments

For any programming assignment, you must

  1. Satisfy the stipulations and limitations of the assignment.

    Each assignment will have certain stipulations. You may be limited in what files you can change, what data structures you can use, etc. The point of any assignment is to practice and demonstrate your ability with certain skills and techniques that we have covered in class.

    You might be able to get that program running in some completely different manner, maybe rewriting the whole thing from scratch. It might even be easier for you to do it that way. That doesn’t matter. If you have not employed the stipulated techniques, your submission will be disqualified.

  2. Produce the correct output.

    The primary scoring criteria for programming projects is the percentage of the test cases on which your code produces correct output.

    While it’s common in beginning programming classes to write interactive code that prompts for inputs and accepts them from the keyboard, few programs these days work that way. Most truly interactive programs will work through a graphic user interface. But there are still many programs that work through simple text input/output interfaces. These programs typically read and write to files or possibly directly to other programs. Consequently, the I/O formats of these programs are crucial and must be followed very precisely.

    The good news is that, in most assignments for this course, I will provide the I/O code so you should not run into issues with formatting of I/O.

2.3.1 The Anti-Grading Criteria for Programming Assignments

These are things that you will not get points for in the grading of programming assignments:

  1. The code is “almost correct” or “looks similar to” a correct solution.

    Sorry, but almost everyone who submits buggy code thinks that their code is “almost correct”, that it “looks like” code that “should work”. It’s a well-known truism in our field that most software projects are 90% complete for 90% of their development time.

    It’s very easy to get code to a point where it looks like something that should be correct and yet fails every test case submitted to it. The real effort in programming, and what you are rewarded for in the grading, is for getting past that point to something that actually passes one or more tests.

    This does not mean, as some folks complain, that I don’t give partial credit on programming assignments. Some credit is awarded for code that compiles. More importantly, I generally have multiple test cases, and you will get credit for those that you pass, even if you fail some others.

  2. Time spent on the assignment

    “I spent so many hours on this assignment.” That’s gratifying, but do you think that your classmates did not? Or, if someone managed to produce correct output while spending only half the time that you did, do you think that I should take points away from them for having worked more efficiently than you?

    Telling me how much time you spent on an assignment may earn you sympathy. But it does not demonstrate your mastery of whatever techniques the assignment is trying to showcase.

    And if you are really spending outlandish amounts of time on the programming assignments, you may want to think about working smarter instead of harder. Make sure that you are applying all the lessons of designing, coding, testing, and debugging from the prerequisite courses. Go back and review if necessary. There’s many good reasons why your programming training did not end with your first C++ course!

2.4 The Auto-Grader

Most programs in this course will be graded automatically. You will submit your assignments electronically. Within a limited amount of time (typically 15-30 minutes, but this may vary depending upon how many other people are submitting) your code will be compiled. If it compiles successfully, it will be run on the instructor’s test data and scored on how well it performs.

The point of the auto-grader is to provide you quick feedback. In many cases, you may be able to use that feedback to fix things before the final due date of the assignment. If I graded in the “traditional” manner (you turn things in and I grade them after the due date), you would not get that opportunity. That can be very frustrating (to me as well as to the students) when students make “silly” mistakes such as submitting the wrong file, writing code that takes its input from the wrong source, writing output in an incorrect format, etc.

Some people complain that the auto-grader is too picky or too strict. That’s a bit misguided. The auto-grader only runs the tests that I would have run if I were executing your program “manually”. (Now, if you want to complain that I am too picky, that’s another matter entirely.)

2.5 Multiple Submissions

If there is time before the due date, programs may be resubmitted without penalty at most twice (after the first submission, for a maximum of three total submissions).} A few programming assignments may not permit re-submissions, in which case that will be stated explicitly as part of the assignment description. Non-programming assignments, in general, cannot be resubmitted.

The reason for allowing resubmissions is to give you a chance to recover from “silly mistakes” (e.g., submitting the wrong file, writing code that takes its input from the wrong source, writing output in an incorrect format, etc.) or from fundamental misunderstandings about what the program is supposed to be doing. It is not intended to allow you to keep chasing points by passing one more test each time. You are expected to test your own code before submitting, and, if you have done that, you should not actually be surprised by the percentage of my tests that you pass or fail.

You are allowed multiple submissions because I want you to be able to notice and fix “silly” mistakes that would otherwise have caused you to get a zero, for reasons unrelated to the purpose of the assignment.

  1. I therefore expect you to read your automatic grade reports, find any such trivial issues, and fix them.

  2. If you don’t make any silly mistakes and decide to use the extra submissions to try and improve your score, I don’t object to that. But that’s entirely secondary to my real purpose in allowing multiple submissions.

So please don’t ask me to allow you additional submissions to improve your score because you “wasted” early submissions on trivial mistakes. That’s why you are allowed multiple submissions in the first place.

When you submit, you should do so with the understanding that you will be graded on that submission and may have to accept that grade as your final grade for that assignment.

2.6 Appeals

Instructors are fallible too, and sometimes we will have a bad test. If you discover a bad test when you review the assignment solution, you can ask to have it re-scored.

If you have done multiple submissions and actually made your code score lower on your final submission than it had on an earlier one, you may ask that your score be rolled back to the higher score. You have to ask, though. I generally don’t notice when this has happened unless you tell me.

2.7 Files Provided in Assignment Directories

Each programming assignment is found in a separate directory, specified on the assignment web page. You will need to copy the files from that directory into your own working directory.

Make sure your files are protected! It is your responsibility to protect your assignments and other course work from access by your fellow students. Of course, they shouldn’t be looking there, but the ODU honor code recognizes that making your work freely available for copying is also unethical behavior.

Leaving your assignment solution files unprotected for your classmates to read is considered a violation of the ODU honor code and may result in sanctions up to and including expulsion from the University.

Typically, each assignment directory will include a number of source code files. Some of these are for you to modify, some should be left alone. You can tell which should be modified by consulting the list of files to be submitted. Anything that you aren’t going to turn in must be left unchanged.

Other files that you may find in the assignment directories include:

2.8 Submission guidelines

3 Appendix: Protecting Your Files on the Unix Network

The basic protection commands for Linux are covered in CS252. Here, however, I outline a simple setup that will make sure your files are protected from snooping without you’re needing to worry about it every time you start a new assignment.

For the same of example, let’s suppose that you are working on an assignment “asst1”, with the instructor-provided files contained in the directory /home/zeil/Assignments/CS350/asst1.

  1. If this is your first assignment for the course, create a course work area and protect it from access by anyone except yourself.

    mkdir ~/CS350
    chmod 700 ~/CS350
    
  2. Create a working directory for this assignment:

    cd ~/CS350
    mkdir asst1
    cd asst1
    

    You need not worry about protecting this directory, as it is inside a directory that only you can access.

  3. Copy any files you need into this directory. E.g.,

    cd asst1
    cp /home/zeil/Assignments/CS350/asst1/* .
    

    (Typically, the assignment page will indicate the exact directory path that you would use to obtain the files for that specific assignment. If the assignment involves source code arranged into subdirectories, it may be easier to copy the zip file and then unpack that.)

    It’s important, by the way that you copy “*” and not “*.*”. The latter will only copy files that have a ‘.’ in their name. Many files do not. Most notably, the makefile I provide with most assignments does not.

    This cp command will not copy anything inside subdirectories of the assignment directory. Usually, that’s OK because the only subdirectory is probably the bin directory where the sample solutions are kept, and you don’t need a distinct copy of that.

  4. You are now ready to start work.

    For most assignments, you can compile the code by just giving the command

    make
    

In future assignments, just make it a habit to do all of your assignments inside the protected ~/CS350 directory, and you won’t have to worry about anyone else seeing your code.