Skip to content

Instantly share code, notes, and snippets.

@Jbern16
Created July 1, 2016 16:56
Show Gist options
  • Save Jbern16/60c679efce350e47d78c3a8c672123f9 to your computer and use it in GitHub Desktop.
Save Jbern16/60c679efce350e47d78c3a8c672123f9 to your computer and use it in GitHub Desktop.
### Leap
##Leap
My code: [here](https://github.com/Jbern16/exercism/blob/master/javascript/leap/leap.js)
* Responder #1 ([here](http://exercism.io/submissions/9b50b27c92fb45a2848639bbce4d95ae) - This user used a super a clean conditional statement and logic to solve this problem. He broke out what a leap is instead of nesting a conditional and and responding with a boolean directly. I think this approach was very good.
* Responder #2 ([here](http://exercism.io/submissions/5f87d2e1f50242c08904e065dea8dad5) - This user used a similar broken down condiional as I did, however with more conditions. Although morereadable it creates a longer conditional which I am not a fan of doing.
* Responder #3 ([here](http://exercism.io/submissions/aa2c5470f91441ac9c5af928ec58092d) - This user used one very long, one line conditonal. Although short, It is not readable and a little too clever. By breaking it down multiple lines its easier to reason about.
* Responder #4 ([here](http://exercism.io/submissions/976c55fd8fc5498d9dabecc7fbf89771) - This user had a very thought out conditonal using if statements only. From what I have been hearing, that may be a better way to create conditionals. I like this better than using an else if, I think.
* Responder #5 ([here](http://exercism.io/submissions/6f9551cfa7094742aa7c20aa5a36ffd1) - This user created the function inside the prototype itself, thus having access to year. I think by combining both the method and the protype is interesting, I am unsure if that is a proper way of constructing prototypes and its methods. I'd be interested in learning more about the best way to construct protype methods!
##Hamming
My code: [here](http://exercism.io/submissions/beef5fcf84d747258ae7fb8379a4638c)
* Responder #1 ([here](http://exercism.io/submissions/94c3600860cc4e17a12e12ba4db37820) - Our code looks very similar, however, this user used filte rinstead of a traditional for loop. The filter is a nice touch that drys up the code. I like that.
* Responder #2 ([here](http://exercism.io/submissions/f5bf411d356d416dbb3a09d0337ac11e) - This response is very much alike mine. He used a for loop instead of any built in prototype method. However, he did not split the strands and used the for loop with a string. This is cool!
* Responder #3 ([here](http://exercism.io/submissions/13b7cfe51e00427989d4bac67b57827d) - This response was very much like the one above. Again using the for loop over a string is a nice. I realize that my splitting is not necessarily, especially that I am not using something like filter or other array functions.
* Responder #4 ([here](http://exercism.io/submissions/f5e07d441d8e45a0b75c587244a51103) - This user took an a very similar approach to the others, a for loop and checking for length to throw error.
* Responder #5 ([here](http://exercism.io/submissions/4a5b638524d2441cba905e709468d24f) - This user, again, took the same approach by for looping over a string. Overall, I think this is the best way to do it for speed. However, the filter from the beginning is still a pretty cool implementation. I would like to see the performance differences of each!
##RNA Transcription
My code: [here](http://exercism.io/submissions/1ad2211baa2d445fb1845e05a48fbb74)
* Responder #1 ([here](http://exercism.io/submissions/3c53cc74291d4481ba40b6216c7f8be0) - This user utilized objects for their transscription. I like this approach instead of the condional I wrote by a long shot.
* Responder #2 ([here](http://exercism.io/submissions/cfe6a06e84df431c8000b890da24b06c) - This user used a for loop + case + switch statement. I have never seen this combo before, It does seem a bit overkill in relation to the object approach from the user above. But I will like to learn more about this and if it may be a good solution for performance.
* Responder #3 ([here](http://exercism.io/submissions/07ad40b22354451ebf0344e78ef6a247) - This user used a solution very similar to the one of the first, using objects. I think this is the best approach, combined with a performance enhancing for loop.
* Responder #4 ([here](http://exercism.io/submissions/898add2a546f46bca79b4980b7c40642) - Again this user used objects to solve the transcription. It definitely seems lik convention to use an object to do this. It would be interesting to see this used as function that generates the proper object.
* Responder #5 ([here](http://exercism.io/submissions/78c72e86bcf943f88c1e33feca3a399a) - On queue, this suer used the object as a function, which seems to me a very JS way to do it. I like the idea of everything being a function. I now see that my approach was definitely a bit simple and hard-coded. I like the idea of creating objects to facilitate association.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment