GithubHelp home page GithubHelp logo

kiytang / airport Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jamesjoshuahill/airport

0.0 2.0 0.0 192 KB

Makers Academy week 3 test - Object oriented model of airports and planes

Home Page: http://jamesjoshuahill.tumblr.com/post/60532729861/double-pay-for-clean-simple-readable-code

airport's Introduction

Airport

Makers Academy Week 3 - Test

This test was set by Enrique Comba Riepenhausen @ecomba and Alex Peattie @alexpeattie whilst learning to code at Makers Academy. The aim was to build an object oriented model of airports and planes in Ruby.

I wrote this code alone using RSpec for TDD. I started by writing the CRC cards (shown below). The primary aim of this test was to write clean, simple, readable code. I think the closest I came to this aim was in my Airport class:

def clear_to_land?
has_space_in_hanger? and has_sunny_weather_and_no_bomb_scare?
end

After the test specification I completed the first stretch goal to give each airport a runway and for planes to taxi to the runway before take off.

This model could be improved by making the airport's collection of planes into a separate Hanger class.

Class Weather

Responsibilities Collaborators
can be sunny or stormy Airport
can switch state at random

Class Plane

Responsibilities Collaborators
can land at an Airport, if clear to land Airport
can take off from an Airport, if clear to take off

Class Airport

Responsibilities Collaborators
has a maximum capacity of Planes Plane
has a collection of Planes Weather
has its own Weather
can have a bomb scare
can call off a bomb scare
can be clear for take offs and landings
(i.e. has space, not stormy, no bomb scare)

airport's People

Watchers

 avatar  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.