Skip to content

xelAhcratiPsavilO/takeaway

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Takeaway

Object based system to create and manage takeaway orders. The menu can display the dishes and check prices and the system can record orders and send SMS confirmations via Twilio API.

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/takeaway.git
  • Install dependencies listed in the Gemfile:
bundle install
  • Launch irb, pry or other ruby REPL:
irb
  • Launch system script (Twilio verified number required):
ruby system_script.rb

Running

  • Load the Takeaway class (similarly for any other class):
> require './lib/takeaway'
=> true
  • Create a new Menu instance (similarly for any other class):
> menu = Menu.new
=> #<Menu:0x00007f8aee176d50>

Testing

  • Launch RSpec to verify that all tests are passing:
rspec
  • Expected output:
....
Finished in 0.01715 seconds (files took 0.11363 seconds to load)
16 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

A scalable design and seamless integration allowed the extraction and encapsulation of responsibilities into several classes. Abstraction and privatization of methods and properties allows to hide complexity creating simpler interfaces and reducing the impact of change. Dependency injection looses the coupling between objects, making the system more flexible, scalable and testable in isolated units. Forwarding methods allows to encapsulate behavior in new objects maintaining code in line with the single responsibility principle.

Analysis

There is room for improvement around abstraction and encapsulation to reduce the high number of instance variables. At the moment the system has a one on one relation of composition between Takeaway class and Menu class, it could be interesting considering that a Takeaway class could have several menus to choose from. It would have been interesting extracting the dish functionality into a Dish class. Currently the script shows a small portion of the system, it would have been worth expanding on the script to showcase all the functionality of the system. It would have been worth using memoization to make sure that instance variables in a method only get set once.

Author

Alejandro Pitarch Olivas

About

Takeaway service 🌮

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages