-
-
Notifications
You must be signed in to change notification settings - Fork 162
Conversation
I did see a comment from you last night asking how to move forward on this PR, and I think I had not explained myself clearly. At the risk of repeating myself and boring you, here is what I was trying to say:
The process of adding a new exercise normally involves specifying:
If we can get permission on the first point, then it would make sense to open a PR in the problem-specifications repo to add the exercise generally to exercism. Then we can accept a PR to add it specifically to this language. Does that make sense? Please let me know if I'm being unclear in any way. |
@matthewmorgan this is a common interview question, alittle more difficult than hello world and has many solutions on the internet. I just googled a random solution but if you feel like we need to confirm it with that specific author, I can try reaching out to her for her permission or I can just find another article and author that may be easier to reach. I also have those files you mentioned, I tried to submit it to this PR but was advised that I don't need them at the moment. |
@eliaahadi I understand that it's a common question, I agree with that. I feel like I'm doing an ineffective job of communicating why we can't move forward on this PR yet, so let me try again: A. You cite the specific article from an author on Medium in the README. Does your PR contain original work from someone other than yourself that you haven't cited? If it does, you need to remove that, or get permission from the author. If, on the other hand, all you are doing is mentioning that she wrote an article that gave you an idea, and that you're not actually using her work, then everything is OK and it's fine to mention the article. B. Your contribution would be a completely new exercise that has never been implemented on exercism.io. Because of that, it will first need to be added to the problem-specifications repo. When that PR is approved and merged, we can then accept this PR for an implementation of the problem in this track. Please take the following steps:
We are happy to have your contribution, but this is our process. Is that clear, or is there anything else I can explain? |
Ok thanks for the information. For A, this PR doesn't contain any original work, the article I referred to just shows various ways to solve the problem. I'd think it's just fine to mention the article. For B, I did now create a new PR referred here at #960. It looks like that PR checks have already failed with error "The Travis CI build failed". I'm not quite sure how to debug. Thoughts? |
OK @eliaahadi I'm glad we're on the same page now! I am not a maintainer on the problem-specification repo, but I am happy to take a look and see if I can understand why the build is failing. |
@eliaahadi When I look at the build log at line 483, I see an error that is helpful. Apparently for the problem-specifications repo you need to call your Also, I noticed that your description file contains information about how to run tests etc that is specific to the JavaScript track. You don't want that in the generic I would suggest checking the contributor guide for instructions, and if you don't find the information clear, you should ask on that PR, so one of the maintainers can help. That's what I would do if I were making a PR there! |
It sounds like you've gotten things mostly straightened out. We have some documentation about adding brand new exercises: https://github.com/exercism/docs/blob/master/you-can-help/make-up-new-exercises.md In terms of including content from other locations, there's some discussion about this here: exercism/discussions#188 The TL;DR is that if there is an exercise that is commonly used, then we can implement our own description and implementations of it, and refer to the source as "common interview question" (or whatever). We can also cite a source of inspiration (e.g. for the 99 bottles of beer song problem we refer to Chris Pine's book, but could just as easily have referenced http://www.99-bottles-of-beer.net/). We cannot use other people's copyrighted material. If other people have written code that we include, it has to be released under a compatible license. I prefer to avoid that entirely, because I am not a lawyer, and it's very complicated. For some problems we make up a similar problem. E.g. instead of "fizzbuzz" we have "raindrops". They're not identical but they have similarities in structure. |
@eliaahadi I'm glad to see your contribution was merged in to the problem-specifications repo. Congratulations! Do you intend to implement this exercise here? Please let me know, otherwise we'll close this PR for now. |
I pushed a commit. Please review @matthewmorgan, thanks! |
Hi @eliaahadi glad you're moving ahead with this PR! I see that you have some build failures. They are all called out in the Travis build log: Config issue: Code issue: Linting: Linting: Would you please resolve those and I would be happy to review the code then. Let me know if you need assistance resolving any of the issues. |
@matthewmorgan I'm not quite sure how to check for the lines and edit exactly where they are from the latest commit. Thoughts? |
@eliaahadi I would start by having a look at the Travis log Near the bottom there is a section that show your tests failing, and explain why they are failing-- IE, Does that help? |
@matthewmorgan the latest failure says " Expected 'Ramen' to equal 'nemaR'.". I'm not sure how to test and fix this, thoughts? Thanks. |
What do you think that test result is telling you? Explain it to me in your own words. |
Subject using ReverseString function ('Ramen') as argument. The variable matches using the function subject which is from ReverseString. I'd expect subject function which reversing the string Ramen to match 'nemaR' from the "expect" line. Thoughts? I referred to this to write my tests. |
|
I'm not so familiar with writing tests which is why I referred to the anagram example. |
|
I'm glad to hear it passes the tests, but we're still not ready to call this PR finished. The basic problem is simple: you are doing the reversing of the string in your A function called You really do not need any other functions to make this work. Just fix that one. |
If I just fix the function ReverseString, it passes all tests. However, you previously mentioned to update the matches function to test if input string and revString are equal, return true, otherwise return false. If I change to boolean output, the tests fail since the reverse-string.spec.js matches test against actual values, not booleans. Thoughts?
|
@eliaahadi I think I should be more explicit about what needs to change about the PR for it to be ready to merge. My plan had been to help you refactor your solution, first by fixing your two functions, then by simplifying the solution, but I can see that I confused you, so sorry about that. What I was suggesting earlier is that you have two functions, each of which:
Let's try a different approach. This exercise can, and ultimately should, be simplified to one function: Right now, you have a Please write a
You will still need this line also: module.exports = ReverseString; Remove all of the other code in your example solution please. After that we will fix your tests. |
Ok I apologize again for not understanding this better. So just this function for the reverse-string.js?
|
@eliaahadi please, no need to apologize! We're all here to learn-- that's the point! That function does what it says, which is good. Now the tests will need to be updated to reflect this change in the API of the business class. Two things:
Let me know if you need further assistance. |
Ok, I'm not sure this is what you mean. So in reverse-string.spec.js for testing, it should be this below? I'm not sure if the actual variable or the input was passed correctly.
This is from reverse-string.js
|
Your example above compares the output of Do you expect the output of |
So input doesn't seem to do anything, it just is passed as argument. I'd just think to do the same reverse string test inside and then compare. Does this make sense below?
Thoughts? |
@eliaahadi I did not mean to imply that you should pass an input to the test method ( What I meant was: you are passing an input to Each test should follow a simple pattern that is easy to understand. For example: it('can reverse a cat', function() {
var expected = 'tac'; // the correct result is visible right in the test
var actual = ReverseString('cat'); // call your business function
expect(actual).toEqual(expected); // compare the two values
}); |
Yes:
Do you feel you understand how to finish the example code and the tests? If not, please ask whatever questions you have. |
I updated the reverse-string.spec.js with the new example.js that passes all the tests. Can you please review and let me know your thoughts @matthewmorgan? Thank you and happy holidays! |
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.
@eliaahadi excellent progress here! Happy Holidays to you as well.
I have two small comments that I would like you to address.
Also, it appears that you have some linting errors that are preventing your build from passing CI on Travis: some lines apparently have trailing spaces, which the linter does not allow.
Please make the changes I requested, and fix the linting errors, and this will be ready to merge!
See how much simpler and easier to understand your implementation is now? Well done.
var expected = ''; | ||
var actual = reverseString(''); | ||
expect(actual).toEqual(expected); | ||
}); |
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.
Please add a blank line between this it()
block and the next.
expect(actual).toEqual(expected); | ||
}); | ||
it('a word', function () { | ||
var expected = 'tac'; |
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.
For this test, the canonical data tests reversing robot
instead of cat
.
Please change this test to match the canonical one.
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.
One last change!
All tests but the first should be skipped by using xit
instead of it
.
As soon as this is done we'll merge the PR.
expect(actual).toEqual(expected); | ||
}); | ||
|
||
it('a word', function () { |
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.
All it()
blocks except the first one should be changed to xit()
. This allows the student to pass one test at a time.
Ok made the change you requested I think, please review again and thanks for all your help! |
Nice! Congratulations on a job well done. |
Great thanks! Will this show up on the exesrcism website or are there more steps I need to do? |
@eliaahadi I believe each track is deployed once per day by an automated process. Normally changes show up within 24 hours, but let me know if you don't see the change by this time tomorrow and I can check in to it. |
@eliaahadi I have not seen this deployed yet. I put in an issue to find out why. |
OK! Katrina deployed the site, and your contribution is live. Congratulations again. 🎉 |
Great thanks again Matt! It took awhile, but we got it done. Happy new year!
…On Sat, Dec 30, 2017 at 6:50 AM, Matthew Morgan ***@***.***> wrote:
OK! Katrina deployed the site, and your contribution is live.
Congratulations again. 🎉
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<exercism/javascript#417 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AJTL0QV-VU_hOdiY6O7Biq1Klusw4bRiks5tFSZ8gaJpZM4P2gqO>
.
|
I added new reverse string exercise, I'm happy to edit it.