Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'd like to see more work like this. There are 1001 opinions on code style, but I've seen very little effort to objectively validate which pieces of common advice result in fewer defects.


> I'd like to see more work like this.

Me too, but not so much with subjects that have just a couple of months experience with the language.

I'd prefer to identify things that still confuse programmers with, say, five years.

Things that confuse noobs contain a lot of noise. If we craft a coding convention based on that, we might end up with:

  i = 1;
  total = 0;
  while (i <= 100) {
    total = total + a[i - 1];
    i = i + 1;
  }
because the noobs were confused by zero-based arrays; increment operators like i++; and the jumpy, out-of-order evaluation of for(;;) syntax.


I can recommend Code Complete by Steve McConnell. One of the primary aspects of this book that makes stand above other best-practices books is how much of it is sourced from software engineering research, although not the entirety. If nothing else, the bibliography is full of articles similar to the OP.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: