Skip to content

Conversation

@Shonda860
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? Everything. I went in only wanting to use three classes, however, I ended up with 5 classes. The trick was remembering everything a class did and how they worked together.
What was a design decision you made that changed overtime over the project? I decided to make everything a class for easier understanding.
What was a concept you gained clarity on, or learning that you'd like to share? I got a better understanding on writing the test. However, I'm still unsure on some of how to test for certain things.
What is an example of a nominal test that you wrote for this assignment? What makes it a nominal case? I checked when a reservation date range was a couple of days apart. Since there was not conflict there should be no overlap.
What is an example of an edge case test that you wrote for this assignment? What makes it an edge case? I checked when a reservation date range shared a check-in and check-out date. That case was on the edge since a res can share check in date as another checkout date.
How do you feel you did in writing pseudocode first, then writing the tests and then the code? I like writing the pseudocode even tho it changed a million times and my test was way off.

@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 broke down the problem and split the responsibilities evenly among all of the classes. Each class had a clear purpose, and was allowed to be "in charge" of its data in a really robust and meaningful way! Your work here is an excellent example of class delegation, one that you should be really proud of!

I do see some room for improvement around cleaning up your code for submission. It's all working correctly, but leaving in long comments and dead, commented out code just adds noise when someone tries to understand your work. I also see you using a lot of comments, which isn't bad necessarily, but I think you might be able to trust your readers a little more, or (if the comments are more for you) come up with some naming conventions that help you classify different kinds of methods.

Code Style Bonus Awards

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

Quality Yes?
Perfect Indentation
Logical/Organized

Comment on lines +3 to +19
class Reservation < Date_Range
attr_accessor :room_num, :check_in_date, :check_out_date

def initialize(room_num, check_in_date, check_out_date, hotel_block_reservation = false)
@room = room_num
@check_in_date = check_in_date
@check_out_date = check_out_date
@hotel_block_reservation = hotel_block_reservation
end

#each time the employee creates a reservation it is created here

# Every room is identical, and a room always costs $200/night
def total_cost_for_stay
number_of_nights? * 200
end
end

Choose a reason for hiding this comment

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

Just for your notes, I would probably never write a class smaller than this. If you ever write a class that doesn't have any instance methods, it can probably just be a hash. :)

#date range (5) 2001,2,8 - 2001, 2,10 2 nights
#date range (6) 2001,2,8 - 2001, 2,12 4 nights
#date range (7) 2001,2,12 - 2001,2,14 4 nights

Choose a reason for hiding this comment

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

These tests are excellent! Nice work!

Comment on lines +13 to +26
def check_overlap_with_room_reservations(requested_date_range)
# check if the check_in and check_out date overlaps with any other reservations for the room.
# Return true if no reservation conflicts with the checkin and checkout date.
if !@reservations.any? { |res| res.overlaps_in_reservations?(requested_date_range) }
return true
end
return false
end

def create_new_reservation(check_in_date, check_out_date, hotel_block_reservation = false)
new_res = Reservation.new(room_num, check_in_date, check_out_date, hotel_block_reservation)
@reservations << new_res
return new_res
end

Choose a reason for hiding this comment

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

I appreciate how you use Room to take some functionality away from the HotelDispatcher class here.

Comment on lines +38 to +44
# def contains(date)
# if date >= @check_in_date && date < @check_out_date
# return true
# else
# return false
# end
# end

Choose a reason for hiding this comment

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

Don't forget to pull out dead code before you submit!

Comment on lines +76 to +81
# This method is used to create a Hotel Block
# Takes in Room Ids and check in and check out date
# inside the method we create a method we create a variable called new requested_date_range which uses the Date_Range class
# room_ids is the number of rooms
# need to raise error if more than 5 rooms
# using the make rooms we

Choose a reason for hiding this comment

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

Unless this method is doing something really tricky or clever, I'd try to shorten these kinds of comment to 2 or fewer lines. That way I can see this method in the context of the other methods, which can help folks understand how they come together as a class.

end
end

describe "Can create a Hotel room block??????" do

Choose a reason for hiding this comment

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

Can it?????? (Tests seem to say, "yes" :P)

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