-
-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
oop exercise - a-tiny-oop-world #256
base: main
Are you sure you want to change the base?
Conversation
Hey! Congratulations on your PR! 😎😎😎 Let's do some self-checks to fix most common issues and to make some improvements to the code before reviewers put their hands on the code. Go through the requirements/most common mistakes listed/linked below and fix the code as appropriate. If you have any questions to requirements/common mistakes feel free asking them here or in Students' chat. When you genuinely believe you are done put a comment stating that you have completed self-checks and fixed code accordingly. Also, be aware, that if you would silently ignore this recommendation, a mentor can think that you are still working on fixes. And your PR will not be reviewed. 😒 A Tiny JS World -- (pre-OOP) exercise check listRelates to Object-Oriented JavaScript task. Check-list - definition of done
Universal recommendations:
Also take a note of the requirements above and follow them in all your future projects. Sincerely yours, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@expero1 very well done!
We still can leverage specialized Array
methods.
Also handling not own properties by classes (child's prop by base class and base class prop by child class or indirectly referring to them via harcoded values) is an anti-pattern. Solvable within OOP/SOLID paradigm.
Let me know if you want to take this challenge.
discarded |
…t combined to `limbs` Object. Also `HANDS` and `LEGS` now static constant of `Habitat`, not just strings Some refactoring of `toString()` More info in [codereview](kottans/frontend-2022-homeworks#256 (comment))
so now legs and hands not properties of Habitat, but combined to `limbs` Object. Also `HANDS` and `LEGS` now static constant of `Habitat`, not just strings Some refactoring of `toString()` More info in [codereview](kottans#256 (comment))
Thank you. Your code review was very helpful and educational for me. I will try to further study the principles of SOLID in order to correctly apply them in practice. |
This issue has been automatically marked as stale because there were no activity during last 14 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. А. Чому так? Б. Що робити, якщо в піарі нема оновлень, оскільки не зрозуміло, що треба зробити? В. А якщо я все зробив(ла) і це ментор не рев'юває мої зміни?
Г. Хіба недостатньо того, що я додав(ла) коміт із змінами? Традиційна пропозиція: задай питання по вищенаписаному в студентському чаті. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@expero1 well done.
However we need to make properties handling OOP and SOLID compliant.
What if we want dozens of different types of limbs for different species? How cluttered the base class would become?
class Habitat { | ||
static SPECIES = { DOG: "dog", CAT: "cat", HUMAN: "human" }; | ||
static GENDER = { MALE: "male", FEMALE: "female" }; | ||
static LIMBS = { HANDS: "hands", LEGS: "legs" }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Base class doesn't need to provide all sorts of limbs for all possible situations of child classes.
Why we cann't treat any limbs as any other properties like species
or name
?
If it is a shared property it is then defined at some shared (base) class. If a prop unique to a specific class so let that specific class define and handle that property.
Adding a class-specific property shouldn't affect any of its parents or children.
This what Open-Closed and encapsulation principles are.
How can a child method let its parent class method to handle parents' props?
Answer: method overloading and explicit call to parents' methods.
Original project docs contain three articles on super
that are relevant parents methods calling.
Up |
This issue has been automatically marked as stale because there were no activity during last 14 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. А. Чому так? Б. Що робити, якщо в піарі нема оновлень, оскільки не зрозуміло, що треба зробити? В. А якщо я все зробив(ла) і це ментор не рев'юває мої зміни?
Г. Хіба недостатньо того, що я додав(ла) коміт із змінами? Традиційна пропозиція: задай питання по вищенаписаному в студентському чаті. |
This issue has been automatically marked as stale because there were no activity during last 14 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. А. Чому так? Б. Що робити, якщо в піарі нема оновлень, оскільки не зрозуміло, що треба зробити? В. А якщо я все зробив(ла) і це ментор не рев'юває мої зміни?
Г. Хіба недостатньо того, що я додав(ла) коміт із змінами? Традиційна пропозиція: задай питання по вищенаписаному в студентському чаті. |
OOP Exercise
Demo |
Code base
The code is submitted in a dedicated feature branch.
Only code files are submitted.
Please, review.