Advanced C Programming

Autumn 2016 :: ECE 264 :: Purdue University

This is for Fall 2016 (8 years ago)
Due 10/14

Linked lists #2

Goals

This assignment has the following objectives:
  1. Solidify your understanding of linked lists and your comfort coding with them
  2. Focus on writing great quality code that you can be proud of

Overview

The functional requirements for HW09 are exactly the same as for HW08, except that you will add one function:

copy_team(struct Team* team) makes a deep copy of a team and returns a returns a struct Team object. Every struct Person the copy refers to (including the .name field of each) will be a new copy on the heap.

Clarifications: copy_team(…) should not modify the original team. The copy should not refer to any of the memory that the original team refers to. You may assume that all favorites are still in the team. In other words, you do not need to handle the case of a detached team member who is the favorite of someone still on the team.

In addition, the Code Quality Standards will be rigorously checked for this assignment. In general, the policy in this course is that code quality violations may result in a deduction of up to 20%, though we do not check it on every assignment. For HW09, we will.

Besides following the minimum requirements of the code standards, your code must be presentable and readable. For example, there should be no shrapnel (e.g., old code that has been commented out). Use comments to explain anything that is not obvious. Don't bother with large box-style comments; they just waste space.

We expect to see code that you would be proud to take to a job interview.

Particularly elegant and ugly code may be shown in lectures. If you do not want your code to be shown in class, please include a file called donotshow.txt in your submission. This file's content is ignored. Including donotshow.txt or not will not affect your score. In any case, we will not identify you, though you are welcome to speak up if you see your code and wish to comment about it.

Bonus option

Truly excellent code may receive 1 bonus point. Excellent code is concise where possible, but readability and maintainability is always the top priority.

Extremely excellent code—i.e., the rare gem that makes one of us run down the hallway raving about it—might receive 2 bonus points. No gimmicks please (e.g., ASCII art, code golf, obfuscated code, etc.).

If there is something noteworthy about the way your code is designed that you think may not be obvious at first glance, you may include a text file named about.txt with a brief explanation. This is optional, and not required to receive the bonus. Do not point out things that are obvious (e.g., "follows code standards", etc.), but if there is something that you gave extra thought to, that we might otherwise miss, use this to let us know.

Submit

In general, to submit any assignment for this course, you will use the following command:

264submit ASSIGNMENT FILES…

For HW09, you will type 264submit hw09 team.c team.h test_team.c expected.txt warmup.c from inside your hw09 directory. In addition to those required files, you may optionally include the files about.txt and/or donotshow.txt

You can submit as often as you want, even if you are not finished with the assignment. That saves a backup copy which we can retrieve for you if you ever have a problem.

Scoring

20% will be for your copy_team(…).
20% will be for the adherence to the Code Quality Standards and overall readability.
60% will be for the same functionality as in HW08.

For this assignment, we will only consider your last submission. Scores may be slow to post (e.g., 2-3 weeks).

Q&A

  1. Why do you place so much emphasis on code quality?
    Code quality is an important part of software engineering. Major software companies devote substantial time, effort, and money to it. Sloppy code is hard to maintain and debug. If you get used to writing clean code, you will find that you have fewer bugs, and you can handle more complex projects with less effort. As a secondary reason, if you go to a future job or job interview and write sloppy code, you will make yourselves—and Purdue—look bad.

    As engineering graduates from Purdue, you will be expected to project excellence.

  2. Are you really going to score the same functionality from HW08 again?
    Yes. If you finished HW08 perfectly and on time, then you can get credit for the same work twice.
  3. If my code worked in HW08 but then I broke it for HW09, will you give me credit for the old one?
    No. The two will be scored separately.
  4. Is style treated like a penalty (like memory errors) or as a component of this assignment?
    The latter. For this assignment, it is treated as a component of the assignment only (and possibly a bonus).
  5. Do I need to include the warm-up from HW08?
    Yes.
  6. If I forget to include a file that I previously turned in for HW08, will you include it for me?
    No.
  7. Will this replace my score for HW08?
    No.
  8. Isn't this a little subjective?
    The code quality standards are not subjective. However, any judgment of what is “readable”, “presentable”, “truly excellent”, or “extremely excellent” may be slightly subjective. In particular, for the bonus, we will need to draw the line somewhere. We will do our best to be consistent and follow common sense.

    Code is, in a sense, written composition. It is not merely functional. Good code communicates how it works and, where necessary, why.

  9. Are there any other requirements for code quality?
    No. Just follow the code quality standards and make your code presentable and readable. As mentioned above, excellent code is concise where possible, but readability and maintainability is always the top priority.
  10. Why doesn't 264get fetch any files?
    There are no new files for HW09. Just copy your files from HW08.

Updates

10/13: Submit team.h, too.