Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/er-contreras/oop_animal
It's a veterinary base on a UML using relational classes
https://github.com/er-contreras/oop_animal
oop ruby sql
Last synced: 14 days ago
JSON representation
It's a veterinary base on a UML using relational classes
- Host: GitHub
- URL: https://github.com/er-contreras/oop_animal
- Owner: er-contreras
- License: mit
- Created: 2023-01-03T00:00:22.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-05T01:43:14.000Z (about 2 years ago)
- Last Synced: 2024-10-18T06:52:11.858Z (4 months ago)
- Topics: oop, ruby, sql
- Language: Ruby
- Homepage:
- Size: 99.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OOP(Object-Oriented Programming) with Ruby
It was applied the four principles of OOP using plain ruby.
1. Encapsulation
2. Abstraction
3. Inheritance
4. PolymorphismThe first one allow us to handle public and private variables with accessors.
In other words getter and setters methods that give us the opportunity to write and read
variables of the object.The Second one give us the chance to abstract part of the code to make it more clean.
Instead of call the class `def animal.speak: end` in the method we can just say `def speak; end`.The third one is just taking the attributes of the parent class in order to avoid `nil`
outputs and set some specific attributes to the child class.The fourth, is when we just add the same name of a method in different classes but with different result.
## Applying Composition
We add composition in order to add object of food classes in Dog, Spider and Animals. This
help us not depend too much on inheritance.## UML
![](UML.png)