CS235 - Navigating the codebase

Table of Contents


1. Working with the codebase

Each student has been assigned to one of several codebases. They're all the same base application - a music app, similar to Spotify (sorry, it won't actually play music, we're just managing data), but four clones to accommodate the amount of students in the course.

Fall 2023 teams

Within each codebase there are 9 main areas, each student will take ownership of one area:

Category Subcategory
Music Album
Music Track
Music Artist
Audiobook Book
Audiobook Chapter
Audiobook Author
Podcast Show
Podcast Episode
Podcast Creator

Additionally, code will occasionally also be added by the instructor, to add features needed for future assignments. The goal here is to emulate a "real-world" code base, though the scope here is significantly smaller. As such, sometimes I leave inconsistencies in the codebase, which I'm going to tell you is for "authenticity" rather than pure laziness. :)

1.1. Communication with your team

I highly recommend exchanging email addresses with your teammates and creating an email chain to keep coordinated, but also you may want to all join the course Discord server, and I will create a private group for your team.

In the work world, usually teams keep in touch via email and a chat program like Slack or MS Teams. Discord is similar, good enough for now. :)

1.2. Grade notes

There will probably be people who drop out during the semester, but other students' performance will not affect your grade, you will be graded based on your own work.

Any "positions" not filled, I will just bring in code from another group repository.

1.3. Asking the instructor questions

The instructor will be filling the role of "Software Architect" for the various "teams". Feel free to ask me questions to get clarification on requirements and if you get stuck on how to implement something, but also ask your teammates.


2. Utilizing source control

2.1. Cloning the codebase

You will need to clone this repository to your harddrive in order to work with it.

  1. ON GITLAB:
    1. Click on the blue Clone button.
    2. Copy the URL under "HTTPS" (unless you want to set up SSH).
  2. ON YOUR PC:
    1. Find a location where you want to store this project. Right-click in the file explorer, and open Git Bash (or Terminal for Linux/Mac).
    2. Type in git clone URL , but replace "URL" with the copied URL from GitLab.
    3. The repository will now be on your harddrive. Make sure to use cd FOLDERNAME to enter the folder, otherwise your add/commit/push git commands won't work.

2.2. Starting a new assignment

When working on a new assignment, make sure to do the following:

  1. Make sure you've ADDED, COMMITTED, AND PUSHED all changes to your current branch, as applicable.
  2. git checkout main to checkout the main branch.
  3. git pull to grab the latest changes from the server.
  4. Everything merged and updated? Good, now continue…
  5. git checkout -b name_assignment to create a new branch to work on for the assignment. For example: rsingh13_u07ex.
  6. Now you're good to start working!

2.3. Finishing up an assignment - Creating a merge request and getting peer reviews

Once you're done working on your part of the assignment, make sure you've pushed your latest changes to your branch:

  • ON PC (Git Bash):
    1. git add .
    2. git commit -m "description"
    3. git push -u origin BRANCHNAME

Then go to the GitLab repository page. There is usually a box that will pop up and ask if you want to create a Merge Request, or you can do the following:

  • ON WEB (GitLab):
    1. Select Merge requests.
    2. Select New merge request.
    3. Under Source branch, select your branch. Under Target branch, select main
    4. Select Compare branches and continue.
    5. On the New merge request screen, do the following:
      1. Set a descriptive Title - what is the assignment? What area of the codebase did you update?
      2. Add a Description to help your classmates understand what changed.
      3. Click Create merge request.
    6. Once you've created a merge request, copy the URL to this page and ask a classmate to review your code.
    7. Get at least one person to sign off on your code before submitting the assignment to Canvas! (Copy the URL to the merge request and submit it as your submission on Canvas.)

c3_NavigatingCodebase_MergeRequest.png

2.4. Reviewing somebody else's merge request

c3_NavigatingCodebase_Commenting.png

Please make sure to review another student's merge request when they ask, whenever you have time. Once you have a URL to a merge request, do the following:

  • ON WEB (GitLab):
    1. Click on the Changes tab to view all the file changes.
    2. Navigate to any relevant files, such as C++ source files (ignore project files!)
    3. Skim through the code and take note of:
      1. Does it look clean and easy to read?
      2. Does the logic seem to be valid?
    4. Make comments on parts of the code as-needed. You can click on a line of the code and a comment box will pop up, which will help everyone see what you're talking about.
    5. Suggested changes: If you think something should be fixed or cleaned up in the teammate's code, make a note of it and let them know you've reviewed it. Don't click on approve.
    6. No suggested changes: Make sure to leave a comment of approval, or click the Approve button if it is available.
    7. Let your teammate know when you're done reviewing it.

3. The Codebase

3.1. Project files

A starter codebase is provided in your repository already. You will be working with this codebase for the various assignments. Several project files are already available:

  • Project_CodeBlocks contains the Code::Blocks IDE project files
  • Project_Makefile contains a makefile you can use to build the code, if you know how to use that.
  • Project_VisualStudio contains the Visual Studio projects files

If you would like to create a project directory for the IDE you use, feel free to do so. Please follow the smae naming conventions (prefix with "Project_").

3.2. Running the program

When you run the program a menu will pop up with some options. For now we're going to use option "3. PROGRAM", which will take you to a main menu.

--------------------------------------------------------------------------------
 | MAIN MENU |
 -------------

 0. QUIT
 1. API
 2. TESTS
 3. PROGRAM

3
--------------------------------------------------------------------------------
 | Main menu |
 -------------

0. QUIT
1. ADD OPTIONS...

You and your teammates will add on to the menus as you work on various assignments.

3.3. Making changes to the program menus

The program's menus are located within Namespace_Application/MenuApp.cpp , you can add new Menu functions to the MenuApplication class in the MenuApp.h file, then add the function definition in this location.

  • void MenuApplication::Menu_Main() - After you've created your new menu, make sure to add a menu option in the main menu so you can navigate to it while testing.

Author: Rachel Wil Sha Singh

Created: 2023-09-10 Sun 20:33

Validate