Skip to content

Time - Vera#36

Open
veralizeth wants to merge 32 commits intoAda-C13:masterfrom
veralizeth:master
Open

Time - Vera#36
veralizeth wants to merge 32 commits intoAda-C13:masterfrom
veralizeth:master

Conversation

@veralizeth
Copy link

@veralizeth veralizeth commented Mar 9, 2020

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? Try to think of each class and have each one follow the principle of single responsibility. It was very difficult to think if it was too big, or if I was giving responsibilities that were not of the class or the method.
What was a design decision you made that changed over time over the project? I thought of creating a class that would be called client but then I didn't use it. Also at the beginning I didn't have a room class and then I decided to include it.
What was a concept you gained clarity on, or a learning that you'd like to share? Interact with classes and understand what an instance looks like.
What is an example of a nominal test that you wrote for this assignment? What makes it a nominal case? Test out the list of rooms. It is nominal because It was the basic-minimun thing my hotel structure should show.
What is an example of an edge case test that you wrote for this assignment? What makes it an edge case? Test out all the possible overlaps. Especially to test when an end_date reservation was the same as the start_date of a new reservation.
How do you feel you did in writing pseudocode first, then writing the tests and then the code? It was easy at the beginning, drawing the classes and their responsibility, was pretty useful. For the last methods to write the tests at first it became complicated, to think about what results I wanted and how to write a real test, that really test what I want or what I expect.

…t greater than end_date and the length not equals to 0 updating the overlap? and nights method
…. Test dates length 0 and all the case scenarios for ovelap? method
@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 ✔️I see a bit more room for testing edge cases for make_reservation and get_available_rooms
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 Not completed - that's ok :)
reserves a room from a block Not completed - that's ok :)

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 that you that you broke up complex logic and encapsulated functionality in helper methods. This helps to make your code more readable, flexible, and DRY. It is clear that you have met the learning goals around object composition in a complex system and TDD.

I do see some room for improvement around the thoroughness of your test cases, particularly for edge cases. Given how thorough the DateRange tests are, it is not necessary to be as thorough with the FrontDesk methods get_available_rooms and make_reservation. Still, a few tests to make sure that everything is linked up correctly and Exceptions are raised when they are supposed to would be helpful.

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
Logical/Organized

attr_reader :rooms, :date_range, :reservations

def initialize
@rooms = generate_rooms

Choose a reason for hiding this comment

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

Good use of a helper method.

return @rooms
end

def total_reservations

Choose a reason for hiding this comment

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

Consider whether this reader method is necessary. Would .reservations suffice?

# It returns an array with the list of reservations for a specific date.
# date = date instance.
def reservations_by_date(date)
total_by_date = @reservations.select do |reservation|

Choose a reason for hiding this comment

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

Good use of an enumerable method.

def make_resevation(date_range)
available_rooms = get_available_rooms(date_range)
if available_rooms.length < 1
raise ArgumentError

Choose a reason for hiding this comment

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

Consider whether a custom exception would be appropriate here.

expect(rooms).must_be :>, 1
end

it "raises an error if there are not available rooms" do

Choose a reason for hiding this comment

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

Minor note: I think this test belongs in the make_reservation describe block or a get_available_rooms. It took me a minute to find it :)

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