Giter Club home page Giter Club logo

boris-bikes's Introduction

Boris Bikes

The first pairing project in the Makers Web Development Bootcamp, Week 1

alt text


The idea behind this 22 step challenge is to familiarize ourselves with practical Test Driven Development using RSpec, Ruby, the command line (pry or irb), git, and GitHub. We also track our progress, learning experiences and goals on Diode.

I wrote out my process in this README file, as a reminder for when I attempt the air traffic controller challenge.


1. Set up Project

2. User Stories

Translate two user stories -

As a person,
So that I can use a bike,
I'd like a docking station to release a bike.

As a person,
So that I can use a good bike,
I'd like to see if a bike is working

into a functional representation inside a table, sorted by nouns and verbs

NOUNS person, docking station, bike

VERBS use, release, see (if working)

TABLE

Objects Messages
docking_station release
bike bike_works?

Visual Representation of how objects communicate

docking_station --> release_bike --> bike --> person
person --> bike_works? --> use_bike

3 & 4. Feature test errors

In 3. we created this error:

2.4.1 :001 > docking_station = DockingStation NameError: uninitialized constant DockingStation from (irb):1 from /Users/username/.rvm/rubies/ruby-2.2.2/bin/irb:11:in '<main>'

Type of error: Name error

File path: /Users/username/.rvm/rubies/ruby-2.2.2/bin/irb:11:in '<main>'

Line number: 1

What does it mean?: the name we wrote down is undefined

How to solve error?: Define or initialize the name

5. Unit tests

Although we ran Rspec, we got a Ruby error only. This is because we have not written any Rspec rules/tests for our code yet (we think).

6. Pass first unit test

Created new file for DockingStation class, and defined the class. Used require to link files. Explained difference in rspec findings.

7. Ran feature test & fixed code for unit test

8. Added release_bike method

9. Built a bike

10. Actioned release_bike method

11. Used instance variables & attribute reader

12. Raising exceptions (error tests)

New user story:

As a member of the public,
So that I am not confused and charged unnecessarily,
I'd like docking stations not to release bikes when there are none available.

Learnt new Ruby fail method, and RSpec {} syntax for exceptions

13. Limit the capacity

New user story:

As a maintainer of the system,
So that I can control the distribution of bikes,
I'd like docking stations not to accept more bikes than their capacity.

Added error message if docking station ran out of space (full capacity) and stops user from docking bike there.

14. Complex attributes

New user story:

As a system maintainer,
So that I can plan the distribution of bikes,
I want a docking station to have a default capacity of 20 bikes.

Wrapped collections

15. Single responsibility

16. Defining constants

17. Initializing defaults

New user story:

As a system maintainer,
So that busy areas can be served more effectively,
I want to be able to specify a larger capacity when necessary.

Took way too long to fix newly introduced errors here; lots of going back to previous exercises.
Solution was in understanding the difference between constant and instance variables, and where to use them.
Onwards to the airport challenge!!!

boris-bikes's People

Contributors

dani-boo 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.