Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complete OOP Exercise #524

Merged
merged 4 commits into from
Sep 27, 2022
Merged

Complete OOP Exercise #524

merged 4 commits into from
Sep 27, 2022

Conversation

deveLabR
Copy link
Contributor

OOP exercise

Demo |
Code base

The code is submitted in a dedicated feature branch.

Only code files are submitted.

Please, review.

@github-actions
Copy link

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 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. 😒

Please, make sure that your code follows the requirements based on the most common mistakes as well as both basic and advanced requirements from the original task.

Universal recommendations:

  • Make sure your code follows General Requirements
  • Use common sense or seek for an advice whenever requirements look ambiguous or unclear.

By the way, you may proceed to the next task before this one is reviewed and merged.

Sincerely yours,
Submissions Kottachecker 😺

@deveLabR
Copy link
Contributor Author

Self-check done.

@OleksiyRudenko OleksiyRudenko added the self-check-done Student confirmed that self-checks against requirements/common-mistakes are done label Sep 20, 2022
Copy link
Member

@OleksiyRudenko OleksiyRudenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@deveLabR pretty good job!
Let's make it more OOP compliant.
Also let's improve naming skill.

class Animal extends Creature {
constructor(species, name, gender, saying, friends) {
super(species, name, gender, saying, friends);
this.leg = 4;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What makes leg so different from name or gender to handle leg property in a different way?

this.gender = gender;
this.saying = saying;
this.friends = friends;
this.args = ['species', 'name', 'gender', 'saying', 'friends'];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inhabitants are characterized rather by properties or features. No one says 'Name is my argorGender is my arg`

this.args = ['species', 'name', 'gender', 'saying', 'friends'];
}
personInfoItems() {
return this.args.map((key) => this[key]).join('; ');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

key is a generic, technical term.

Copy link
Member

@OleksiyRudenko OleksiyRudenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@deveLabR please revisit the requirements and education materials and make the code OOP-compliant.
Feel free asking questions here or in Students' chat.

this.name = name;
this.gender = gender;
this.leg = leg;
this.hands = hands;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the requirements:

Classes for species that do not have hands by natural design do not consequently have hands or any equivalent property

Subclasses inherit all properties from parent classes, which means they have it.

@deveLabR
Copy link
Contributor Author

Oops, I wanted it to be better, but it turned out as usual (( I'll fix it now

@OleksiyRudenko
Copy link
Member

Use method overloading and super API. super can do more than just call parent's constructor.

@deveLabR
Copy link
Contributor Author

I hope I understood correctly how to use overloading methods

Copy link
Member

@OleksiyRudenko OleksiyRudenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@deveLabR great job!

@OleksiyRudenko OleksiyRudenko merged commit 5c03c24 into kottans:main Sep 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
self-check-done Student confirmed that self-checks against requirements/common-mistakes are done task-TJSW-OOP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants