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.
- 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/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
- 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>
- 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
High-level overview of the entities that make up this functional system.
Based on client's requirements.
Objects-Messages diagram.
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.
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.
Alejandro Pitarch Olivas