Ad
  • Default User Avatar

    Well, that all comes down to what your priority is. To me, that is the same argument as "writing". Some people just sit down and "punch the keys" with no editing or holding back to just get it out, and will go back on pass 2 or 3 to start fixing things or refining; while others are "correcting spelling" and refining sentences as they go. In both writing and coding, the latter is a skillset; but there is a debate in both of the pro/con of it. For my self when it comes to both tasks: PASS 1 = just get it done, PASS 2 = clean up what is here, PASS 3 = where I will start to change and refine... PASS 4 to 6 is where I would get around to how clean can this be.

    For example, there was a math puzzle kata on here where my PASS1/2 worked just fine, but it was too inefficient and so it timed out on here. It was 50 lines and a 4 deep loop. Took a sec to do refine of the math of the loops to a var, and then it was one loop and 14 lines (and if I am honest that ver or the further refined 9 line ver of it is what I would put into production). But in "production" all 3 ver and the documentation of them would be on the GIT tree. So for here I only refine as far as the problem forces me to do to pass, and leave the code rawer.

    That would also be why the "terse, comments solutions seem to attract so many best practice votes" is for the skill of "refined". Like you said "Not the best algorithm..." where those harder to read and follow refined ones are often the "the best algorithm". If we are honest, more than one job interview is going to want the "nice how few lines" less is more ver :) But that is not what I am coding for here :P Like you said: "most valuable part, for me at least, is reading everyone else's solutions afterwards". And I love it when the top one is a refined ver of what I just did. Good luck to you to.

  • Custom User Avatar

    Well I'll take well commented code with good variable names over super efficient or clever code without them any day! Doing Kata is fun but the most valuable part, for me at least, is reading everyone else's solutions afterwards - I just wish they would make them more readable instead of trying to show off by using as few lines/chars as possible. I thought we'd left those days behind us. We don't have the memory constraints of yesteryear any more and JS is minified and zipped for production use anyway but many people still like to code like every byte of source costs them money. What's even stranger is how these terse, commentless solutions seem to attract so many best practice votes! Anyway, good on you and good luck in the future! :-)

  • Default User Avatar

    Thanks, I am getting there. And yes, I do not get the lack of "meaningful names" so you do not have "descriptive variable names". Kind of thought the point was to have it so someone else can follow your code and logic. At this point my main focuse is on solve the problem; but starting to also take the time to see if I can also make it more refined. That is a learning curve, but these Kata are good code practice IMO.

  • Custom User Avatar

    Not the best algorithm on here but props for using descriptive variable names and throwing in some comments. I'm flabbergasted at how many otherwise competent programmers seem determined to avoid meaningful names and commenting their code on here!