Ad
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Not that there's anything wrong with that answer, but I fail to see why it gets upvoted 7 times as best practice compared to others.
    I'd rather have this one (http://www.codewars.com/kata/reviews/53952000369894e4f10007ab/groups/539823dfc729da37a4000374) which is more readable (at least in JavaScript where there's a fair amount of syntactic noise. In other more expressive languages (e.g. a ML), even a one-liner would be acceptable and best practice.

    Anyways, just pointing out: while this is perfectly correct (and fine for a trivial exercise like this one), I'd rather not people consider it too "best practice" (same for http://www.codewars.com/kata/reviews/53952000369894e4f10007ab/groups/53952f8ca3ba5f5632000f95).

  • Custom User Avatar

    I second that as well. 6 kyu seems fair.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Think this could be improved or hardened in a number of ways:

    • supporting dashed words (e.g. 'Jean-Pierre')
    • supporting specially-cased words (e.g. 'iTunes') where casing has to be preserved (whereas in the current status, the minor words are expected to be lowercase)
    • supporting very long lists of minor words (if the array is excessively long, lookups might become painful and it doesn't scale for a solution where this would be meant to be seriously run on a large corpus with many exceptions).

    Last point it a bit too specific, but the first 2 could make it more difficult yet acceptable (and worthy of 4kyu, which I don't think it is at the moment, I'd rather rate it 5 or 6 in the current state).

  • Custom User Avatar

    I don't think this should be a 4kyu, or even a 5. Maybe a 6.

    Maybe it varies on what you background is, but to me that looks like a programming 101 exercise that we'd usually give to students as part of their exams after their first month. It's not entirely straightforward and there are many ways to approach it (but codewars doesn't rate that), but it's not really as difficult as what I'd rate a 4.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    5 kyu seems a bit high for that one. 6 kyu maybe?

  • Custom User Avatar

    I'd recommend changing the test cases to directly be:

    Test.assertEquals(hamming(1), 1);
    Test.assertEquals(hamming(2), 2);
    // ...and so forth
    

    It's self explanatory enough, and at least it gives me back the value returned by the hamming function. Doesn't happen with expect().

  • Custom User Avatar

    Yeah I'd agree this should be a general case question.

    This seems rather useless as a kata in the current stand, barely more than an intro to calc and programming. Or maybe I missed something...

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Actually, I also realized this doesn't support composite names, like "Jean-Pierre", where the P should be capitalized.

  • Custom User Avatar

    This is an intended feature. Knowing the tests would make you directly aware of some of the complexities you wouldn't have thought off otherwise.

    I can undertand your request, but I think the idea behind code katas and codewars is not to provide software specs so you comply to them, but to force you to write rather generic code that would hold against sneaky edge cases you might not have thought of.

    Of course the success of this approach is debatable, as I see some katas where people do just that: write something that complies to the test and that would be a dreadful piece of code to use in enterprise software.

    Maybe the issue lies more with the kata's description than with the tests. I think it's a judgment call, and it'd be hard for them to make it work both ways. It's just too bad that some katas try to have you guess while others try to enforce specs that sometime seem silly.

  • Loading more items...