Coder Social home page Coder Social logo

faast's Introduction

Code Climate Test Coverage

####Week 1 Challenge at Makers Academy!

####SYNOPSIS

Implement FAAST System (Fast And Accessible Super Tube). Test it first.

The FAAST system will cater for the following:

  • There will be a number of trains inside the system.
  • Trains will travel from station to station.
  • Inside of a station, when the train stops, passengers will alight and enter the carriages of the train.
  • A Passenger will touch in at the station and touch out at the destination station.
  • Each coach of a train can hold up to 40 passengers.
  • Each train is made of a number of coaches.
  • BONUS - add a charging system where the passengers can only touch in a station (and access the train) if their account has more than 2 GBP.

####MY APPROACH As its stands for good projects to be started, first thing needs to be done is to understand what the problem actually is. I consider some nouns and verbs, which stands after for responsibilities, classes and collaborators. The Classes I decided relevant is Passenger, Train, Station, Coach. In the end I did small refactoring and implemented TubeContainermodule.

####TECHNOLOGIES:

  • Ruby

  • Rspec

#####PROGRAMMING CONCEPTS:

  • Test driven development (TDD)

  • Object Oriented Design (OOD)

  • Object Oriented Programming (OOP)

####HOW TO RUN

type in your terminal/commandline

ruby ./faast.rb

####CODE SNIPPET

My Train Class

class Train
  attr_reader :coaches

  DEFAULT_COACHES = 10

  def initialize(options = {})
    @coaches = []
    train(options.fetch(:carriages, DEFAULT_COACHES)) 
  end

  def add(coach)
    coaches << coach
  end

  def train(number)
    number.times { @coaches << Coach.new }
  end
end

####WHAT I'VE LEARNT

That there is always a lot of ways to solve a problem. But try not to Overthink one cause you can end up with job undone, and with lots of unnecessary complexity. And before writing any code, first thing is to understand what you need to do and how, only then CODE.

####FUTURE IMPROVEMENTS

I would like to not check if passenger in the tube system, but rather verify if he/she is at the particular station in order to reduce complexity of Passenger class.

And another thing I want to is to change some statements to make them more readable as plain English.

faast's People

Contributors

pavlrd avatar pawei avatar

Stargazers

Alan Bridger avatar Daniel (Ayo) Obembe  avatar Christopher Batts 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.