4 ms·
I’m a fan of comments, but in this case I would reach for an enum with descriptively-named members, e.g. HTTPStatus.TOO_MANY_REQUESTS
by andreareina 4y ago
I’m a fan of comments, but in this case I would reach for an enum with descriptively-named members, e.g. HTTPStatus.TOO_MANY_REQUESTS
- helmholtz 4y agoMaking it strictly worse. TOO_MANY_REQUESTS? How many is too much? In what scenarios? The code comment in the GP is pithy, explanatory, and reads in plain English. Yours is ripe for misunderstanding.
- andreareina 4y agoMy bad for not being clear, I was really talking about the comment saying 429 means “too many requests”. By all means comment to say that service X has a rate limit of N req/min but a comment saying 429 means too many requests is exactly one of those things that’s better expressed in an enum. 301; 302; 401; 429; 504; I shouldn’t need comments to tell me what they are, nor should it be expected that anyone touching the code knows them off the top of their head.