Skip to content

City bikes service πŸš΄β€β™€οΈπŸš΄β€β™‚οΈ

Notifications You must be signed in to change notification settings

xelAhcratiPsavilO/city_bikes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

30 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

City Bikes

Object based system to optimize a digital network for a city-bike service. A network of docking stations and bikes that anyone can use.

Table of Contents

Code Quality

Maintainability

Technologies

  • Main technology
    • Ruby - High-level, general-purpose language utilized as main technology.
  • Unit Test
    • RSpec - Domain specific language utilized as testing tool.
  • Feature Test
    • IRB - Interactive ruby shell utilized as a REPL.
  • Documentation
    • MD - Lightweight markup language utilized for documentation.

Getting Started

Follow the instructions below to clone the repository and run it locally for testing and development demonstrations.

Prerequisites

  • Verify that a current version of Ruby is installed:
ruby -v

Installing

  • Clone the repository:
git clone [email protected]:xelAhcratiPsavilO/city_bikes.git
  • Launch irb, pry or other ruby REPL:
irb

Running

  • Load the Bike class (similarly for any other class):
> require './lib/bike'
=> true
  • Create a new DockingStation instance (similarly for any other class):
> station = DockingStation.new
=> #<DockingStation:0x00007f8aee176d50>

Testing

  • Launch RSpec to verify that all tests are passing:
rspec
  • Expected output:
.............................
Finished in 0.08404 seconds (files took 0.57766 seconds to load)
38 examples, 0 failures

Domain Model

High-level overview of the entities that make up this functional system.

Based on client's requirements.

Objects-Messages diagram.

Principles and takeaways

Letting the stack trace guide a BDD approach contributes to the familiarization with the logs interpretation. Using guard conditions to raise exceptions is a pattern that catches errors preventing the program from going any further. Wrapping a collection is a common pattern to define state in a class. Applying the Single Responsibility Principle is a good practice to increase readability when refactoring. Removing magical numbers makes an implementation more descriptive. Doubling objects and stubbing behaviors allows to test units in isolation. Mixing a Module into several Classes keeps the code dry.

Analysis

It would have been worth investigating and applying immutability to optimize the algorithms. It would have been interesting researching the possibility (or not) of making some methods protected, instead of public or private, to allow some Classes to use them but prevent the user access to them. Researching the possibility of a different syntax for methods that receive two arguments would have increase the readability of such methods.

Author

Alejandro Pitarch Olivas

About

City bikes service πŸš΄β€β™€οΈπŸš΄β€β™‚οΈ

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages