7 ms·
Personally, I can't stand XXX as a comment prefix. It is semantically null as far as I am concerned. Just looking through the comments here shows several differ
by eddieh 10y ago
Personally, I can't stand XXX as a comment prefix. It is semantically null as far as I am concerned. Just looking through the comments here shows several different possible meanings: FIXME, HACK, TODO. But I've seen it alongside all of FIXME, HACK, NOTE, TODO, BUG, ATTN, as a complete separate and distinct type of comment prefix.
Is it an actionable indicator or a explanatory indicator? What is its relative priority or importance among the others?
At least with all the other prefixes I listed it is dead clear what is actionable and what is explanatory. Better still there is an obvious priority albeit slightly ambiguous. Is TODO a higher priority than FIXME? But that can be addressed in a section of the README if necessary.
The other problem is allowing XXX in the code base allows for a catchall cop-out. Instead of giving the comment some semantic meaning just use XXX and let somebody else figure it out. That somebody could even be you in a few years. In one particular code base that had a few other prefixes the XXX were by far the dominate prefix, presumable because of a catchall cop-out slippery slope.
In any case, I think XXX should be dropped in favor of prefixes with some semantic meaning.
- eriknstr 10y agoI use XXX to mean note/attention. I do so because "NOTE" on it's own does not "scream loudly enough" to me when I read it, and as for "ATTN" I associate that with the writing on a letter when you want to send it to a specific person in an organization. Here are a couple of examples from my own code: https://github.com/eriknstr/TEMPer2-getdegs/blob/cfde4306623dd79606bd983251b8e8cbace9c316/getdegs.c#L223 https://github.com/eriknstr/TEMPer2-getdegs/blob/cfde4306623... // XXX: Feels a bit stupid to check user_set_iterations each iteration. https://github.com/eriknstr/klondike/blob/d33accd6965d8d2476ed06601f7a7e4dc97e56b8/src/client/html/klondike.js#L277 https://github.com/eriknstr/klondike/blob/d33accd6965d8d2476... // XXX: https://bugs.chromium.org/p/chromium/issues/detail?id=615638 https://github.com/eriknstr/interweb/blob/6c2985f8d8a9d63d084d8a3688151ddbe20a22b9/tools/cfipaddr.bash#L51 https://github.com/eriknstr/interweb/blob/6c2985f8d8a9d63d08... # # Domain and records to update with the current WAN address of the router # # XXX: First record must expose origin server's IP address. # This is by design because I need to be able to # log onto my machine remotely using SSH # so having a DNS name for the IP of the host # makes more sense than not having it. # # If this is not acceptable to you, then this script # is not suitable for your use-case. #
- thrilleratplay 10y agoI do the same with XXX. There is no sense of urgency but still acts as a placeholder that stands out. I use it to record a thought: // XXX: There must be a cleaner way to implement this or call on someone (most likely myself) to replace with a NOTE clarifying why an out of place snippet of code is needed or verify it came be removed completely // XXX: Is this check still relevant?
- Apocryphon 10y agoMaybe YYY as in, "Why, why, why did you implement it in this way?!"
- paulddraper 10y agoFaces stiff competition from the more standard WTF
- Florin_Andrei 10y agoYOY is sometimes appropriate.
- eddieh 10y agoYOLO for "I have no idea how or why this works (it might not even work for all cases)"
- Apocryphon 10y agoThat's more for a Do Not Fix label: http://catb.org/jargon/html/magic-story.html http://catb.org/jargon/html/magic-story.html
- pnathan 10y agoFIXME and TODO are my preferred greppable comment prefixes. One denotes a problem, one denotes a lacuna. And I'd agree: XXX deserves to be dropped due to lack of semantics.
- MrTonyD 10y agoMost of my comments while I'm developing aren't FIXMEs or TODOs - sometimes just state, sometimes just tracing, ... Trying to figure out semantics for all those scenarios seems like a waste of brain cells - I'll stick to XXX since it is both grep-able and easy to see. I'm a big believer in Developer autonomy - so I hope everybody can do whatever works for them.
- Shish2k 10y agoI use XXX as a temporary thing to grep for in my working copy of the code, representing a note to myself while I'm working on a feature; explicitly distinct from TODO / FIXME which I might commit to the repository with a more coherent comment for other people to read
- stable-point 10y agoI do the same, as do others on my team. If we see an XXX in code-review, then we know someone commited something they didn't mean to.
- mirekrusin 10y agoIMHO it didn't mean anything, just like when you're logging to console a lot and you want to quickly mark/separate something quickly, you're maybe adding bunch of '======', similarly XXX is just a quick mark to go back - so it's easy to find it - and sort something out there. I think it was used more in days when we didn't have meta-comments - comments that ide is smart about now (FIXME is highlighted, indexed etc). Novadays I'd use it in the code that really needs to be fixed because it smells. I wouldn't get offended when team member would say - don't use XXX, use FIXME or TODO only - because XXX'es shouldn't leak to commits anyway. That's my opinion/gut feeling.
- iamacynic 10y agothe point is that it's all of the above, and when doing housekeeping, can be referenced in a single grep/search. it condenses the efficiency of action. always be lazy.
- warbiscuit 10y agoAt my company we tend to use "NOTE:" just to be aware of something, "XXX:" when something's functional, but has room for improvement, "TODO:" when functionality's missing, and "FIXME:" when it's plain broken. In that context the XXX's are kinda nice to have... we can mark there's something to work on; but only search for TODO/FIXME when looking for things that will actually impact currently needed operations.
- manicdee 10y agoSymbolic tags grep -r '\bXXX\b' corporate_code_base Versus semantic tags grep -r '\b(FIXME|TODO|NOTE)\b' corporate_code_base And that is before you discover two new semantic tags in a single bug fixing dive. Premature categorisation is a fundamental error, which will have repercussions down the track.
- emmelaich 10y agoIs \b a new thing to grep? I think you'll need egrep anyway for the alternation pipe symbol. And I'm surprised \b works too. Rather than \b you can just use -w (whole word option). If those fail, then traditionally grep used \< and \> to mark beginning and end of word respectively.
- Sunset 10y agoClearly, we need to use header files to define our semantic comments as types with inheritance.
- mst 10y agoInterestingly, I've seen XXX used as the attention marker before a semantic prefix (and on its own when there isn't really one), i.e. as a sort of 'NB:' - so # XXX FIXME - blows up if $x is negative # XXX HACK - don't even ask etc. etc. and then XXX on its own to mean "if you're skimming this code you really should read this comment but it doesn't fit a specific semantic category very well"
- foobarian 10y agoI use it as a bookmark. It's a lot easier to type than FIXME or HACK. Like when I have to jump to the top to copy paste a block of code; type 'XXX' at current spot, jump elsewhere and do whatever, then Ctrl-S and 'XXX'. I'm sure someone will point out that there are proper bookmarking commands in their favorite environment but I like not having to remember those, and this works in pretty much any editor/IDE.
- wahern 10y agoIn any case, I think XXX should be dropped in favor of prefixes with some semantic meaning. I use XXX when there's no obvious tag. Some things require attention or consideration at some indeterminate point in the future, but aren't bugs or hacks, and might not necessarily even need to be changed. They're just... a big fat question mark that you or somebody else might want to circle back around to. Every programmer knows that naming things can be a tremendous tarpit. The only thing more tedious than choosing the best name for something is choosing a subtly misleading name which subsequently leads you or someone else on a wild good chase or possibly to fixing things (and accidentally breaking things) that never really needed to be fixed as long as the situation didn't change. XXX is just the right convention precisely because it's so nebulous. NOTE doesn't work because something marked XXX isn't just locally descriptive, it's also a global marker that deserves to standout. WARNING doesn't work because that signals danger and hints that you may have done something suspect. But XXX doesn't necessarily mean code is suspect, it can be that it _might_ be suspect or that it _might_ be unnecessarily complex. ATTN is maybe the closest fit, but 1) isn't sufficiently loud and 2) lost out to XXX anyhow as a convention. IME XXX is usually either 1) something that deserves reconsideration, and here's why ..., or 2) I'm too busy writing correct code to worry about the best description here, but here's a marker and possibly a sketch of a description for your future benefit. Other than NOTE, I use XXX far more often than BUG or TODO. Committing a BUG comment is, I think, just poor discipline. If you know there's a bug, fix it or disable it.[1] I rarely use TODO inside code, but rather usually only in header files. That is, I use TODO to mark planned extension points. Inside implementation code I personally find TODO to be not much better than BUG, though reasonable people can certainly disagree on that point. [1] I understand that sometimes neither fixing nor disabling is a realistic short-term option, especially in the corporate world. That doesn't make it any more excusable, though, especially if its your bug. And if you can actually get the BUG comment committed upstream one must wonder exactly how difficult it would have been to get an actual fix or mitigation upstream.
- Buge 10y agoInstead of XXX I just write YOLO. I've only done that a couple times.