Skip to content

Instantly share code, notes, and snippets.

@tjkomor
Last active March 15, 2016 03:01
Show Gist options
  • Save tjkomor/cff6b688b7b221fed65f to your computer and use it in GitHub Desktop.
Save tjkomor/cff6b688b7b221fed65f to your computer and use it in GitHub Desktop.
Exercism Assignment

##Leap

[My Code] (http://exercism.io/submissions/677bd182e84049e99a3dc4304c942e35)

[This piece of code] (http://exercism.io/submissions/6c63567f274a40869962fbd18a36a489) has one extra step. Rather than using and if, elsif, and else, this person could have used the OR operator and done away with the elsif statement

The reason I don't like [this code] (http://exercism.io/submissions/fe0fc4abe39846588e28fc5a132f6552) is because it is a bit unclear what is going on. First off, they are using constructors, which can be unclear to you avergae programmer. Secondly, the giant line of code in the isLeap function could have been broken up a bit, ultimately, making it easier to understand.

[This] (http://exercism.io/submissions/b3f999b732fd4043bc8722ecb3086708) is a really cool, yet simple, solution to this problem. If the first two conditions are met, true will be returned. If the second condition is met, True will also be returned. In any other case, false will be returned, thus meeting the criteria of finding out if the given year is a leap year.

[Here] (http://exercism.io/submissions/8729ea0529df4e0aabbe0fbc05ebf031) is an elegant, yet over-complicated way to solve this problem. In this case, this person took alot of extra steps like creating three extra variables, only to use a ternary at the end of the problem. While it is a thoughtful solution, it would be much cleaner and easier to understand if this person took a straightforward approach.

[This] (http://exercism.io/submissions/844c41e9c4c346bd82175e572ad29929) is a great place to use the OR operator!

##Hamming

[My Code] (http://exercism.io/submissions/d6ec7db3a11e426a9f1eef67375a9530)

[This] (http://exercism.io/submissions/4b7cb7e7c07c4769a3fb8996133fe550) is a very similar solution to mine. However, it is a bit difficult to understand because all of the variable are just letters, making it tough to read. This would be much cleaner and easier to understand if the person had said var sequence1 instead of var a.

[This code] (http://exercism.io/submissions/2dd065a92ba24e70892592c4745ba2ae) would probably be better off if they had broken the for loop out into its own function. There seems to be alot going on within the compute function and doesn't follow the general SRP school of thought

I like that this person found a chance to use reduce in [their code] (http://exercism.io/submissions/3c4540d93b2c40828a71d40c0208d606). However, I think in this particular case, it does actually make the code a bit more confusing and harder to read.

[Here] (http://exercism.io/submissions/6bb1a80dfd32471bbd559854094b944b) is another great place to break out some code into seperate functions. It would be good if this person had taken the counter and moved it into another function of it's own in order to demonstrate SRP.

[This is gold standard in SRP] (http://exercism.io/submissions/3e0c05e308ed493c9325a11b7bebf01c). Young Jhun straight up killed it. Everything in this code is doing ONE SINGLE THING. This is exceptionally well factored code, and given my implementation, I no longer have a right to comment on SRP.

##RNA Transcription

[My Code] (http://exercism.io/submissions/8e6faf5bbd614d84ac190fffb9aee616)

[This] (http://exercism.io/submissions/b9afe8ce27164e57a781c4700dc6968a) is a really clean implementation. It is extremely simple, and easy to read. He uses one less variable than I do, which I am now realizing I didn't actually need. Bravo.

[Whoa] (http://exercism.io/submissions/80464d75b4f848a88077c6bdaaa1a589)! Exporting functions?!?! I'm not even sure what to say about this. Is this good? Is this bad? Either way, my mind is blown. However, I'm going to have to say that it would have been a better idea to break this function out, and then export the entire module. I feel like there is too much going on and it makes it a bit confusing.

[This] (http://exercism.io/submissions/90065e972db94b4b8bbc589a856d9ac3) is a solution where there is too much going on in one function. I think it would have been a better idea to pull the if/else out into its own function, and then return the letter you need based on the constraints you're looking for. So rather than appending to the string, just return the letter you need and then append the result of said function onto your empty string.

[This] (http://exercism.io/submissions/0f7aa392ef4240d28f98cf1390c5f88e) violagtes SRP a bit, but it is still very clean. The only thing I would have done differently is break the joining of the string out into its own function.

[I'm really not sure what to say about this.] (http://exercism.io/submissions/94d24f66490a4c788f70c5ff2d3dedf8) Really? I really just don't understand the point of writing a solution this way. I will say that it is a well thought out solution, but a well thought out solution isn't always a good solution. To your avergage programmer, this code is a bit overwhelming. There is alot going on here, all in one function, so it is safe to say SRP has been violated. Not to mention, the logic itself is a bit hard to follow. As we have seen, there are much simpler solutions to this problem that are pretty easy to understand.

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