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

Airport Challenge Stevie Spiegl #2510

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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

# User stories
# User stories

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

Expand All @@ -21,4 +21,4 @@ Does your README contains instructions for
- [ ] how to run,
- [ ] and how to test your code?

[Here is a pill](https://github.com/makersacademy/course/blob/main/pills/readmes.md) that can help you write a great README!
[Here is a pill](https://github.com/makersacademy/course/blob/main/pills/readmes.md) that can help you write a great README!
27 changes: 12 additions & 15 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
Tech Test Submission Requirements/Guidelines
======
# Tech Test Submission Requirements/Guidelines

Before submitting your test, please review the requirements/guidelines below. Note that the requirements are mandatory and if you do not satisfy them we won't review your code (we don't mean to be harsh but this is based on the minimum expectations that our hiring partners require when you submit code for tech tests).

Requirements
------
## Requirements

* Make sure you have written your own README that briefly explains your approach to solving the challenge.
* If your code isn't finished it's not ideal but acceptable as long as you explain in your README where you got to and how you would plan to finish the challenge.
* All code must be written test-first - we're looking for 100% test coverage or as near as possible to that figure.
* The test coverage statistics `SimpleCov` generates after your tests will show you what your coverage is like and where it's lacking.
* Ensure all your tests are passing.
* Check your code conforms to the [Rubocop](https://github.com/bbatsov/rubocop) style guide. Run `rubocop`, read and digest what it says, fix the violations and then run `rubocop` again to check. When you're done, commit and push.
* Advanced mode: run `rubocop` before every commit you make and fix mistakes before you even commit!
- Make sure you have written your own README that briefly explains your approach to solving the challenge.
- If your code isn't finished it's not ideal but acceptable as long as you explain in your README where you got to and how you would plan to finish the challenge.
- All code must be written test-first - we're looking for 100% test coverage or as near as possible to that figure.
- The test coverage statistics `SimpleCov` generates after your tests will show you what your coverage is like and where it's lacking.
- Ensure all your tests are passing.
- Check your code conforms to the [Rubocop](https://github.com/bbatsov/rubocop) style guide. Run `rubocop`, read and digest what it says, fix the violations and then run `rubocop` again to check. When you're done, commit and push.
- Advanced mode: run `rubocop` before every commit you make and fix mistakes before you even commit!

Guidelines
-------
## Guidelines

* Ensure you've understood the specification and built the code according to the challenge guidelines.
* Read through [Code Reviews :pill:](https://github.com/makersacademy/course/blob/main/pills/code_reviews.md) to understand what we're looking for in your code.
- Ensure you've understood the specification and built the code according to the challenge guidelines.
- Read through [Code Reviews :pill:](https://github.com/makersacademy/course/blob/main/pills/code_reviews.md) to understand what we're looking for in your code.
77 changes: 41 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
Airport Challenge
=================
**_Please scroll to bottom to see my notes_**

```
# Airport Challenge

``````
______
_\____\___
= = ==(____MA____)
Expand All @@ -11,53 +12,50 @@ Airport Challenge
`---~~\___________/------------`````
= ===(_________)

```
``````

Instructions
---------
## Instructions

* Feel free to use google, your notes, books, etc. but work on your own
* If you refer to the solution of another coach or student, please put a link to that in your README
* If you have a partial solution, **still check in a partial solution**
* You must submit a pull request to this repo with your code by 10am Monday morning
- Feel free to use google, your notes, books, etc. but work on your own
- If you refer to the solution of another coach or student, please put a link to that in your README
- If you have a partial solution, **still check in a partial solution**
- You must submit a pull request to this repo with your code by 10am Monday morning

Steps
-------
## Steps

1. Fork this repo, and clone to your local machine
2. Run the command `gem install bundler` (if you don't have bundler already)
3. When the installation completes, run `bundle`
4. Complete the following task:

Task
-----
## Task

We have a request from a client to write the software to control the flow of planes at an airport. The planes can land and take off provided that the weather is sunny. Occasionally it may be stormy, in which case no planes can land or take off. Here are the user stories that we worked out in collaboration with the client:
We have a request from a client to write the software to control the flow of planes at an airport. The planes can land and take off provided that the weather is sunny. Occasionally it may be stormy, in which case no planes can land or take off. Here are the user stories that we worked out in collaboration with the client:

```
As an air traffic controller
So I can get passengers to a destination
As an air traffic controller
So I can get passengers to a destination
I want to instruct a plane to land at an airport

As an air traffic controller
So I can get passengers on the way to their destination
As an air traffic controller
So I can get passengers on the way to their destination
I want to instruct a plane to take off from an airport and confirm that it is no longer in the airport

As an air traffic controller
To ensure safety
I want to prevent landing when the airport is full
As an air traffic controller
To ensure safety
I want to prevent landing when the airport is full

As the system designer
So that the software can be used for many different airports
I would like a default airport capacity that can be overridden as appropriate

As an air traffic controller
To ensure safety
I want to prevent takeoff when weather is stormy
As an air traffic controller
To ensure safety
I want to prevent takeoff when weather is stormy

As an air traffic controller
To ensure safety
I want to prevent landing when weather is stormy
As an air traffic controller
To ensure safety
I want to prevent landing when weather is stormy
```

Your task is to test drive the creation of a set of classes/modules to satisfy all the above user stories. You will need to use a random number generator to set the weather (it is normally sunny but on rare occasions it may be stormy). In your tests, you'll need to use a stub to override random weather to ensure consistent test behaviour.
Expand All @@ -70,20 +68,27 @@ Please create separate files for every class, module and test suite.

In code review we'll be hoping to see:

* All tests passing
* High [Test coverage](https://github.com/makersacademy/course/blob/main/pills/test_coverage.md) (>95% is good)
* The code is elegant: every class has a clear responsibility, methods are short etc.
- All tests passing
- High [Test coverage](https://github.com/makersacademy/course/blob/main/pills/test_coverage.md) (>95% is good)
- The code is elegant: every class has a clear responsibility, methods are short etc.

Reviewers will potentially be using this [code review rubric](docs/review.md). Referring to this rubric in advance will make the challenge somewhat easier. You should be the judge of how much challenge you want this at this moment.
Reviewers will potentially be using this [code review rubric](docs/review.md). Referring to this rubric in advance will make the challenge somewhat easier. You should be the judge of how much challenge you want this at this moment.

**BONUS**

* Write an RSpec **feature** test that lands and takes off a number of planes
- Write an RSpec **feature** test that lands and takes off a number of planes

Note that is a practice 'tech test' of the kinds that employers use to screen developer applicants. More detailed submission requirements/guidelines are in [CONTRIBUTING.md](CONTRIBUTING.md)
Note that is a practice 'tech test' of the kinds that employers use to screen developer applicants. More detailed submission requirements/guidelines are in [CONTRIBUTING.md](CONTRIBUTING.md)

Finally, don’t overcomplicate things. This task isn’t as hard as it may seem at first.

* **Submit a pull request early.**
- **Submit a pull request early.**

- Finally, please submit a pull request before Monday at 10am with your solution or partial solution. However much or little amount of code you wrote please please please submit a pull request before Monday at 10am.

Student notes:

* Finally, please submit a pull request before Monday at 10am with your solution or partial solution. However much or little amount of code you wrote please please please submit a pull request before Monday at 10am.
- I needed to spend some time practising on Boris Bikes to get my head around this one, and as a result I wasn't able to completely finish. Planes can take off and land, default capacity can be overridden by passing the airport an argument when instantiating it, and exceptions are raised according to the weather, but I was didn't have time to learn about stubbing to ensure regular testing, and didn't have time to work out how to defend against all edge cases. Consequently, it's possible to land the same plane into two different airports, or into the same airport twice etc. Though at least planes can only take off from airports that they're in, as far as I can tell. I'll look more into how to guard against these errors - I'm assuming some kind of exception? - but will need to submit it in its current state for now.
- If you run the rspec, you'll get different errors according to what weather you get, but the lowest number of errors is 2, which seems to be to do with a single plane being returned in an array...
- Also, I had planned to create a weather generator as a separate file but was struggling to call this so had to just use a constant.
- In terms of outside help, I took a quick look at this https://medium.com/@charlottebrf/makers-academy-day-5-8dc1c792cda5, which I stumbled upon while googling how to create a random weather generator, and which gave me the idea of using a constant for the capacity (and subsequently for the weather, as I never got onto making a generator in a separate class). Other than that, I also reached out to my mentor, Nico Cortese, Gawain Hewitt, and Jimmy Lyons.
Loading