News for hackers. Stuff that matters.
Re:Ask HN: Do you ever go back and admire a piece of code yo... by pvorb on Friday May 08, 2020 @05:47PM (#23119873)
This sounds a lot like TDD, but with comments instead of tests. It's an interesting technique I never heard of.

Do you ever get back to code you wrote and find a lot of misleading comments that you simply forgot to delete/update? Or are you always updating the comments before you try a new approach if the first one didn't work out?

Re:Ask HN: Do you ever go back and admire a piece of code yo... by scarface74 on Friday May 08, 2020 @09:37PM (#23121398)
The pseudocode comments are way too detailed and too much noise to keep in the code. I’m not going to keep a comment in the code like.

   //increment i 
But also if the comment is something like:

  //Call the API to get a list of customers. 
I’m going to replace it with

  List<Customer> customers= GetCustomers(); 

Use the IDE to create a valid stub function and delete the comments. The method names become self documenting. At any point I have code that compiles.