Skip to content

Conversation

@stephaniejmars
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? My design definitely evolved. I was excited to do my own design, but whenever I had to ask for help with something people I asked would question my design, and sometimes it was helpful, but sometimes it was a waste of time, and I wasn't getting the help I needed on simple syntax type issues I was having.
What was a design decision you made that changed over time over the project? I wanted Reservation to build reservations, but in the end I decided it would be a reservation and not have a reservation. Then I decided it would go in Manager, and eventually making a reservation ended up in Room.
What was a concept you gained clarity on, or a learning that you'd like to share? I learned a little more about Has vs Is. I still need clarity on attr_reader, Let, testing pieces within methods instead of just the outcome.
What is an example of a nominal test that you wrote for this assignment? What makes it a nominal case? I tested if a room is available on a date that was months away from any of its bookings.
What is an example of an edge case test that you wrote for this assignment? What makes it an edge case? I tested if a room is booked 4/1-4/2 and 4/3-4/7, it should be available to book 4/2-4/3 (and it wasn't, so I fixed it).
How do you feel you did in writing pseudocode first, then writing the tests and then the code? It is hard at first when you don't funny understand the syntax of the test, but it was helpful to do just small pieces of code and test at a time. Make sure its passing before I moved on.

…oom. Changed date_range to is_available_range
@jmaddox19
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) There seem to be some possible gaps in understanding here. See my inline comments for more details.
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 ✔️ 99%!!

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 setup readable and logical relationships between classes!

I do see some room for improvement around variable naming, instance variables, and readers/writers. Please see the inline comments for more details.

Please reach out to me if any of my comments don't give enough detail or if you could use more explanation!

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

Comment on lines +10 to +11
attr_writer
attr_accessor

Choose a reason for hiding this comment

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

Just so you know, these lines aren't needed when you don't have any attributes you want to list for them.

attr_writer
attr_accessor

def initialize(num: 20)

Choose a reason for hiding this comment

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

This is a great way to set this up! A great example of where input params to a constructor can be totally different than the instance variable(s)!

end
end

def self.create_rooms(num: 20)

Choose a reason for hiding this comment

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

Cool that you made this its own method!


def res_by_room(rm_num, start_date, end_date)
res_array = []
@found_room = @all_rooms.find {|room| room.rm_num}

Choose a reason for hiding this comment

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

This could/should be a local variable rather than an instance variable since it is only used within this one method.
That would be changed by just removing the @

Suggested change
@found_room = @all_rooms.find {|room| room.rm_num}
found_room = @all_rooms.find {|room| room.rm_num}


module Hotel
class Manager
attr_reader :num, :all_rooms, :rm_reservations, :recloc

Choose a reason for hiding this comment

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

This should only define readers for instance variable of the Hotel class. The only of these 4 that is an instance variable of Hotel is all_rooms.

Suggested change
attr_reader :num, :all_rooms, :rm_reservations, :recloc
attr_reader :all_rooms

Choose a reason for hiding this comment

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

I imagine you might understand that and just forgot to update this line.

rm_num: nil,
cost_per_day: 200,
total_cost: nil,
recloc: nil)

Choose a reason for hiding this comment

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

I'm having trouble understanding what this variable represents. It's best to name variables in such a way that their purpose is clear to anyone who might read the code.


module Hotel
class Reservation
attr_reader :start_date, :end_date, :rm_num, :cost_per_day, :total_cost, :recloc

Choose a reason for hiding this comment

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

These all correspond to instance variables. Great!

def find_total_cost(rec_loc)
res = ""
@all_rooms.each do |room|
if room.rm_reservations.find{|res| res.recloc[:recloc] == rec_loc}.class == Hotel::Reservation

Choose a reason for hiding this comment

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

This is just slightly too indented.
I use this handy VSCode plugin called "indent-rainbow" to make that really easy to notice.

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