Tuesday, March 31, 2026

CST338: wk04 Peer Review

Reviewed: Ariya Briscoe & Tyler Kenney

Ariya Kenney

Encapsulation

·         Field members in both the Card and Deck class files privately set, effectively promoting encapsulation so no members cannot be directly accessed.

  • Appears to have all appropriate setters and getters that look to be necessary for the program with no getters or setters not being used.

Constructors

  • Constructor passes in Rank and Suit object variables into the constructor to set the field members with those associated values, however, there are no validation checks. If an invalid suit or value were to be passed in at the time the object was created, it would just create a card with that assigned suit and value.
  • There is no default constructor in the Card class file, but there is one in the Deck class file, The Card class file should remain without a default constructor as each card is defined by their rank and suit and would otherwise be set to NULL as their default value. While this could later be handled with setters and getters, for this case, we don’t “assign” cards their suits and values in real life. They already have those applied to them, so it’s better to construct the card as it would appear in the real world.

Readability and Style

·         Can easily follow along the logic throughout the program.

  • Code follows the Google Java Style Guide in terms of spacing, braces, and naming.
  • Did not use the checkstyle

Suprises

Ariya had progressed much further into project than I had made it to and found surprises while working on method implementations with the use of the helper methods. I agreed with this up to the Card and Deck files and found this to be the case for myself as well. However, we did encounter some minor hiccups we most certainly would have, if not already have, changed. For Ariya, this occurred during the test cases for Tableau that hinted at a needed different approach for a condition that would call removeCardsFrom() method. For me, the drawCards() method’s complication level was minimal, but in my tendency to over expand on otherwise simple logic, I found myself using an unnecessary while-loop and a redundant check for count being larger than card size. The real edge case I was missing was the empty list check, and by applying that change later, I was able to get the tests to run as expected.

 

Tyler Kenney

Encapsulation  

·         Instance variables are private for both the Card and Deck class files. This is important for encapsulation, and so variables cannot be directly called by the dot-operator, preventing accidental changes to core field members.

·         Getters and setters are available for the field members in both class files that seem appropriate and necessary.

Constructors

·         The constructor does not validate input on its own without having checks to handle passed in values at the time of instantiation. If someone were to pass in an invalid suit or value, the constructor would still construct a card with that assigned suit and value.

·         There is a default constructor for the Deck class and none for the card class, which is ideal as cards, in the real world, are not assigned or altered. This allows for the appropriate creation of a single card with the appropriate suits and values, that could only further in precision, if a check within the constructor constrained the parameters to meet the requirements of simulating a real-world card.

Readability and Style

·         Code logic is clean and easy to follow without having to run the program

·         The spacing within the file does appear to follow the Java Style Guide in terms of naming conventions, use of braces, and spacing.

Surprises

 While the implementation of the files were fairly straightforward, I found myself adding over complexity to the drawCards() method, adding unnecessary if-checks and while loops. Upon removal of these statements, I was pleasantly surprised at the simplicity of the logic.

 

 

 

Reflection

Before beginning the project, I first looked over the doc files to familiarize myself with the methods, UML, and implementation. This provided stability in which files to begin with and how they interact with one another. Following this, I constructed the layout of each file, following the UML before applying any implementation. This reduced time working with setup, so that the focus could be entirely on the implementation of the test files. For statements or logic, I was unclear about, I set a placeholder in the form of a comment where I felt the logic should be applied until I could see it more clearly.

In reviewing my classmate’s approach and following a discussion, I feel my approach was best for me, in that it provides me the resources and confidence before diving straight into code, which could have the opposite effect on an otherwise more fluid outcome. The implementation of the methods was friendly enough, for part1, to prevent any substantial differences in the code, apart from maybe comment cleanup and I did find myself with some hanging comments that could improve the readability of my code. My goal is to always improve, and while I don’t typically get offensive feedback, I’m welcome to any input that would promote stronger code structure.

toString() a method that can be overridden to display desired content specific to the file being accessed as opposed to using a staple default string for every file. This was once lost to me, as I couldn’t grasp the way the toString() could operate together / be combined.

Enum vs. constants are still a little lost on me, and in jumping between C and Java, it makes it that much messier. I thought of enums as being numerically auto generated variables, that are like constants, but with a default value beginning at 0. This doesn’t seem to be the case for java and there’s a little more that separates it from being a constant, yet somehow, it seems similar.

I most definitely celebrated after getting this assignment. Taking two courses and keeping up with the workload, on top of the fluidity of my implementations throughout the assignment recently increased my source of confidence and abilities. I took myself out to a movie for the first time in years, had a glass of wine, and enjoyed some very soothing Nordic music to ease the built-up tension of the week. 


 


No comments:

Post a Comment

CST338: wk04 Peer Review

Reviewed: Ariya Briscoe & Tyler Kenney Ariya Kenney Encapsulation ·          Field members in both the Card and Deck class files ...