A few days ago I wrote about Artur Malabarba's comment-line. That's now in Emacs core and very useful. Xah Lee has an excellent post that compares comment-line and comment-dwim. That's useful because the commands are very similar and it's nice to have an exposition of how they differ.
Lee also offers a bit of Elisp that merges the two commands so that the resulting command will do what you probably want based on the context. You may or may not want to add his code to your configuration but his comparison is worth reading even if you don't.