Git Product home page Git Product logo

mahammad-mostafa / school-library Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 61 KB

This is the fifth project in the fourth module of the Microverse program. It is about a school library application implemented with Object Oriented Programming concepts using Ruby.

License: MIT License

Ruby 100.00%
inheritance microverse microverse-projects microverse-ruby microverse-students oop oop-in-ruby polymorphism rspec rubocop

school-library's Introduction

๐Ÿท๏ธ School Library

This is the fifth project of the fourth module in the Microverse program.
Check the below contents for further details about this project.

๐Ÿ“— Contents

๐Ÿ“– Description

The project follows Object Oriented Programming using Ruby. This repository includes ten class files (Person / Student / Teacher / Classroom / Book / Rental / Nameable / Decorator / Capitalize / Trimmer). Special class App for handling all app operations and a file main.rb as entry point for it. Module Storage used for handling JSON files read & write. Decorator design pattern is implemented for adding several operations on name variable in Person class. Several associations exist bewteen some classes. All data is preserved inside three files (books.json / people.json / rentals.json). Unit testing is carried on ten classes (Person / Student / Teacher / Classroom / Book / Rental / Nameable / Decorator / Capitalize / Trimmer). Every method in the above classes has an example test case inside specs directory.

๐Ÿ“Œ Tech Stack:

  • Code built with Ruby
  • Unit tests uses RSpec
  • Linting is done with Rubocop

๐Ÿ“Œ Key Features:

  • Class Nameable is a parent class for both Person & Decorator
  • Class Person is a parent class for both Student & Teacher
  • Class Decorator is a parent class for both Capitalize & Trimmer
  • Class Person includes a constructor & four methods
  • Constructor in Person class includes three arguments (age / name / parent_permission)
  • First method in Person class is a public method called add_rental
  • Second method in Person class is a public method called can_use_services
  • Third method in Person class is an unherited method called correct_name
  • Fourth method in Person class is a private method called of_age
  • Class Student includes a constructor & four methods
  • Constructor in Student class includes three arguments (classroom / age / name / parent_permission)
  • First method in Student class is a public method called play_hooky
  • Second method in Student class is a static method called input_arguments
  • Third method in Student class is a public method called generate_string
  • Fourth method in Student class is a static method called parse_string
  • Constructor in Teacher class includes three arguments (specialization / age / name / parent_permission)
  • First method in Teacher class is a public method that overrides can_use_services from parent class
  • Second method in Teacher class is a static method called input_arguments
  • Third method in Teacher class is a public method called generate_string
  • Fourth method in Teacher class is a static method called parse_string
  • Class Nameable includes one method correct_name that raises an exception
  • Class Decorator includes only constructor that passes a Nameable object
  • Class Capitalize includes one inherited method correct_name & overrides it
  • Class Trimmer includes one inherited method correct_name & overrides it
  • Class Classroom includes a constructor & three methods
  • Constructor in Classroom includes one argument label
  • First method in Classroom class is public method add_student
  • Second method in Classroom class is a public method called generate_string
  • Third method in Classroom class is a static method called parse_string
  • Class Book includes a constructor & three methods
  • Constructor in Book includes two arguments (title / author)
  • First method in Book class is public method add_rental
  • Second method in Book class is a public method called generate_string
  • Third method in Book class is a static method called parse_string
  • Class Rental includes only one constructor & three methods
  • First method in Rental class is a static method called input_arguments
  • Second method in Rental class is a public method called generate_string
  • Third method in Rental class is a static method called parse_string
  • Constructor in Book includes three arguments (date / book / person)
  • First method in Book class is a static method called input_arguments
  • Second method in Book class is a public method called generate_string
  • Third method in Book class is a static method called parse_string
  • Class App includes a constructor & twelve methods
  • Constructor in App initializes several empty arrays
  • Entry point in main.rb file with infinite loop
  • Module Storage includes two methods (read_file / write_file)

back to top

๐Ÿ› ๏ธ Instructions

You can easily download or fork this repository and work on it immadiately!

๐Ÿ“Œ Prerequisites:

  • You need Ruby language installed

๐Ÿ“Œ Installation:

  • To install all gem dependencies run
bundle install

๐Ÿ“Œ Development:

  • Run main.rb file with
ruby main.rb

๐Ÿ“Œ Tests:

  • To run unit tests navigate to specs directory and run:
rspec . -f d

back to top

๐Ÿ‘ฅ Authors

๐Ÿ“Œ Mahammad:

๐Ÿ“Œ Alexander:

๐Ÿ“Œ Austin:

back to top

๐Ÿ”ญ Future

Some additional features I may implement in the project:

  • Implement better visual interface

back to top

๐Ÿค๐Ÿป Contributions

Wish to contribute to this project?
Contributions, issues, and feature requests are more than welcome!
Feel free to check the issues page too.

back to top

โญ๏ธ Support

Like this project? Show your support by starring!

back to top

๐Ÿ™๐Ÿป Acknowledgements

I thank everyone at Microverse for guiding me through this project.

back to top

๐Ÿ“ License

This project is MIT licensed.

back to top

school-library's People

Contributors

alexansaa avatar mahammad-mostafa avatar stino-x avatar

Watchers

 avatar

school-library's Issues

Objects duplication

โ“ Problem

When data is loaded from storage, there are several duplicate objects with the same instance variables.

๐Ÿ’ก Suggestion

How about using custom JSON additions to implement a JSON output with the object id & class inside it?

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.