Comment

Comment by sundvor

Very interesting article, thanks for writing! I have but one, eh, comment:

> Your code should be commented

Sure.. but:

  > * @param {string} stringToTest - the string to test.

  >   // make sure we have a string.
  >    if (typeof stringToTest !== "string") {
  >

  > function isPalindrome(stringToTest) {
  >  ...
  >    // if we get here, it's a palindrome
  >    return true;
Do we really need to explain that stringToTest means string to test? I for one find such low level comments almost completely redundant. I prefer strong variable naming and other ways of creating clean code to littering the code with comments that the code expresses naturally.

Comments should IMHO be reserved for explaining special complexities, any particular gotchyas, etc.

parent sundvor 10 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton