Skip to content

Conversation

@sarabrandao21
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? Deciding how many classes to start with was very challenging.
What was a design decision you made that changed over time over the project? I added a class called room later on and instantiated in the hotel controller class creating an array of instances of room.
What was a concept you gained clarity on, or a learning that you'd like to share? I gained more confidence writing tests and classes. At first I had a hard time trying to connect the class, but started being more confident after 3 days reviewing the lessons about classes and instances.
What is an example of a nominal test that you wrote for this assignment? What makes it a nominal case? "date range can be initialized with two dates" is a nominal test because is what I expect my algorithm to do.
What is an example of an edge case test that you wrote for this assignment? What makes it an edge case? "It is an an error for negative length ranges, raises an argument error.". It is an edge case because is not something I am expecting to happen but if it happens I need to take care of it.
How do you feel you did in writing pseudocode first, then writing the tests and then the code? I can see why is effective but I still struggle writing the tests before the program. I found really helpful to write pseudocode first.

@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 up functionality between your classes! Each class is responsible for a small piece that pertains to its data, and other classes use those methods! Also, you are very thoughtful about what goes in your before blocks! Nice!

I do see some room for improvement around understanding how require works. I'm not sure this is something I can clearly summarize here, but it's best to have each file only include the exact files that it needs in order to run. If you can remove a require and the code still runs, it didn't need to be there!

Here are the warnings your code produced:

/Users/devin/Documents/Ada/c13/hotel/lib/date_range.rb:1: warning: loading in progress, circular require considered harmful - /Users/devin/Documents/Ada/c13/hotel/lib/hotel_controller.rb
    from /Users/devin/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/rake-13.0.0/lib/rake/rake_test_loader.rb:5:in  `<main>'
    from /Users/devin/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/rake-13.0.0/lib/rake/rake_test_loader.rb:5:in  `select'
    from /Users/devin/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/rake-13.0.0/lib/rake/rake_test_loader.rb:17:in  `block in <main>'
    from /Users/devin/.rbenv/versions/2.5.5/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in  `require'
    from /Users/devin/.rbenv/versions/2.5.5/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in  `require'
    from /Users/devin/Documents/Ada/c13/hotel/test/date_range_test.rb:1:in  `<top (required)>'
    from /Users/devin/Documents/Ada/c13/hotel/test/date_range_test.rb:1:in  `require_relative'
    from /Users/devin/Documents/Ada/c13/hotel/test/test_helper.rb:19:in  `<top (required)>'
    from /Users/devin/Documents/Ada/c13/hotel/test/test_helper.rb:19:in  `require_relative'
    from /Users/devin/Documents/Ada/c13/hotel/lib/hotel_controller.rb:1:in  `<top (required)>'
    from /Users/devin/Documents/Ada/c13/hotel/lib/hotel_controller.rb:1:in  `require_relative'
    from /Users/devin/Documents/Ada/c13/hotel/lib/reservation.rb:2:in  `<top (required)>'
    from /Users/devin/Documents/Ada/c13/hotel/lib/reservation.rb:2:in  `require_relative'
    from /Users/devin/Documents/Ada/c13/hotel/lib/date_range.rb:1:in  `<top (required)>'
    from /Users/devin/Documents/Ada/c13/hotel/lib/date_range.rb:1:in  `require_relative'
/Users/devin/Documents/Ada/c13/hotel/lib/reservation.rb:21: warning: method redefined; discarding old cost
/Users/devin/Documents/Ada/c13/hotel/lib/hotel_controller.rb:15: warning: method redefined; discarding old reserve_room
/Users/devin/Documents/Ada/c13/hotel/lib/hotel_controller.rb:26: warning: method redefined; discarding old get_available_rooms
/Users/devin/Documents/Ada/c13/hotel/lib/hotel_controller.rb:36: warning: method redefined; discarding old access_reservations

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

end

def include_date_range?(date_range)
date_range.start_date.between?(@start_date, @end_date) || date_range.end_date.between?(@start_date, @end_date)

Choose a reason for hiding this comment

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

Nice clear logic here!

@@ -0,0 +1,31 @@
require_relative 'hotel_controller'

Choose a reason for hiding this comment

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

This creates what's called a circular load, think about your code like a tree. Some things are going to be closer to the root, some things are going to be the ends of branches. This file is the end of a branch!

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