4 Comments

I prefer to add comments when I have to include the "WHY" this was done the way it is.

For example, we had a case where we couldn't migrate to the latest version of MySQL. Because of that, we had to do a tweak in the code, so then I added a comment and a link to the documentation describing why we had to do it that way.

Expand full comment

Thanks for sharing your experience, Petar!

Expand full comment

Recently renamed my regex to be meaningful and that was super cool 😎

For example:

```js

let startsWithBAndHasTwoDigitsCommaSeparated = new RegExp(/^B\d{2}(,B\d{2})*$/gm);

```

Expand full comment

I definitely agree that comments should focus on the WHY instead of the WHAT or HOW. I keep reminding developers that code is read more often than it is written so it should be optimized with that in mind...especially during outage scenarios. The last thing you want to do during an incident is question why something was done a certain way.

Expand full comment