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

Sockets - Riyo #24

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

Sockets - Riyo #24

wants to merge 7 commits into from

Conversation

RPerry
Copy link

@RPerry RPerry commented Mar 18, 2019

Hotel

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
What was a design challenge that you encountered on this project? Figuring out how the checkin and checkout times needed to be manipulated and what I would need the DateRange class to do.
What was a design decision you made that changed over time over the project? Instead of having the reservation booker class maintain most of the methods, I moved the methods to other classes and had reservation call those methods when necessary
What was a concept you gained clarity on, or a learning that you'd like to share? Nothing, I felt like I was regressing in my knowledge of ruby concepts, if anything.
What is an example of a nominal test that you wrote for this assignment? What makes it a nominal case? When validating checkin and checkout dates, I wrote a test that had the checkin date further in the future than the checkout date. It is a nominal case because it is obvious what the program will do when encountering it.
What is an example of an edge case test that you wrote for this assignment? What makes it an edge case? Will have to add edge cases.
How do you feel you did in writing pseudocode first, then writing the tests and then the code? When writing pseudocode, my reasoning behind designing my code the way I did made more sense than in reality when I was actually writing the tests and code.

I still have a failing test and only got through Wave 2

@dHelmgren
Copy link

Hotel

What We're Looking For

Feature Feedback
Baseline
Used git regularly I expect to see more check ins for a project of this size.
Answer comprehension questions I'm sorry that you felt like your were slipping in your understanding of Ruby during this project.
Design
Each class is responsible for a single piece of the program Yes, but it might be overdivided, see comments
Classes are loosely coupled Less so. You've created coupling between Rooms and Reservations.
Wave 1
List rooms Yes
Reserve a room for a given date range yes
List reservations for a given date yes
Calculate reservation price yes
Invalid date range produces an error yes
Test coverage Pretty good
Wave 2
View available rooms for a given date range Yes
Reserving a room that is not available produces an error yes
Test coverage Missed some edge cases that are important, see comments. Also, you've got a broken test!
Wave 3 DNF
Create a block of rooms
Check if a block has rooms
Reserve a room from a block
Test coverage
Fundamentals
Names variables, classes and modules appropriately yes
Understanding of variable scope - local vs instance yes
Can create complex logical structures utilizing variables yes
Appropriately uses methods to break down tasks into smaller simpler tasks yes, but see comments. You've written methods for things Ruby can already do.
Understands the differences between class and instance methods yes
Appropriately uses iterators and Enumerable methods yes
Appropriately writes and utilizes classes You're getting there, see comments
Appropriately utilizes modules as a namespace Yes
Wrap Up
There is a refactors.txt file yes
The file provides a roadmap to future changes yes
Additional Feedback It seems like you took a hit to your confidence on this one. I think this submission is pretty solid, but I agree with at least one of your assessments: you should be writing more edge case tests. You are very thorough in the way you write your code, but you could also stand to do a little more research before jumping into an implementation. You should be proud of what you did here! I hope you take some time to talk to Dan or Kaida about how this project went for you when you get back from the break.


it "raises an argument error if attempting to reserve an unavailable room" do
@reservation_booker.create_new_reservation(2019, 02, 10, 2019, 02, 12)
expect {@reservation_booker.create_new_reservation(2019, 02, 10, 2019, 02, 12)}.must_raise ArgumentError

Choose a reason for hiding this comment

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

This test had an error when I ran it.

@@ -0,0 +1,38 @@
module Hotel
class AllRooms

Choose a reason for hiding this comment

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

This is a small thing to prepare for Rails, but we generally don't name a class in the plural. Since classes are meant to be instantiated, we name them in the singular, as they represent the 'bones' of one entity.


module Hotel
class DateRange
def self.valid_checkin_dates?(check_in_year, check_in_month, check_in_day)

Choose a reason for hiding this comment

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

For the whole of the DateRange class, it would have been okay to pass in a Date object instead of passing in the day, month and year. You can rely on Date to make sure that the date is properly formatted.

return is_valid
end

def self.valid_checkout_dates?(check_out_year, check_out_month, check_out_day)

Choose a reason for hiding this comment

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

This does the same as the code above, so I'm not sure it's needed.




def available_on_these_dates?(check_in_date, check_out_date)

Choose a reason for hiding this comment

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

Nice! This is a good way to solve this problem.

attr_reader :all_reservations

def initialize
@all_rooms = Hotel::AllRooms.new

Choose a reason for hiding this comment

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

It would have been OK to let ReservationBooker and AllRooms be the same class. The booker would have been responsible for managing the rooms and the reservations, which would create coupling, but to an acceptable degree.

return is_valid
end

def self.check_in_date(check_in_year, check_in_month, check_in_day)

Choose a reason for hiding this comment

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

Again, let the date class do this work for you. All you've done here is make a small wrapper.

rooms_not_reserved = available_rooms_by_date_range(check_in_year, check_in_month, check_in_day, check_out_year, check_out_month, check_out_day)
room = rooms_not_reserved.sample

if room.available_on_these_dates?(check_in_date, check_out_date) == false

Choose a reason for hiding this comment

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

This check should be taken care of if available_rooms_by_date_range can be trusted. But a good check to put here: what if there are no rooms left?

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