DEV Community


Posted on

Why delete my comment?

Once I wrote something and it worked well in Chrome and Firefox, but Internet Explorer had some behavior that made it not work well, so I tweaked it, and add the comment there, saying it is done this way or else it won't work well in IE.

So my coworker saw the code, and out right removed every single word of the comment.

If I ask her why she removed it, she'd answer something like, "it is no use". And if I say, "it needs to say why we do it this way but not the more obvious way." And she'd say something like "we write code, not comment". Together, she would throw in some tone, some attitude, and some temper.

I really don't understand why useful comments would be removed. So another programmer can see my code, spend 20 minutes refactoring my code, and then commit it, and now it is 20 minutes wasted, to introduce a bug back into IE.

Top comments (3)

sunflower profile image
sunflowerseed • Edited

First of all, it was CSS and HTML adjustments for IE, and I don't want to make a special ie.css to "override the CSS" so that if Chrome / Firefox, then it is one way, and if IE, then another way. So I just want to make a solution that works in all browsers. So how do I make the CSS and HTML have "IE names"?

Second, the way you wrote, it is "catering for browser", and it is not recommended usually. We should just use feature detection. The kind of code hackAroundForIE_WontWorkWithoutIt is kind of ugly and pretty soon the code could be hackAroundForSafari_WontWorkWithoutIt and hackAroundForOpera_WontWorkWithoutIt and it is a mess.

Third, even if she tweaks my code, go ahead convey the idea that the method was to adjust to all browsers including IE. It wouldn't be good to simply delete the comment without doing anything at all. Other programmers can come in and "refactor" it back to the simpler way that has problems for IE without knowing it.

sunflower profile image

how do you write code that, without comment, can communicate a simpler method doesn't work well in IE?

sunflower profile image

But why does it seem like you are defending her?
And then you come back in to be righteous.

Some comments may only be visible to logged-in visitors. Sign in to view all comments.