3 ms·
Comments should explain the why of code, not the what or how. From a technical standpoint you should read uncommented code and more often than not be able to t
by pc86 10y ago
Comments should explain the why of code, not the what or how.
From a technical standpoint you should read uncommented code and more often than not be able to tell exactly what it does (barring a lot of poorly named methods or similar architectural issues). Any comments should simply explain the business rules or decisions that led to that code. Maybe you are knowingly violating a best practice for your framework or language because following it would break business logic down the pipeline or something. This is the perfect time for a comment explaining that so a well-meaning junior developer doesn't refactor it six months from now.