3 ms·
When you solve something in a weird way, leave a link to SO in a comment. Write TODO and NOTE and use a tool to find all your special comments that show unfini
by lordnacho 5y ago
When you solve something in a weird way, leave a link to SO in a comment.
Write TODO and NOTE and use a tool to find all your special comments that show unfinished features and investigations. Scan through regularly to make sure the comments still make sense.
Comments not containing special strings should just be "why" explanations, eg "we sort the bids in the reverse order to the asks because the best bid that the highest price". So generally something where the code has special cases that are explained by the domain.
- mgaunard 5y agoWithin the domain of electronic trading it should be obvious that prices are ordered from best to worst, and that it means increasing order for asks and decreasing order for bids. You shouldn't comment on things that are obvious within your domain. Now you may put a comment if instead you sort things in the reverse order than usual, for example so that you can implement adding/removing a price level at the top more efficiently with std::vector (which is only efficient fot additions/removals at the back).
- masklinn 5y ago> Now you may put a comment if instead you sort things in the reverse order than usual, for example so that you can implement adding/removing a price level at the top more efficiently with std::vector (which is only efficient fot additions/removals at the back). Though in that case you should probably have a comment explaining why you didn't use an std::deque.
- mgaunard 5y agoI'm not sure what such a comment would say? The advantages of vector over deque should be well known to any C++ programmer.
- lordnacho 5y agoIt's more that there's an asymmetry and sometimes that raises a question. You're right I could have picked a better example.