Week 11

CST-338 Week 3

 This week was the third week of CST-338. In this week we continued to learn more design and Java concepts.

Black Box & White Box Testing

This week we learned about two methodologies used for testing programs, black box and white box testing.

  • Black box tests only focuses on the input, output, and functionality of a program, and not the internal code, logic, or structure of a program. One of the advantages of black box tests is that they are simple and easy to run.

  • White box tests focus on the code, logic, and structure of a program. One of the advantages of white box tests is that can find logical errors, security vulnerabilities, or inefficiencies in code.

Coupling & Cohesion

This week we learned about coupling and cohesion in objects and methods.

  • Coupling refers to how much different classes rely on each other. If two classes have tight coupling then they are more dependent, and changes in one are more likely to affect the other. If two classes have loose coupling then they are more independent, and changes in one are less likely to affect the other.
  • Cohesion refers to how broad or specific the focus of a class is. A class with high cohesion is designed for a more specific range of tasks, while a class with low cohesion is designed for a more broad range of tasks.

Code Review

This week we are finishing up with a large project. As part of an additional assignment, we have to review the code of one or more of our classmates. We have been given several questions to answer while looking at our classmates' code. We also have to summarize the feedback we received.

Code Review - Jian

Variable names, are they meaningful and clear?

  • Variable names are meaningful and clear.

Logic that could be more efficient

  • The code is efficient. However, I think that the attackModifier method which calculates the modifier for how much damage a monster takes based on the elemental types of the two monsters, could have been slightly more efficient. Instead of checking if both monster types are the same for each type separately, one if statement could have been used to check if the types are the same.

Unused imports or warnings.

  • Some warnings could have been cleared by using enhanced for loops instead of regular for loops.

Clear formatting

  • All of the code is formatted clearly. Different sections of code are separated by extra white space, which makes the code easier to read.

Are there comments?

  • There are JavaDoc comments for each method describing what they do, their parameters, and their return values.

Do all the tests pass?

  • All of the unit tests pass.

Code Review - Suhaib

Variable names, are they meaningful and clear?

  • Variable names are meaningful and clear.

Logic that could be more efficient

  • The code is efficient. However, I think that the attackModifier method which calculates the modifier for how much damage a monster takes based on the elemental types of the two monsters, could have been slightly more efficient. Instead of checking if both monster types are the same for each type separately, one if statement could have been used to check if the types are the same.

Unused imports or warnings.

  • One warning could be cleared by using a StringBuilder instead of concatenating Strings in the Monster.toString method.

Clear formatting

  • The code is clearly formatted.

Are there comments?

  • Each method has a JavaDoc comment describing what they do, their parameters, and their return values. Additionally, there are some comments within methods that break up and explain sections of code, which helps the code be even more readable.

Do all the tests pass?

  • All of the unit tests pass.

Feedback Summary  - Nasser

The feedback I received from Nasser is that my code is clear, easy to read, well-commented, and efficient. However, he did note that I could clear a warning by removing an unused import. 

Project 1 Questions

Additionally, we have been asked to answer some questions about the project individually.

Was any part of the code a struggle for YOU?

  • Before this project I had not been exposed to abstract classes or methods in Java. It took some effort for me to fully understand these.

Was any part of writing the code easy for YOU?

  • Setting up the class, its constructor, and its setters and getters was easy. Additionally, I found many of the methods straightforward to design.

What is your biggest victory?

  • Besides setting up the class and creating method stubs, which I did on a different day, I was able to finish the entire project in one day.

 

Comments

Popular posts from this blog

Week 4

Week 2

Week 1