Skip to content

Ports -- Kate#35

Open
goblineer wants to merge 52 commits intoAda-C11:masterfrom
goblineer:master
Open

Ports -- Kate#35
goblineer wants to merge 52 commits intoAda-C11:masterfrom
goblineer:master

Conversation

@goblineer
Copy link

Hotel

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
What was a design challenge that you encountered on this project? My design was absolutely perfect and I experienced no challenges whatsoever ... right? RIGHT!?
What was a design decision you made that changed over time over the project? The experience I had with this project was more like a design paradigm shift than a design decision. I began with a very concrete idea of what classes, methods, and data structures I would need, built them up using TDD, then suddenly hit a wall. As I went to write my first test of the actual behavior of the system I'd created, it became clear that my design was really convoluted. It wasn't impossible to operate, but when it came to actually using all of the methods, I was writing a truly massive block of code just to begin testing. It seemed like a good time to refactor, to decouple some of the classes and really figure out where all of the methods belonged. And that seemed like a great idea at the time. I started moving a few things around, consolidating a few others ... and one after another, classes shrank to nothing, methods merged together ... and I actually got pretty scared for a long, weird night and day of work that I was going to somehow refactor my entire perfectly operational Wave 2 hotel back to a blank page. I could feel intuitively that I was going in the right direction, but deleting huge chunks of code is terrifying and deleting entire classes is even moreso. I don't have enough experience to trust the process and know that refactoring maybe just feels like that sometimes, so I was not happy at all. And then ... and then it just worked! It worked again! I kept going until all of the unneccesary stuff was gone or blended in with something else, and I'd gone from having a Date_Ranges class and a Hotel class and a Construction module and a Room_Factory and and and ... to having, well, two classes. Just two. little. classes. I think that's the biggest design change I've ever done after having already started work on something. I went from a Wave 2 hotel that looked like a huge patchwork quilt alllll the way to the other side of a wormhole where I was done with Wave 2, but this time with a hotel that looked more like a mylar space blanket. All without starting over. Just refactor, refactor, refactor.
What was a concept you gained clarity on, or a learning that you'd like to share? I learned that it's quite important to work through TDD using meaningful tests as soon as possible. It is, it turns out, not hard to go for days coding a project in TDD testing state after state and going from red to green quite easily because the tests are not actually engaging with any interactions, only that the widget method is making widgets that look like widgets. The real glory of TDD is in testing behaviors, since states ought to be a given (and often are). By the time I got around to testing something REAL, it was tremendously difficult to make the changes that I wanted to make when the test showed me how tightly-coupled my methods had become. I knew I needed to roll it back, but I would have been much more successful in the project as a whole if I had known that much sooner, which I would have if I'd been writing more meaningful tests.
What is an example of a nominal test that you wrote for this assignment? What makes it a nominal case? I wrote a bunch of nominal tests. One example is a test that makes sure that the list of available rooms contains an array with room 20 as the only entry. It's a nominal case because the test condition I arranged was intentionally booking the rooms from 1-19 on the same day, then checking what rooms were open. This is exactly the kind of thing the program was made to do, and it does it. It's testing to make sure everything plugs along nicely and accurately under normal conditions.
What is an example of an edge case test that you wrote for this assignment? What makes it an edge case?
How do you feel you did in writing pseudocode first, then writing the tests and then the code?

@CheezItMan
Copy link

Hotel

What We're Looking For

Feature Feedback
Baseline
Used git regularly Some funny commit messages, but you mostly described functionality added, and had a good number of commits
Answer comprehension questions Funny, I'm glad you got more comfortable with refactoring, you left a few questions blank.
Design
Each class is responsible for a single piece of the program Check
Classes are loosely coupled Check
Wave 1
List rooms Check
Reserve a room for a given date range Check
List reservations for a given date Check
Calculate reservation price Check
Invalid date range produces an error Check
Wave 2
View available rooms for a given date range Check
Reserving a room that is not available produces an error Check
Wave 3 INCOMPLETE
Create a block of rooms
Check if a block has rooms
Reserve a room from a block
Test coverage 95%
Fundamentals
Names variables, classes and modules appropriately Check
Understanding of variable scope - local vs instance Check
Can create complex logical structures utilizing variables Check
Appropriately uses methods to break down tasks into smaller simpler tasks Check
Understands the differences between class and instance methods Check
Appropriately uses iterators and Enumerable methods Check
Appropriately writes and utilizes classes Check
Appropriately utilizes modules as a namespace Check
Wrap Up
There is a refactors.txt file Check
The file provides a roadmap to future changes Check, see my comments
Additional Feedback Not bad, you didn't get to wave 3, but that's not unusual. Check out my comments for what you did.

@@ -0,0 +1,18 @@
{

Choose a reason for hiding this comment

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

Maybe include the .vscode folder in .gitignore

@@ -0,0 +1,6 @@
module Errors

Choose a reason for hiding this comment

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

👍

ROOMS = (1..20).to_a
module Hotel
class Registry
attr_accessor :reservations, :okay_rooms

Choose a reason for hiding this comment

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

okay_rooms????


def initialize
@reservations = []
@okay_rooms = []

Choose a reason for hiding this comment

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

@okay_rooms probably doesn't need to be an instance variable. You could make it a local variable in available? which could return a list of rooms which are available.

Making it an instance variable which several methods are playing with and making it an accessor opens you up to side effects.

@check_in = Date.parse(check_in)
@check_out = Date.parse(check_out)
@room = room
end

Choose a reason for hiding this comment

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

I suggest detecting the overlapping of dates here or in another DateRange class to simplify your Registry class.


3. Consider splitting out another class hereabout or thereabout ... we didn't mean to get this, er, aerodynamic and it might backfire when the blocks come in, or in terms of readability.

4. Figure out what the heck 3 lines the tests aren't covering and cover them. No newline at end of file

Choose a reason for hiding this comment

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

😆 However maybe a refactor dealing with design instead.

expect(@test_registry.available?("2019/07/19", "2019/07/25")).must_equal(true)
end

it "pushes available room numbers to okay_rooms array" do

Choose a reason for hiding this comment

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

This test gets into the internal workings of your class that the user shouldn't have access to. Better not not give the user access to okay_rooms


it "reservations array contains all bookings" do
expect(@test_registry.reservations.length).must_equal(2)
end

Choose a reason for hiding this comment

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

You should also test that you can book a room with a reservation that starts on the same day the previous one ended.

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