Skip to content

Instantly share code, notes, and snippets.

@sekharp
Last active February 26, 2016 17:32
Show Gist options
  • Save sekharp/d6a4d5c86330fef3c2e3 to your computer and use it in GitHub Desktop.
Save sekharp/d6a4d5c86330fef3c2e3 to your computer and use it in GitHub Desktop.
Initial JavaScript Exercism Comparisons Homework - Mod 4 at Turing

##Leap My code: here

  • Responder #1 (here) - A very similar one line solution to mine.
  • Responder #2 (here) - Same story here.
  • Responder #3 (here) - This solution did not define the function on a prototype, which is a best practice. Will need to be called much more often when used is my understanding.
  • Responder #4 (here) - Could have had the conditionals bunched into two branches, rather than three, using the && to combine two true statements.
  • Responder #5 (here) - Verbose solution that similarly could’ve simplified the conditional.

##Hamming My code: here

  • Responder #1 (here) - This person effectively did what I did, but their variable names are not super clear - they should be more descriptive.
  • Responder #2 (here) - This solution was also very similar to mine.
  • Responder #3 (here) - This solution is similar, but the name “distance” for a variable was very unusual, and threw me off. It’s about differences, not distance, and it’s a variable symbolizing a count. It made me think there was some complicated logic to measure the distance between two variables, which wasn’t the case.
  • Responder #4 (here) - Could have more descriptive variable names. Also one of the commenters on this solution said strings can have their characters accessed just like arrays, so apparently there’s no need to split them in any of these solutions.
  • Responder #5 (here) - Another very similar solution with the variable name distance for the counter.

##RNA Transcription My code: here

  • Responder #1 (here) - This person had a great setup for the complementary RNA nucleotides as a hash, that was cleaner than my individual swapping.
  • Responder #2 (here) - This looks like a very clean solution where there are much fewer lines than me and the prior solution’s. Also uses a hash-map of sorts.
  • Responder #3 (here) - I like that this solution uses the replace method, which I had not seen before. Also it had everything built for case insensitivity which I was not thinking of.
  • Responder #4 (here) - This solution is verbose, similar to mine, but written a bit differently. Could definitely be refactored.
  • Responder #5 (here) - Again, this solution uses a hash map, but the way it iterates over the strand is basically the same as my for loop. I would likely refactor like this if given a choice between these five solutions.
@rrgayhart
Copy link

'This person effectively did what I did, but their variable names are not super clear - they should be more descriptive' totally made me think of flight of the concords...

Good work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment