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

Protein Translation: Implement problem in Java language stream. #985

Merged
merged 3 commits into from
Nov 9, 2017

Conversation

sjwarner-bp
Copy link
Contributor

After adding the canonical-data.json to problem-specifications here, I wanted to implement the problem in Java. I assume that the fact there was no canonical data was the only reason this problem is yet to be implemented.

Please bear in mind that the canonical-data.json has not yet been merged, though it is approved. Hopefully this should not impact this PR.


Reviewer Resources:

Track Policies

Copy link
Contributor

@FridaTveit FridaTveit left a comment

Choose a reason for hiding this comment

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

This is looking really good :)

There are a couple of important things you need to do:

  1. Add an entry for this exercise to settings.gradle. See the contributing guide for a list of things that need doing when adding a new exercise, which includes adding an entry to settings.gradle :)

  2. Add starter implementation instead of a .keep file. The current policy for adding starter implementation is that any of the first 20 exercises on the track should have it. See our POLICIES doc for a description of this policy. We're about to change this so that any exercise with a difficulty of 4 or lower should have starter implementation. But either way this exercise should have starter implementation :)

In general it's a good idea to consult those two documents before implementing an exercise :)

Also, it would be great if you could suggest a core exercise which could unlock this exercise. Generally this should be any core exercise that uses topics similar to the ones used in this exercise. You don't have to do that, but it would be useful if you fancied it :)

And just for next time, it might be useful to wait until the canonical data PR has been merged. That way we could add a version file and make sure the tests stayed up to date with the canonical data. But like you said, it's not essential :)

Overall this looks really good, thanks for taking the time to do it! :)

@Test
public void testMethionineRnaSequence() {
List<String> expected = Arrays.asList("Methionine");
assertEquals( expected , proteinTranslator.translate("AUG"));
Copy link
Contributor

Choose a reason for hiding this comment

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

There shouldn't be any whitespace before and after expected :)

import java.util.Arrays;
import java.util.List;

public class ProteinTranslator {
Copy link
Contributor

Choose a reason for hiding this comment

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

This could be package private :)

@sjwarner-bp
Copy link
Contributor Author

That's great! I'm not sure why I blanked on the Contributing.md and the POLICIES.md - I do normally check them out 😱 - I'll get on those changes soon, thank you for reviewing!

Copy link
Contributor

@FridaTveit FridaTveit left a comment

Choose a reason for hiding this comment

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

Thanks for making those changes so quickly @sjwarner-bp! :) I've left a couple of comments about some minor issues but apart from that it looks ready to merge! :D


class ProteinTranslator {

List<String> translate (String rnaSequence) {
Copy link
Contributor

Choose a reason for hiding this comment

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

There shouldn't be a space after translate :)

private static final String[] TRYPTOPHAN = {"UGG"};
private static final String[] STOP = {"UAA", "UAG", "UGA"};

List<String> translate (String rnaSequence) {
Copy link
Contributor

Choose a reason for hiding this comment

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

There shouldn't be a space after translate :)


List<String> translate (String rnaSequence) {

List proteinList = new ArrayList();
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be List<String> proteinList = new ArrayList<String>(). Otherwise you're using a list of generic Objects which isn't typesafe. Does that make sense? :)

@sjwarner-bp
Copy link
Contributor Author

Oops! Spaces are always a silly thing for me, especially without using linters! The typesafety thing makes sense too - I was reading about it not too long ago 🙂

Copy link
Contributor

@FridaTveit FridaTveit left a comment

Choose a reason for hiding this comment

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

This looks great @sjwarner-bp! Thanks for implementing this! :)

And especially thanks for responding to comments so promtly and being so willing to take on board changes. That makes it a pleasure to review your code! :)

@FridaTveit
Copy link
Contributor

Not sure why the build failed. I've restarted it. Sometimes it just fails for no reason and then runs fine when we restart it so we'll see :P

@FridaTveit
Copy link
Contributor

The build is fine now so it doesn't look like it was because of anything you did :)

@FridaTveit FridaTveit merged commit 74ee985 into exercism:master Nov 9, 2017
@sjwarner-bp
Copy link
Contributor Author

Perfect, thank you 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants