Skip to content

Conversation

@dnguye2
Copy link

@dnguye2 dnguye2 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? Figuring out what classes to implement for the project.
What was a design decision you made that changed over time over the project? Determining whether Reservation Class inherited or had a DateRange class.
What was a concept you gained clarity on, or a learning that you'd like to share? I gained more clarity on the Date class of Ruby.
What is an example of a nominal test that you wrote for this assignment? What makes it a nominal case? Checking whether a reservation class was correctly created. This is nominal because it's checking to see if the method is behaving as expected.
What is an example of an edge case test that you wrote for this assignment? What makes it an edge case? For the available room method, having an error raised for when there were unavailable rooms. This is an edge case because this is an overlooked scenario.
How do you feel you did in writing pseudocode first, then writing the tests and then the code? It helped me to plan out my code and design of the projects.

dnguye2 added 30 commits March 2, 2020 13:44
@jmaddox19
Copy link

jmaddox19 commented Mar 23, 2020

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 ✔️ Though I'm concerned that TDD might not have been happening because tests didn't run for me without a fix
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 Not until I made the change noted in my inline comments
A test coverage tool is installed and used, and shows 95% test coverage 92%, so close

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 wrote such thorough unit tests! The number of edge cases you wrote out is incredible. That practice will be invaluable as you go into your internship and beyond :)

I do see some room for improvement around ensuring that your tests all run when submitting the project. Running "rake" on the command line was not working for me. (See inline comments for more context on why.) It especially concerns me that the tests weren't working because it causes me to wonder if you were running the tests frequently while you were writing code. I'm hopeful you were running your tests and this was somehow working for you even though it wasn't for me.

I also see room for improvement in terms of data structure choice, specifically for @rooms within HotelManager. See my inline comments for details.

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

@@ -0,0 +1,183 @@
require 'test_helper.rb'

Choose a reason for hiding this comment

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

This line was causing the tests to be unable to run. I had to change it to look like the other tests.

Suggested change
require 'test_helper.rb'
require_relative 'test_helper'

def rooms
@rooms = []
20.times do |i|
@rooms << {(("room#{i+1}").to_sym) => []}

Choose a reason for hiding this comment

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

I see that @rooms is setup as an array of hashes. For future reference, this would have been much easier to work with simply as a hash, where the key to each item in the has is the room number and the value is the array of reservations.

# add reservation to master room list (@rooms)
reserved_room = Hotel::DateRange.new(start_date, end_date)
reserved = Hotel::Reservation.new(reserved_room.start_date, reserved_room.end_date)
@rooms[room_index][chosen_room] << reserved

Choose a reason for hiding this comment

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

If @rooms were updated to match what I've noted in the comment above, there wouldn't be a need to index into the data structure twice like it's done here.

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