CS 70

Phase 1: Copying Your HW6 Code

A good rule of thumb in program development is to enhance and refine working code, making small, testable, changes rather than writing large chunks of code and then having to debug it.

In this assignment, you and your new partner will copy code from HW6 (that you wrote with your previous partners) into your new Homework 7 repository. You will then get the code working again, with two changes:

  1. The file organization will be different (to help us in the next phase).
  2. Your code will be based on just one of the two implementations (one from each programming partner) you have to draw upon.

From a grading perspective, we will be testing your whole tree class—even functionality transferred from HW6—so it is definitely in your best interest to fix any bugs in the original code as you find them.

Steps

Getting a Working TreeStringSet

As a pair, review each other's solutions to Homework 6, comparing and contrasting your approaches. Decide whose code will be used as the starting point and be copied into your repository.

  • Hedgehog speaking

    How do we copy the code from Homework 6 repository into our Homework 7 repository?

  • LHS Cow speaking

    The easiest way is probably to open your Homework 6 repositories and then just use copy and paste from HW6 files into new files in your Homework 7 repository.

  • RHS Cow speaking

    You could also open files from HW6 and then save a copy of them into your HW7 repo.

  • Rabbit speaking

    Don't forget to add the files to your git repo, commit them, and push them up to GitHub!

Files to Migrate

  • LHS Cow speaking

    As in all coding parts in CS 70, we will grade your implementation for completeness, correctness, style, elegance, and clarity. Take this opportunity to improve your HW6 code along these dimensions!

You should copy (at least) the following files from HW6

  • treestringset.hpp
  • treestringset.cpp
  • treestringset-test.cpp
  • Makefile

You'll also need to copy over any additional files needed to build that solution.

Fixing Up the Code

Once you have copies of the important files from HW6 in your HW7 repository, you should update your code so that it compiles and works at least as well as it did at the end of Homework 6.

Once things are working (i.e., make treestringset-test works and that set of tests run (and your code passes the tests)), you can move to the next step.

Makefile

Change your Makefile so that it no longer compiles minispell by default (i.e., remove minispell from the all rule). The new version of minispell for this homework assignment won't compile until you've completed a bit more work.

Enhancements and Bug Fixes

At this point, you can (and should, if appropriate) take code from the other partner's solution to replace or supplement code in the codebase you chose to start with.

In particular, you should

  • Port any tests that aren't in your chosen base code from the other partner's code.
  • Consider replacing code that was implemented more cleanly in the other solution than in your HW7 codebase.
  • Make any necessary adjustments to the combined code so it all works together.

Once you have your combined codebase, you can fix bugs, including any left over from the last assignment, any you've introduced in combining the code, and any bugs that come to light from the new tests you've imported.

Once everything is working smoothly again (i.e., your code compiles without errors or warnings, tests work and you code passes them), you can move on to the next step.

New File Organization

Now it's time to begin transforming the code from TreeStringSet to TreeSet<T>.

  • Rename treestringset.hpp to treeset.hpp
  • Rename treestringset.cpp to treeset-private.hpp
    • We normally only use this file structure for template code, but we'll follow this structure for now even though we haven't made any templates yet. They will be added in a future step.
  • Rename treestringset-test.cpp to treeset-test.cpp

Additional Small Adjustments

  • Change the symbol on the include guard for treeset.hpp to match the new filename.
  • Add #include "treeset-private.hpp" to the bottom of treeset.hpp (inside the include guard).
  • Remove #include "treestringset.hpp" to the from the top of treeset-private.hpp.
  • Change treeset-test.cpp to #include "treeset.hpp".
  • Fix your Makefile by
    • Removing anything related to treestringset.o.
    • Adjusting filenames as appropriate (e.g., removing the word string from most filenames).
    • If you haven't done so already, remove minispell from the all rule (only build treeset-test by default).

Once you've made these changes, you should be able to run make and build your code. As usual, fix any errors or warnings from the compiler, and make sure your tests still run.

Ready for the Next Step?

To proceed to the next step, you should have working code that only implements the Homework 6 TreeStringSetclass. Your code should build cleanly without any warnings, and pass all your tests.

To Complete This Part of the Assignment…

You'll know you're done with this part of the assignment when you've done all of the following:

(When logged in, completion status appears here.)