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

Karis - Edges - Hotel #27

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

Karis - Edges - Hotel #27

wants to merge 70 commits into from

Conversation

kimj42
Copy link

@kimj42 kimj42 commented Sep 10, 2018

Hotel

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
Describe a design decision you had to make when working on this project. What options were you considering? What helped you make your final decision? I had to decide how many classes I needed and which methods will be communicating with the other classes. Some options were creating a rooms class which I ended up not using because it was unnecessary, creating a date range class which I also did not use because as it was addressed in the existing classes. My lack of experience with creating multiple classes and making them send each other messages made me stick to 2 classes. I also worked on this project in the end with my assigned Ada tutor who guided me into making these classes.
Describe a concept that you gained more clarity on as you worked on this assignment. I gained more clarity on how to write tests and that writing tests does help you grasp what you want in your code and out put. I gained a little more clarity on whether or not I need to pass in a parameter in the initialize method for the classes. I gained a little more clarity on whether or not I can use a method for a class that I created inside a different class. A gained a little bit more clarity on breaking down methods into smaller responsibilities and using booleans to do control flow in your code by working with my assigned Ada tutor. However, I still need to practice a lot more with classes, writing methods with less responsibilities, and especially with designing the classes.
Describe a nominal test that you wrote for this assignment. If there is no reservation, then a reservation will be created with the first available room which is room number 1.
Describe an edge case test that you wrote for this assignment. If all rooms are taken up to 20 for a given date, then an argument error is raised.
How do you feel you did in writing pseudocode first, then writing the tests and then the code? At first, I had difficulty with writing pseudocode first then tests then code. However, as I wrote more code, I realized that that process in that exact order helped me with my thought process. I also tried to write input and output first then try to write pseudocode in the middle to reach that output.

@tildeee
Copy link

tildeee commented Sep 21, 2018

Hotel

What We're Looking For

Feature Feedback
Baseline
Used git regularly x
Answer comprehension questions x
Design
Each class is responsible for a single piece of the program x
Classes are loosely coupled x
Wave 1
List rooms x
Reserve a room for a given date range x
List reservations for a given date x
Calculate reservation price x
Invalid date range produces an error x
Test coverage x, roughly
Wave 2
View available rooms for a given date range
Reserving a room that is not available produces an error
Test coverage
Wave 3
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 Adding a note about the name ReservationCreator
Understanding of variable scope - local vs instance x
Can create complex logical structures utilizing variables x
Appropriately uses methods to break down tasks into smaller simpler tasks x, yes!
Understands the differences between class and instance methods x
Appropriately uses iterators and enumerables i see some iteration
Appropriately writes and utilizes classes need to see more code to understand more!
Appropriately utilizes modules as a mechanism to encapsulate functionality x
Wrap Up
There is a refactors.txt file
The file provides a roadmap to future changes
Additional Feedback

Hey Karis!

You and I have talked together: this was a rough project. You had gone through with one path of development, and ultimately rolled back/didn't submit that version, and the version I see here is a work in progress.

It's fine, and I am writing a review of your code to evaluate it on the code that's here and how I feel continuing this code would look like.

I see the beginnings of a BookingSystem whose responsibility is to hold references to all of the rooms and existing reservations, and to make reservations. I also see a ReservationCreator whose responsibility seems to be to represent a single reservation-- the info associated with one, like a start date, end date, and to calculate its own booking cost.

I'm leaving some comments about where the code could be better, and they mostly revolve around these ideas:

  1. How do we feel about the names of things?
  2. There are some pretty neat syntax tricks you use. Some of them are neat, and some of them I have questions on
  3. All this being said, I think that the outline of the code in BookingSystem looks pretty good, and I'm leaving a comment about why I think so

Your tests are a pretty good start too -- the tests describe the facts of the state/attributes of each class. For all attributes on a BookingSystem, what data type are they? That's a good start-- the tests that should follow are for testing the behaviors of each class... When a class does something, what do we expect the result of that action equal?

While the code presented here ends up being a "red" grading here because it doesn't meet the standards/requirements of the project, I would like to repeat a few of the thoughts we went over in our last conversation: When there is a project with more direction, I'll want to see more practice on syntax and concepts, and when there is a project with less direction (like this one!), I'll want to see the wrestling with decision-making.

Lastly, I feel that I didn't get to talk with you about this face-to-face:
If you're having a rough time and you feel like you won't be successful with a project, please reach out to me or Dan-- reach out to us often and early-- we'll figure out a solution so you're successful in the learning goals together.

require 'date'

module Hotel
class ReservationCreator
Copy link

Choose a reason for hiding this comment

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

When I look at this class, it really feels like the attributes, state, behaviors that this class has resemble more of representing a Reservation.

If this object were a "ReservationCreator," I would imagine that its behaviors would be more about making Reservation instances, and wouldn't need a check in or check out date.

@check_in_date = Date.parse("#{input[:check_in_date]}")

@check_out_date = Date.parse("#{input[:check_out_date]}")
raise StandardError, "Checkout date cannot be before checkin date" unless input[:check_in_date] < input[:check_out_date]
Copy link

Choose a reason for hiding this comment

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

I like this post-fix conditional! But watch your indentation ;)


@check_out_date = Date.parse("#{input[:check_out_date]}")
raise StandardError, "Checkout date cannot be before checkin date" unless input[:check_in_date] < input[:check_out_date]
@room_number = input[:room_number].nil? ? [] : input[:room_number]
Copy link

Choose a reason for hiding this comment

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

This code says: if in the passed-in input hash, there is no value defined for the key :room_number, then the value of @room_number should be assigned to the empty array []. Otherwise it will be assigned the value of input[:room_number].

I think it makes sense that @room_number is input[:room_number] if it exists, but should it be assigned to an empty array if there was no given room number?

@reservations << reservation

return reservation
end
Copy link

Choose a reason for hiding this comment

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

I think from a birds-eye view, this method make_reservation is set up for success. It's outline is the following:

  1. Figure out what the room number of the next available room is
  2. Make a new instance of reservation with the following info: the passed in check in date, check out date, and the room number from step 1
  3. add that reservation to the collection of reservations being recorded in this class on @reservations
  4. return that reservation

I think that the rest of the work for wave 2 is just filling in the detail for those steps, and those details will be filled in with the helper methods. I think that this method looks really good as is though.

end

return bookings_by_date
end
Copy link

Choose a reason for hiding this comment

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

This method looks pretty good to me. I see the following logic:

We start with figuring out the specific_date that we'll be comparing things to, and an empty collection in bookings_by_date.

Looking through the entire collection of reservations in @reservations, for every reservation, we'll get to see look at every set of dates that each reservation holds... then we'll make a comparison: if those dates include the specific date we were looking at, then we'll add the reservation/booking to the collection bookings_by_date.

Not bad -- can't wait to see more!

end

def get_available_room(check_in_date:, check_out_date:)
return @rooms.first
Copy link

Choose a reason for hiding this comment

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

I'd love to get more insight into your thoughts here of how you wanted to continue and push this code -- feel free to add comments that include your pseudocode next time :)

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