iP: Week 4iP: Week 6


iP: Week 5

  1. Generate a new JAR file
  2. Write full commit messages
  3. Add Increments as PRs: A-Assertions, A-CodeQuality, A-Streams
  4. Add Increment: A-CI
  5. Add an extension

1 Generate a new JAR file

  • Generate a new JAR file using Gradle (Gradle can bundle the JavaFX third-party library into the JAR file. If you do not bundle JavaFX with the JAR file, the application will not work on computers that don't have JavaFX installed). Refer to the Gradle tutorial @SE-EDU/guides to learn how.
    If the .jar file is smaller than 5MB, most likely JavaFX libraries are not inside it.
  • There is no need to create a release on GitHub with this JAR file (although you are welcome to).

2 Write full commit messages

  • While we do not require you to write full commit messages (i.e., including a message body) for work done in this course, it is still good to learn how to write one. The purpose of this task is to give you some practice in writing clear full commit messages.
  • Requirements:
    1. Write full commit messages for at least 2-3 commits that you push this week.
    2. Follow these Git conventions for the commit message body as specified by @SE-EDU/guides when writing them.
    3. Git tag one of those commits as A-FullCommitMessage.
AI Guidance » Write full commit messages

If you have been using AI to craft Git commit messages until now, this is the time to write a few full commit messages by hand. But you can still ask AI to review your commit messages and provide suggestions based on the /seedu-git-standard skill that you created earlier.


3 Add Increments as PRs: A-Assertions, A-CodeQuality, A-Streams

Guidance for the item(s) below:

As you know, one main goal of the iP is to prepare you for the tP. The task below is heavy on the 'training for tP' aspect.

In previous iP increments, you learned:

  • How to merge branches locally and push to your fork
  • How to create PRs from the master branch to an upstream repo

In this iP task you will learn how to do the following new things, which are relevant to the tP:

  • How to merge branches in the remote repo, and pull the merged branch to your local repo
  • How to create PRs from branches other than master
  • How to manage PRs that your repo receives
  • How to work with parallel PRs

Due to the above learning goals, this iP task is a bit complicated. Pay attention and try to achieve all learning goals along the way.


  1. First, do each increment as a parallel branch (follow the branch naming convention you followed earlier, e.g., branch-Level-8, etc.), but do not merge any.

    %%{init: { 'theme': 'default', 'gitGraph': {'mainBranchName': 'master'}} }%%
    gitGraph
    commit id: "m1"
    commit id: "m2"
    branch branch-A-Assertions
    checkout branch-A-Assertions
    commit id: "b1c1"
    checkout master
    branch branch-A-CodeQuality
    checkout branch-A-CodeQuality
    commit id: "b2c1"
    checkout master
    branch branch-A-Streams
    checkout branch-A-Streams
    commit id: "b3c1"
    commit id: "b3c2"
    checkout master
    
  2. Then, push each branch to your fork, and create a PR within your fork (i.e., from the increment branch to the master branch). Be careful not to create a PR to the upstream repo. If you did create such a PR by mistake, no worries, just close it yourself.

When you are doing the next step, you can run into merge conflicts. In some cases, GitHub will give you a way to resolve those conflicts using the Web interface. While this approach may be good enough for simple merge conflicts, de-conflicting locally in the usual way is safer (e.g., you can run tests to confirm the updated code is correct) and more standard (it's a standard Git feature that you can use even when you are not using GitHub for your project).

  1. Now, merge one of the PRs and update the remaining PRs accordingly, as given below:
    • Merge one of the PRs on GitHub. Remember to choose the Create merge commit option when merging.
    • The above step will cause the master branch of your local repo to fall behind that of your fork (). Therefore, you need to sync the local master with the remote master branch. One way to do that is to switch to the local master branch and then pull the updated master branch from your fork e.g.,
      $ git checkout master
      $ git pull origin master
      
    Tag the merge commit as usual, and push to the fork.
    The diagram below shows the current situation, assuming you merged the A-Assertions PR first.
    %%{init: { 'theme': 'default', 'gitGraph': {'mainBranchName': 'master'}} }%%
    gitGraph
    commit id: "m1"
    commit id: "m2"
    branch branch-A-Assertions
    checkout branch-A-Assertions
    commit id: "b1c1"
    checkout master
    branch branch-A-CodeQuality
    checkout branch-A-CodeQuality
    commit id: "b2c1"
    checkout master
    branch branch-A-Streams
    checkout branch-A-Streams
    commit id: "b3c1"
    commit id: "b3c2"
    checkout master
    merge branch-A-Assertions tag: "A-Assertions"
    
    • Note how the remaining are no longer in sync with the latest master. To rectify this, merge the master branch into each of them. Resolve merge conflicts, if any. The outcome will be something like the below:
    %%{init: { 'theme': 'default', 'gitGraph': {'mainBranchName': 'master'}} }%%
    gitGraph
    commit id: "m1"
    commit id: "m2"
    branch branch-A-Assertions
    checkout branch-A-Assertions
    commit id: "b1c1"
    checkout master
    branch branch-A-CodeQuality
    checkout branch-A-CodeQuality
    commit id: "b2c1"
    checkout master
    branch branch-A-Streams
    checkout branch-A-Streams
    commit id: "b3c1"
    commit id: "b3c2"
    checkout master
    merge branch-A-Assertions tag: "A-Assertions"
    checkout branch-A-CodeQuality
    merge master id: "merge master to ..."
    checkout branch-A-Streams
    merge master
    
    • Push the updated branches to your fork. The PRs will update automatically to reflect their updated branches.
  2. Merge the remaining PRs using a procedure similar to the above. The diagram below shows the situation after merging the A-CodeQuality PR and syncing the local branch-A-Streams with the updated master branch.
    %%{init: { 'theme': 'default', 'gitGraph': {'mainBranchName': 'master'}} }%%
    gitGraph
    commit id: "m1"
    commit id: "m2"
    branch branch-A-Assertions
    checkout branch-A-Assertions
    commit id: "b1c1"
    checkout master
    branch branch-A-CodeQuality
    checkout branch-A-CodeQuality
    commit id: "b2c1"
    checkout master
    branch branch-A-Streams
    checkout branch-A-Streams
    commit id: "b3c1"
    commit id: "b3c2"
    checkout master
    merge branch-A-Assertions tag: "A-Assertions"
    checkout branch-A-CodeQuality
    merge master id: "merge master to ..."
    checkout branch-A-Streams
    merge master
    checkout master
    merge branch-A-CodeQuality tag: "A-CodeQuality"
    checkout  branch-A-Streams
    merge master
    

FAQ Oops, I messed up my branching! Will I be penalized?


Duke A-Assertions: Use Assertions

Duke A-CodeQuality: Improve Code Quality

Duke A-Streams: Use Streams optional

4 Add Increment: A-CI

  • We recommend that at least one member of the team attempt the following.
Duke A-CI: Set up CI optional

5 Add an extension

  • Add at least one extension of your choice, selected from category B, C, or D i.e., pick just one item from one category, not one from each category, e.g., B-DoWithinPeriodTasks or C-Sort or D-Places
  • We recommend adding the extension via a branch (branch name is up to you). You may add it via a PR.
  • Add a tag named BCD-Extension to the corresponding commit.
    Regardless of the exact extension you added, the tag name should be BCD-Extension.

Discuss with your team members to ensure that each member picks a different extension.

You may want to pick an extension that is potentially relevant to your tP so that the code can be reused in the tP later, if possible.

AI Guidance » Specify before implementing

You can use this increment to experiment with a more 'specification-heavy' approach, aiming to separate "decide what it should do" from "make code changes."

Here is a sequence of sample prompts:

1. Disover and clarify -- no code.

Enter plan mode. I want to add this feature:

[feature request]

Inspect the current project and ask me every product decision that would materially affect the design, command syntax, validation, display, storage, backward compatibility, tests, or documentation. Do not change any files.

2. Write the agreed specification.

Using my decisions below, write an implementation-ready specification for the feature. Include user commands, valid and invalid examples, exact output, storage format, compatibility rules, acceptance criteria, and the files likely to change.

[your decisions]

Do not implement it yet.

3. Review the specification.

Critically review this specification against the existing codebase. Identify ambiguities, edge cases, and unnecessary complexity. Recommend the smallest useful scope. Do not modify files.

[specification]

4. Implement the agreed scope.

Implement the approved specification below. Do not add adjacent features or change behavior outside its scope. Update relevant JUnit tests, tests/test-plan.md, and docs/README.md. Explain any necessary deviation from the specification before making it.

[approved specification]

5. Verify against the specification.

Verify the implementation against the approved specification. Run the relevant JUnit, Checkstyle, and end-to-end CLI checks. Report each acceptance criterion as pass/fail with evidence. Do not make further changes unless I ask.

[approved specification]

6. Commit after review.

Review the final diff for unintended changes. If it matches the approved specification and verification passed, create one commit.


FAQ What if the minimum requirement for an increment is not specified? How do I decide how much work is enough?



iP: Week 4iP: Week 6