Git Product home page Git Product logo

airport_challenge's Introduction

----- MY README -----

---PROGRAM USAGE--- Weather objects are generated and controlled by the Airport class, and should not be directly accessed.

example_plane = Plane.new Planes initialize as flying, and have 1 variable - state. This should be either 'Flying' if flying or the @airport_id value of the airport they are stored in, if landed.

example_airport = Airport.new(airport_id, capacity) Airports initialize with a default name of 'Toby's Airport, and default capacity of 5. They also generate a weather object when created, and set the local weather to randomly generated weather.

example_airport.land_plane(example_plane) - should land a flying plane and change its state, if the weather is sunny, and the airport is not full. example_airport.take_off - should takeoff the plane at the end of the @planes array, and change its state, if the weather is sunny, and confirm that the plane has taken off.

examle_airport.regenerate_weather - should rerandomize the weather of the airport, giving confirmations along the way.

---MY APPROACH--- I started this challenge by considering the user stories. I arranged them in an order of increasing complexity, and then broke them down into steps with a rough idea of the tests I would write. Step 1 - Feature Test, Unit Test and Implement: Creating a Plane, Creating an Airport, and Storing the Plane in the Airport. Step 2 - Feature Test, Unit Test and Implement: The Plane leaving the Airport, and sending confirmation. Step 3 - Here I stopped following the given user stories for a step, and implemented some common-sense / edgecase user stories, such as Planes only taking off from Airports. Step 4 - I decided to represent weather with a Class, which I think was a mistake in hindsight. I test drove the creation of a basic weather class that returns 'Sunny' 80% of the time, and 'Stormy' 20% of the time. Step 5 - Here I had technically met the user stories, but my code did not follow SRP, or cover all edgecases, and my tests were not using doubles. This step involved covering the remaining edgecases. Step 6 - Here I changed my tests to function using doubles, this was easier than I thought it was going to be, in most cases. I struggled a little bit, and ended up unable to cover a line in my Airport.rb with a test. Step 7 - Finally I refactored my code to follow SRP more closely. Finishing Steps - Would be good to write an exhausting feature test, and to rework the weather class into a simple 'stormy?' method.

airport_challenge's People

Contributors

anitacanita avatar anthony-hull avatar bebbs avatar dbugsy avatar dearshrewdwit avatar leoallen85 avatar michaellennox avatar mihailiviucojocar avatar neoeno avatar nikeshashar avatar silvabox avatar sjmog avatar spike01 avatar tansaku avatar tbrockster avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.