DEV Community

sfrunza13
sfrunza13

Posted on • Edited on

Lab 4

This weeks task...

This week we set off to once more contribute to one of our classmates projects although we are learning new habits. This time we were tasked with adding a -c or --config flag to our classmate's repo and ensure that they can pass a .json file to specify the rest of the arguments that were pertinent to their project.

I picked Wonkeun's repo to contribute to this time, I noticed it was a Java project and I thought I knew it well enough to contribute.

The issue, PR and merge commit

I filed this issue, I created this PR and after reviewing it Wonkeun merged here: 7f16a5.

Gitting into good habits

Before I go on about what it was that I did with the Java solution I wanted to talk about the kinds of habits that we were encouraged to build through this week.

This week we were again talking about PRs and commiting frequently. This week we were taught to create a PR early and add commits as we go, then when we are ready to mark it for review. We also were taught about the concept of the origin and upstream remotes and how to keep tabs on the main of the original project and the origin of your fork as you work, we also learned the difference between fetching and pulling.

Arryell Parris added the same -c / --config functionality to my program on her own fork and branch. Part of the exercise this week was to create another good habit in creating a remote and tracking branch to fetch our collaborators code and test it before merging it from the command line by pulling it into our main. With the clear instructions provided it was a straight forward experience for me and I will have to remember to continue to do it to really build the habit, I can already tell this will not be the only time I refer to last week's information for upstream / origin and tracking branch conventions. This is the merge commit , I just had another commit right after to remove the config file from the repo since I did not want it as a part of the repo the same way I would not want the test .txt files to be. I think I should also update the README to reflect the -c change soon.

Git real!

I initially forgot to create a new branch! So if I could go back and start all over that would be what I would do for sure. Since it was not much yet, I ended up reverting the master branch back and rewriting some of my work on a new branch after the fact.

Java and Maven

Now as to the solution, I already mentioned I used a pre-existing jar, json-simple, that has many convenient methods and classes to use when parsing json. In the past however I have mostly worked on Java Springboot projects that have had the added benefit of working with pom.xml files to manage dependencies so it actually took me a bit of effort to finally figure out how I was going to add the dependency to this project. In the end I created a libs folder which I added to the classpath when compiling and running the program. I have spoken to the original author about the changes and how to get the same working on their machine since I did not commit the libs folder. I also appended the -config usage to the README.md as well.

Top comments (0)