CST338 - Learning Journal - 2
CST 338 - Unit Tests, Git Commands, Interfaces
Unit Tests:
- Unit tests are smaller tests to help test each method, constructor, getter and setter that are created in the code.
- The difficult part about Unit Tests I found was when completing Full Calorie HW 01 because of working backwards in a way. Having the unit tests pre-written was helpful when creating new methods but it was hard when one test would work for one method but fail for another. In other terms, it did help create more concise code as well as making sure the code did not have any bugs. They also helped identify all functionality of the methods that were created.
Git Commands:
-The importance of git command is that you are able to save your work as well as contribute to group projects and have easier ways of getting assistance when one is stuck while coding.
- Some of the important git commands we have used:
- git status: give a list of all the files that have been changed
- git add . : allows you to add which changed files you want to commit onto GitHub
- git commit -m "message of your commit": able to submit a commit of your changes to GitHub but also allows to leave a message of what was changed
- git branch: allows you to switch branches in the repository
- git merge: allows you to merge branches
-git push: allows you to push your changes to GitHub if someone needs to take a look or if you need to submit your code
-git pull: allow you to pull any changes made to the repository that were not made by you or if they were made by you but not locally saved.
Interfaces: used to define abstract methods in a class. Allows the code to have multiple interfaces and obtaining multiple different behaviors from one class. A basic example of an interface would be:
public interface walk{
void yes();
void no();
}
}
Comments
Post a Comment