CompSci 308 Spring 2023 |
Advanced Software Design and Implementation |
This exercise is intended to help you practice clearly separate the "backend" Model (that has no dependencies on specific View classes (especially OpenJFX)) from the "frontend" View so it can more easily be varied as new frameworks or new kinds of devices are developed. The clearest way to achieve this goal is make sure none of your backend classes import
anything from javafx.*
(sometimes java.awt
is okay since its utility classes have been used in all modern Java frameworks) and instead return
requested or computed data when needed by the View.
At the end of lab, use Gitlab's Merge Request from your forked repository's master
branch back to the original organization repository's master
branch to submit your group's answers to the discussion questions and refactored code.
You only need to create one Merge Request, no matter how many commits you make, and you do not worry about potential conflicts since your request will not be approved (it is just an easy way for us to see changes you made).
Make sure the Title of your Merge Request is of the form "lab_browser - everyone's NetIDs".
In your Cell Society teams, complete the following activities:
lab_browser
into their own repository to allow pushing your group's changes
Project Information → Members
(in the upper left corner) 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 machinegit push
, git pull
, and git merge
directly ANDgit pull
to bring changes into your branch on your machineNote, there should be a LOT of GIT commits for this lab!
Individually, share your interpretation of the Single Responsibility and Open-Closed Design Principles and how they are represented in the refactorings made to the example_roulette
and lab_hangman
code. Collectively, try to come up with a slogan, catchphrase, or shortened description for each.
Start by using use Pair Programming to work together within one person's local repository to refactor the NanoBrowser
class to split it into Model and View classes (since this is a fairly big and comprehensive change).
Complete this refactoring in the following steps, mostly by moving the existing code to a new class and then calling the new methods in place of the old code:
NanoBroswerModel
, and rename the existing NanoBrowser
class to NanoBrowserView
.NanoBrowser
class to determine which instance variables should be part of the NanoBroswerModel
class and which should remain in the NanoBrowserView
class.
NanoBroswerModel
class and create an appropriate constructor
private
to public
public
methods in the NanoBroswerModel
class with parts of existing methods that can be separated from the NanoBrowserView
classNanoBrowserView
class for the NanoBroswerModel
Main
class to create an NanoBroswerModel
object to pass to the NanoBrowserView
when it is createdNanoBrowserView
class, such as:
NanoBroswerModel
classNanoBroswerModel
class and returning a value that can be used appropriately in the method (be careful not to introduce dependencies on any OpenJFX classes).
Before continuing to the next part, use the suggested workflow to integrate the new version of the code with everyone else's copy of the code.
Continue practicing using the suggested workflow to complete the following tasks by having each person take one set of tasks and integrating the changes after each step is complete. You are encouraged to discuss the changes with each other as you make them (either for better understanding OpenJFX or to avoid conflicts), but they should be coded independently. Note, the NanoBroswerModel
changes should be very small and easy to complete (so most of the time will be spent figuring out the NanoBrowserView
changes together) but doing them simultaneously will better help simulate working together in a project.
Model Changes
|
Configuration Changes
|
View Changes
|