CompSci 307 Fall 2021 |
Software Design and Implementation |
This exercise is intended to help you to learn to build an inheritance hierarchy that represents an abstraction.
While there will not be an official submission for this exercise, this code will be the basis for this week's programming exercise.
Here is a review of the steps you will use to work with GIT during lab (as distinct from assigned team projects):
lab_maze
into their own repository to allow pushing your group's changes
Settings -> Members
to add your partner so both people in the group can access the same repositoryMaintainer
role in the project and choose Add to Project
git clone
to copy the one forked repository to their individual machines so they can work on their own separate copiesOpen
the cloned folder to create a new project on their personal machineDISCUSSION.md
file included in the repositoryDISCUSSION.md
using Gitlab's Markdown formatgit add
changed files
git commit -m
to describe your changes
git push
changes back to Gitlab
git pull
changes from Gitlab back to the local machine (if you are not sharing a single computer)
DISCUSSION.md
using Gitlab's Markdown format This project implements a Maze solver using a variety of search algorithms:
Take some time to play with it and also explore the code to make sure you understand basically how it works.
They are all subclasses of the minimal superclass SearchAlgorithm
, but still contain significant duplicated code. The goal of this exercise is to refactor the classes to remove as much duplicated code as you can by choosing what code belongs in the superclass and what code is specific to each subclass. Note, you can add as many methods as you want: protected
(for subclasses to override) and private
(to factor out common functionality); but you should not need to add any public
methods. or new classes
For this lab, you only need to refactor the code in the solvers
package.
Examine the code from all the subclasses to identify what parts are common and what parts are different among the different versions.
Then work through the following steps to thoughtfully, deliberately, refactor the code while taking notes on your ideas, goals, issues, progress in your DISCUSSION.md
file:
step()
method calls those as private
methodsprotected
and what can be private
?And then continue the process as you have time during lab so that you always feel in control of the changes being made to the code. Refactoring can be a very safe process or lead to a lot of syntax and logic errors that ruin your larger design goals!
Labs in this course expect you to work either in pairs or with your project team.
Professionally, this practice is called Pair Programming: working closely with another programmer, sharing a "single computer" that we will simulate using a shared computer, shared repository or use IntelliJ's new Code With Me feature. To ensure both people do some coding, you will switch which person actually writes the code every 10-15 minutes (in industry this switch happens only 1-3 times per day). The person who is not actively coding can be advising, suggesting better names, looking up documentation, or searching the Internet for solutions to small problems you are likely to face, but not multi-tasking (i.e., doing their own work or socializing).