Week 3 Project 1 LDPM Review



Summarize the feedback you received about your code:


The group at Replicant Collective met in a discord call to review each other's code, we took a moment to double check our variable names and method signatures to match the uml and prompt requirements. Double checking if our fields, access modifiers and classes are correctly named. Tim and Austin noticed in my main monster class many of the methods that returned a double actually had a signature with a capital D "Double" which in this case returned a wrapper object of type double instead of the primitive data type. This actually caused some issues with the Dice object being called in these methods. In addition, Lex and Tim noted on the format of my code mentioning that I should group the self-created methods first and have the auto-generated code displayed towards the end of the main monster class. This would lead to my program having clear readability. They all mentioned that my variables names were clear and easy to understand and the javadocs made it easy to follow the method's functionality. We showed each other tests passing and commented on the different implementations we had for attackModifier. Lex and Austin commented on how interesting my original 2D array implementation of attackModifier was and how the use of inline-comments throughout the code made it easy to understand the different steps.

Identify any trends you noticed when evaluating the code of others:


Some trends that we noticed with the group was getting the toStrings method to correctly output the object. I think truly we had trouble organizing the output to get it exactly the same as the one in the prompt. Austin mentioned that we should have utilized string builders to manage the string creation of the objects/monsters. We all had great use of in-line comments to allow clear readability, easy to follow variable names, and general formatting following the google style java format. Something I did notice was that the group had different styles when approaching the attackModifier even though they all functioned quite similarly. Tim utilized Hashmaps which was an interesting use of data structures to manage the modifier data. We didn't have any trouble passing the tests, just some annoyance in toStrings and outputting the correct format of the string returned for the object. Other than that we noticed similar numerous use of if/else statements and enhanced for loops.

Was any part of the code a struggle for You?


I struggled a lot trying to understand the logic for the attack modifier because I was considering that both the attacking and defending objects had multiple elemental types. When implementing the attack modifier originally, I used a 2d Array to store the modifier data from the chart in the prompt and to compare the data I would get with the ordinal of the attacking and defending objects. The ordinals would serve as the index of the 2d Array which would access the appropriate compared object's modifier. The logic for this was flawed since the 2d Array follows the organization of the Enum class ElementalType in its rows and columns. So if the organization of the Enum class would somehow change, the whole method would not work. Instead I opted to implement a simple switch case and enhanced for loop to iterate through the attacking elements and return the best modifier if there are multiple types.

Was any part of writing the code easy for YOU?


A majority of the code was quite straightforward as it involved numerous if/else statements. I think particularly setPhrase(), toString(), and setType() were easy to implement. Anything that required to go through a condition and output a message when a requirement was met was simple. I thought the sub-classes were easy to create since they all share similar methods and fields. The only thing needed for that was to manage the correct default values of each sub-class's fields. The most recent project I had done involved similar object oriented programming and inheritance so a lot of the concepts in LDPM were familiar such as overridden methods and code reusability. The only caveat was understanding the keywords in Java like extends and using @Override instead of void methodName override () like in C++.

What is your biggest victory?


My biggest victory was getting the output entirely correct to follow the prompt's output. At first I had trouble getting the correct outputs to display when certain monsters were attacking each other. For Example, some moments it kept only outputting shrugs off puny attack for every attack. After identifying where the calculation was incorrect in the takeDamage method, only then did I feel some relief in completing the project. I didn't really have trouble with the code itself other than finding a suitable implementation for attackModifier because of my confusion with the prompt. That was cleared after an email to Dr. C. Biggest lesson I learned from this project was to really understand the prompt and ask questions as early as possible.

Comments