Skip to content

Conversation

@ktvoort123
Copy link

Assignment Submission: Hotel

Congratulations! You're submitting your assignment. Please reflect on the assignment with these questions.

Reflection

Question Answer
What was a design challenge that you encountered on this project? One of the design challenges that I encountered on this project was how to handle hotel block reservations. I wasn't sure if they should be a class, and if they should, if they should inherit from another class.
What was a design decision you made that changed over time over the project? A design decision that I made that changed over time in my project was the room reservation class. Initially it was its own class, but once faced with the block reservations dilemma, I decided to create a reservation parent class and turn the room reservations into a child class.
What was a concept you gained clarity on, or a learning that you'd like to share? I believe I strengthened my understanding in object composition throughout this project.
What is an example of a nominal test that you wrote for this assignment? What makes it a nominal case? An example of a nominal test that I wrote was my "returns true for the same range" test in the "overlap?" describe block. It tested that the overlap? method could successfully test if a normal, correct range would be found to overlap with a different, normal, correct range. It tested the output of this method, and expected it to be equal to true. This is a nominal test because it tests that with normal inputs, the method works as expected.
What is an example of an edge case test that you wrote for this assignment? What makes it an edge case? An example of an edge case test that I wrote was the "raises an argument error if no arguments are given" test in my room_test file. This is an example of an edge case because it tests how the program would handle unexpected input.
How do you feel you did in writing pseudocode first, then writing the tests and then the code? I struggled with writing code last -- I found that I often had ideas and wanted to transform them into code right away, so I had to struggle to force myself to first write the pseudocode, then tests, then actual code.

…ange instance variable. Also made reservations_for_room an instance variable
… not an instance of Hotel::Room, and removed the unused and commented out date range method which now lives in the intiliaze method
@dHelmgren
Copy link

Hotel

Section 1: Major Learning Goals

Criteria yes/no, and optionally any details/lines of code to reference
Practices SRP by having at least two separate classes with distinct responsibilities, and test files for these two classes ✔️
Overall, demonstrates understanding instance variables vs. local variables. (There aren't unnecessarily too many instance variables, when it should be a local variable) ✔️
For each test file, tests demonstrate an understanding of instantiating objects properly, and using Arrange-Act-Assert ✔️
Practices pseudocode and TDD, and reflected on it by filling out the reflection questions ✔️
Practices git with at least 15 small commits and meaningful commit messages ✔️

Section 2: Code Review and Testing Requirements

Criteria yes/no, and optionally any details/lines of code to reference
There is a class that represents a reservation, and a second class that holds/manages a collection of reservations through composition (instance variable) ✔️
The logic for checking if a reservation's date overlaps with another reservation's date is complex logic that is separated into method(s) (and potentially class(es)) ✔️
The logic for checking if a reservation's date overlaps with another reservation's date has unit tests ✔️
All of the given tests run and pass ✔️
A test coverage tool is installed and used, and shows 95% test coverage ✔️

Section 3: Feature Requirements

Feature Requirement: There is a method that... yes/no
gives back a list of rooms, and it's tested ✔️
creates a specific reservation for a room for a given date range, and it has nominal test cases ✔️
creates a specific reservation for a room for a given date range, and it tests an edge case, such as no available room, or invalid date range ✔️
gives back a list of reservations on a given date. Its tests include a test that makes several reservations for a given date ✔️
calculates the total price for a reservation ✔️
gives back a list of available rooms for a given date range, and it has nominal test cases ✔️
gives back a list of available rooms for a given date range, and it has edge test cases, such as no available room, or invalid date range ✔️
creates a block of rooms ✔️
reserves a room from a block ✔️

Overall Feedback

Overall Feedback Criteria yes/no
Green (Meets/Exceeds Standards) 14+ total in all sections ✔️
Yellow (Approaches Standards) 9-13 total in all sections
Red (Not at Standard) 0-8 total in all sections, or assignment is breaking/doesn’t run with less than 5 minutes of debugging

Additional Feedback

Great work overall! You've built your first project with minimal starting code. This represents an incredible milestone in your journey, and you should be proud of yourself!

I am particularly impressed by the way that you did a great job breaking down how each class in your design could track and update data! There aren't too many dependencies between classes, and nothing is too tightly coupled! I also think you were very methodical in your tests!

I do see some room for improvement around reducing down complicated operations. This is admittedly tricky to do on a deadline, but whenever possible, avoiding using loops where they aren't necessary and avoiding having two variables with mutually dependent data will make your code faster, and make it harder to make mistakes!

Your code produces the following warning:

/Users/devin/Documents/Ada/c13/hotel/lib/hotel_controller.rb:56: warning: method redefined; discarding old reservations

Code Style Bonus Awards

Was the code particularly impressive in code style for any of these reasons (or more...?)

Quality Yes?
Concise
Logical/Organized

@@ -0,0 +1,5 @@
{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you forgot to .gitignore the coverage folder!

Comment on lines +19 to +20
@available_rooms.delete(room)
@reserved_rooms.push(room)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pretty good, but did you consider using the rooms as keys and a bool as a value in a hash? That would reduce your data overhead a bit, and means that you don't run the risk of forgetting to update one of the two arrays! :)

Comment on lines +14 to +19
self.nights.times do |day|
range.nights.times do |day_in_range|
return true if (range.start_date + day_in_range) == (@start_date + day)
end
end
return false

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a simpler version of this logic that doesn't require looping! Draw a timeline, and put a date range on it, then draw out all possible relationships the ranges can have with it. I often take the approach of making a table or drawing a sketch when I want to simplify boolean logic.

end
end

describe "overlap?" do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love how thorough this is!

require_relative 'room.rb'

module Hotel
class HotelController

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class is REALLY well scoped! It's letting the classes that its composed of do the heavy lifting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants