Object based system to optimize a digital network for a city-bike service. A network of docking stations and bikes that anyone can use.
- Code Quality
- Technologies
- Getting Started
- Testing
- Domain Model
- Principles and takeaways
- Analysis
- Author
- 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.
Follow the instructions below to clone the repository and run it locally for testing and development demonstrations.
- Verify that a current version of Ruby is installed:
ruby -v
- Clone the repository:
git clone [email protected]:xelAhcratiPsavilO/city_bikes.git
- Launch irb, pry or other ruby REPL:
irb
- 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>
- 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
High-level overview of the entities that make up this functional system.
Based on client's requirements.
Objects-Messages diagram.
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.
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.
Alejandro Pitarch Olivas