Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time - Haben #38

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open

Time - Haben #38

wants to merge 23 commits into from

Conversation

HabenFoto
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 challenge that I found hard was whether to have a fourth class with Class name Room in wave 1 and two. And making it work without the Room class as most of the methods had to be under the HotelController. Also trying to decide whether Block class to inherit from HotelController class.
What was a design decision you made that changed overtime over the project? When I got to wave 3, I decided to add another class with the name Block so that I don’t have to overcrowd my methods under the HotelController class.
What was a concept you gained clarity on or learning that you'd like to share? Wrapping methods inside another class’s method in order to use it or access it easily within the second class is one thing I can mention.
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 is in the overlap test, it will return false if the new date range is completely after the date range. This test falls into the expected usage for the DateRange class.
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 used was to raise an ArgumentError if the start date is greater than the end date. This is an edge case because it is not a valid use of the DateRange class.
How do you feel you did in writing pseudocode first, then writing the tests and then the code? Writing pseudocode is a great way of making your skeleton of the code you are trying to write. It helped me a lot especially in visualizing it when it was overwhelming to think about what the code would look like. I hope to improve my pseudo-coding ability as I feel like I’m not doing it as much as I need to.

@beccaelenzil
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 See in line comment -- you should check that it finds the correct available rooms.
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 See in line comment -- what does this method return if there are no available rooms?
creates a block of rooms Not completed
reserves a room from a block Not completed

Overall Feedback

Overall Feedback Criteria yes/no
Green (Meets/Exceeds Standards) 14+ total in all sections ✔️

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 you implemented tricky logic using a solid object oriented design. You have written a number of tests that are clear are clear and thorough. I've left a few inline comments suggesting ways you might refactor your code and places where you should test edge cases. Please follow up if you have any questions. Keep up the hard work!

Code Style Bonus Awards

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

Quality Yes?
Perfect Indentation
Elegant/Clever
Descriptive/Readable
Concise
Logical/Organized

available_rooms = []
# iterate through the rooms to find available room
@rooms.each do |room|
reservations = list_reservations_for_room(room, start_date, end_date)

Choose a reason for hiding this comment

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

Interesting design choice to use list_reservations_for_room here. This works! However, you don't necessarily need to know all the reservations for that room, just the ones that overlap. Consider if there's a way you could refactor this to make it more efficient.

@end_date = end_date
end
# check if date selected overlaps with the date_range
def overlap?(new_start_date, new_end_date)

Choose a reason for hiding this comment

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

Nice use of a boolean expression to return true or false. You don't even need a conditional :)


#############################################

describe "overlap?" do

Choose a reason for hiding this comment

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

Good work fleshing out these tests!

end
end
describe "list_reservations_for_room" do
it "returns a list of reservations that fall with in the given date range for a specific room." do

Choose a reason for hiding this comment

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

You should also have an edge case test for the situation where there are no reservations for a given room.

expect(reservation).must_be_kind_of Hotel::Reservation
end

it "return false if there are no availalbe rooms" do

Choose a reason for hiding this comment

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

Minor note, perhaps rephrase as it "raises an exception if there are no available rooms" do

end

# assert
expect{(@hotel_controller.reserve_room(start_date, end_date))}.must_raise ArgumentError

Choose a reason for hiding this comment

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

Consider using a custom exception.


end

describe "show_reservations_for_date" do

Choose a reason for hiding this comment

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

Consider the edge case where there are no reservations for a particular date.


describe "wave 2" do
describe "find_available_rooms" do
it "takes two dates and returns a list" do

Choose a reason for hiding this comment

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

You need a few more test cases here. For instance, Make sure that it finds the correct available rooms. What if there are no available rooms?

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.

4 participants