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- Mair H #33

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

Time- Mair H #33

wants to merge 18 commits into from

Conversation

mheshmati-tech
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? I particularly thought design was the toughest part since I was unsure if my idea for the design was going to make classes flow together in sync or not; imagining the relationships between classes and how one another related was also difficult especially when I wasn't even sure which classes should exist. In conclusion, the biggest challenge was, what classes should I create and how will they interact/relate to one another.
What was a design decision you made that changed over time over the project? initially I didn't have a room class but over time it made more sense to make one to hold some informations regarding each room. overtime I realized that the list of reservation within each room class is probably unnecessary and redundant but the function to check if the dates overlap was the biggest function of room class so far- this could have been done in the date range class and I am just realizing that creating a room class wouldn't be necessary after-all - for this assignment at least.
What was a concept you gained clarity on, or a learning that you'd like to share? This assignment definitely made me get way more comfortable with classes and testing- overall I feel like I have a better grasp of OOP/classes. I loved working on this project because I got a lot out of it .
What is an example of a nominal test that you wrote for this assignment? What makes it a nominal case? most tests are nominal cases- they test for the main function of the method aka what the method is suppose to do.
What is an example of an edge case test that you wrote for this assignment? What makes it an edge case? I tested for if a user inputs invalid date range for instance arrival and departure on the same date or if the departure date is before arrival.
How do you feel you did in writing pseudocode first, then writing the tests and then the code? It helped at some points but some points I felt like writing the method first helped more especially when I was unsure of how the method should be executed. but I found pseudocode to be particularly useful when I was writing my tests- of what requirements my method needs to meet.

…ia require and require_relative test files needed to run the minitests
…t is an instance variable in the Reservation class while an instance method in the DateRange class. updated tests accordingly
…p some of the reservation_dates tests for the Reservation class
…n to implement the Room class method and instance variable- work in progress. no new tests written for any of the new changes
…m and dates_unavailable to Room to add all room reservations and return an array of all the dates the room has been booked respectively. wrote and modified list_of_reservations(date) and list_of_available_rooms(start_date, end_date) respectively to FrontDesk.
… date range dates and the duration of the stay respectively
…and a method to add room's reservation to it's own list
…d that call on DateRange object. room is inputted as a string and not a Room instance
…eing reservations for a specific date, and list of rooms available given a date range- tests are written but code base needs refactoring to dry up the code
Copy link
Contributor

@kaidamasaki kaidamasaki left a comment

Choose a reason for hiding this comment

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

Great job! Here are a few tips for how to clean up your code.

attr_reader :start_date, :end_date

def initialize(start_date, end_date)
raise(ArgumentError, "The end date #{end_date} is smaller or same as the start date #{start_date}.") unless end_date > start_date
Copy link
Contributor

Choose a reason for hiding this comment

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

Great use of a guard clause!

Comment on lines +26 to +30
if (dates_unavailable & test_date_range).length > 0
return false
else
return true
end
Copy link
Contributor

Choose a reason for hiding this comment

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

You can just directly return the condition here (once you negate it), since it's a boolean value:

Suggested change
if (dates_unavailable & test_date_range).length > 0
return false
else
return true
end
return !((dates_unavailable & test_date_range).length > 0)

Or even better:

Suggested change
if (dates_unavailable & test_date_range).length > 0
return false
else
return true
end
return (dates_unavailable & test_date_range).length <= 0

Comment on lines +69 to +70
before do
end
Copy link
Contributor

Choose a reason for hiding this comment

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

You don't need to include a before if you don't have anything to stick in it.

Comment on lines +18 to +19
expect(@reserve.instance_variable_get(:@start_date)).must_equal @start_date
expect(@reserve.instance_variable_get(:@end_date)).must_equal @end_date
Copy link
Contributor

Choose a reason for hiding this comment

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

In the future don't use things like instance_variable_get instead just put an attr_reader on the class.

@kaidamasaki
Copy link
Contributor

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 ✔️ I'd like to see you focus on practicing TDD in the future more however. Since you found writing the method first helped you I'd recommend psuedocoding the method first and then giving the test a try once you have a better idea of what you want to accomplish there.
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 ✔️ This logic is complex. In the future please test things like this more thoroughly.
All of the given tests run and pass ✔️
A test coverage tool is installed and used, and shows 95% test coverage ✔️ 🎉 100% 🎉

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 ✔️ This logic is complex. In the future please test things like this more thoroughly.
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 No edge case test.
creates a block of rooms Not implemented.
reserves a room from a block Not implemented.

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 your test setup. I liked that you made sure there were several useful variables that you could re-use in future tests.

I do see some room for improvement around TDD as mentioned above and also the design topics you touched on in your refactors file.

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

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