7 kyu
Factory Functions #2 - Inheritance and Object Composition
380 of 382donaldsebleung
Loading description...
Fundamentals
Tutorials
Object-oriented Programming
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
CoffeeScript translatiuon :coffee:
Approved
That will always be false -- randomToken generates a string and is never 50 characters. I think you meant
Test.randomNumber() > 50
?Good catch, fixed ;-) That is why dynamically typed languages should go to the bin ...
Works well.
A couple of changes I'd suggest to the description:
There was no mention of the need for "inheritance" in the description. You describe how such inheritance would work, but you should say the construction worker object should inherit from
person
to make sure they get the point."My boss is called BOSS_NAME and is a very nice person!" --BOSS_NAME is a tad confusing. People can figure it out, but it could be clearer.
Since you worded it that way, perhaps you should've raised this as a "Suggestion" instead of an "Issue". An "Issue" suggests that there is something that requires fixing in order for the Kata to be completable or of acceptable quality.
I've updated the Description to state explicitly that the
constructionWorker
function should "inherit" from theperson
function as demonstrated in the Overview; hope this clarifies the Task.I assumed that the average solver would immediately recognise
BOSS_NAME
as a placeholder and not a literal part of the string but anyway, I updated the Description to make it even more explicit and eliminate any possible source of ambiguity.Thanks for your input though, constructive feedback is always welcome :D
Yeah, that's fair. I wasn't sure what category to put it in... I've been going through your in-Beta katas, trying them out, and seeing if anything could be added for completeness or if I could just approve them. That's why I chose "issue," as it was the only thing stopping me from approving it.
But yeah, either way... ;P
This comment has been hidden.
Shouldn't the
person
class use a capital P?Yes, except if you read the description properly you would realize that
person
is just an ordinary object-returning function, not a class.The whole point of this Kata series is to instantiate objects without classes.
in the example
Animal
has a capital A...? and I don't see a difference between theAnimal
function in the example and theperson
function we use here...I see, well spotted :) It doesn't really matter, it's just convention.
Since
person
is just an ordinary function, I thought I would stick tolowerCamelCase
(the default convention in Javascript).I think it's more best practice but I'm not 100% sure... it shouldn't matter too much I guess
actually I would refer to the codex for best practices. codex