Skip to content

airport challenge - #2516

Open
laura-voss wants to merge 1 commit into
makersacademy:mainfrom
laura-voss:main
Open

airport challenge#2516
laura-voss wants to merge 1 commit into
makersacademy:mainfrom
laura-voss:main

Conversation

@laura-voss

Copy link
Copy Markdown

Laura Voss

Please write your full name here to make it easier to find your pull request.

User stories

Please list which user stories you've implemented (delete the ones that don't apply).

  • User story 1: "I want to instruct a plane to land at an airport"
  • User story 2: "I want to instruct a plane to take off from an airport and confirm that it is no longer in the airport"
  • User story 3: "I want to prevent landing when the airport is full"
  • User story 4: "I would like a default airport capacity that can be overridden as appropriate"
  • User story 5: "I want to prevent takeoff when weather is stormy"
  • User story 6: "I want to prevent landing when weather is stormy"

README checklist

Does your README contains instructions for

  • how to install,
  • how to run,
  • and how to test your code?

Here is a pill that can help you write a great README!

Comment thread lib/airport.rb
require_relative 'plane'

class Airport
DEFAULT_CAPACITY = 3

@AKCDNG AKCDNG Apr 25, 2022

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good use of a constant variable - omits the risk of using magic numbers

Comment thread lib/airport.rb

def initialize(capacity = DEFAULT_CAPACITY)
@planes_at_airport = []
@capacity = capacity

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@capacity = capacity can be changed to @capacity

Comment thread lib/airport.rb
@capacity = capacity
end

def land(_plane)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

_plane argument is not used within method, potentially can be omitted with caution, (I think).

Comment thread lib/airport.rb
end

def storm?
rand(10) >= 8

@AKCDNG AKCDNG Apr 25, 2022

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good way to make weather sunny most of the time

Comment thread lib/airport.rb
DEFAULT_CAPACITY = 3

# makes capacity variable
attr_accessor :capacity

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

attr_accessor can be changed to attr_reader

@AKCDNG AKCDNG left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

As an overview, the code is really neat. Everything is described well & a lot of the code made sense to me as to what it did. There are some comments that can be omitted but we spoke about that in person. There are some areas where there are opportunities to refactor your code which I've pointed out in the comments. Overall the code made a lot of sense for me to read.

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