CompSci 308 Spring 2021 |
Advanced Software Design and Implementation |
Knowing how to use a source control system will be an invaluable tool for you going forward, perhaps personally or even potentially for changes in laws, but especially in a team setting. At its heart, version control is just a way to manage the many changes that occur to your files over time, but that simple idea changes everything! It allows you to revisit previous versions of your code, work with different versions at the same time, and work in teams and track who made which changes. At its best, version control is like a journal that you use to track major, and minor, events in your project. At its most practical, it is like a backup system that prevents you from losing significant work if something happens to your machine. At its worst, it is simply a submit system where you only track your work when told to.
Version control systems have been around for almost fifty years and GIT is currently the cool tool to use (partly because it was created by Linus Torvalds, the creator of Linux, and partly because of the popularity of GitHub, the largest public repository of code). Using source control well is not difficult, but it does take some practice and a little bit of command-line savvy (we do not suggest using visual GIT tools, even the one built into IntelliJ, until you are confident in your version control skills).
When running these programs, unless otherwise noted, we suggest following the default options.
You will be using features from the latest version of Java in this course and I recommend using IntelliJ as your development environment since it has a wide variety of features to help you improve your program's design.
git config --global user.name "YOUR NAME" git config --global user.email "NETID@duke.edu"
Shibboleth
button to log in using your Duke NetIDUser Settings → SSH Keys
to set it up because you have never used the CompSci coursework
Gitlab site.ssh-keygen -t rsa -C "NETID@duke.edu" -b 4096
coursework
Gitlab site: User Settings → SSH Keys → Key Text Area
)id_rsa
, and press Add key
Fork
button in the upper right corner of the page to create a version of the project in your own account with the same name (e.g., NETID/lab_bounce
)git@coursework.cs.duke.edu:NETID/lab_bounce.git
)cd WORKSPACE/FOLDER
git clone git@coursework.cs.duke.edu:NETID/lab_bounce.git
lab_bounce
within your workspace folder that contains configuration information for GIT (e.g., a folder named .git
— note that it starts with a period)ls -a lab_bounce
File → Open
(or the Open
button if the File
menu is not available)lab_bounce
, and press Open
Project
label in the leftmost gutter to expand the contents of your project foldersrc → bounce
to find the Java class ExampleBounce
Run ExampleBounce.main()
Within Terminal, your lab_bounce
folder should now have the configuration folders for both GIT (e.g., .git
) and IntelliJ (e.g., .idea
)
ls -a lab_bounce
README.md
by double clicking on it git status
git add README.md
git commit -m "Included my name in the README"
git push -u origin master
Complete the following tasks to practice the basic GIT workflow commands (add
, commit
, and push
), get used to OpenJFX, and begin to think about how to organize code within a project. For each task, you may make any changes to the code you think are warranted (functional, organizational, or creating new classes). After you think you have completed each task, make a GIT commit
with an appropriate comment (i.e., there should be at least four commits in your project history). After every two commits, push
your changes up to Gitlab so your online lab_bounce
repository reflects the work you have done in lab today.
At the end of lab, use Gitlab's Merge Request back to the original organization repository's master
branch to submit your updated code and commits. Make sure the title of your Merge Request is of the form "lab_bounce - your NetID". Just in case, also include your name and NetID at the top of the README.md
file. This is how all lab submissions will be done for this course — only what is in your Gitlab repository will be considered part of your work.