comments

How do you style major and minor comments?

Sometimes I want to write a "major" comment to describe a large block of code and then write "minor" comments to describe a few of the lines within that block of code: // Major comment // Minor comment ... // Minor comment 2 ... The major comment looks strange without code directly beneath it, and you can't visually tell how much co...

What was the scary code comment about dragons?

The phrase was used as a warning that the code was pulling some serious stunts. My google search for this is pulling up nadda; but I remember someone doing a search of google source for the phrase quite a while back. in lies dragons? dragons sleep here... Bah... ...

In textmate, how do I make javadoc style comments like I can in eclipse?

In eclipse, when I want to document a function (in java or javascript source) I can just type /**, then hit enter, and I get a comment like this /** * * Fluctuates all variables to more compatibly foo all the bars * * @PARAM {int} foo */ function flucvar (foo) { } When hitting enter inside the comment, eclipse automatically...

Commenting try catch statements

What is the proper place to explain error handling in a try-catch statement? It seems like you could put explanatory comments at either the beginning of the try block or the catch block. // Possible comment location 1 try { // real code } // Possible comment location 2 catch { // Possible comment location 3 // Error h...

RDoc CONSTANT comments?

In RDoc, is there any way to show constant comments? I would like to comment a constant in a project of mine but and realizing that they dont show up in the RDoc output. I checked documentation which is likely to have comments for their constants, but never saw any (http://www.ruby-doc.org/core/classes/Math.html). It's possible that the...

What is the worst comment you have ever read in code, and why, and what should have been written?

I'm hoping that we can all educate each other from our experiences of being misled by comments, or just emotionally scarred by them :) By the way, I know someone already asked what is the best comment you've ever written, but I think we're likely to get more helpful (or at least, different) content here. this wasn't mentioned as alre...

Showing generic class eg Table<String> in xml comments in visual studio.

I know this maybe a basic question but I just can't seem to find the answer anywhere. I have a class like this Table<T> {} then I have some code that uses the above class that I would like to comment I would like to be able to do something like: /// <summary> /// blah blah blah Table<String> /// </summary> But I can't use the angl...

Should identifiers and comments be always in English or in the native language of the application and developers?

Duplicate: Do you use another language instead of english Related: Coding in other (spoken) languages Given a programming language (such as Java) that allows you to use non-ASCII identifiers (class, method, variable names), and an application written for non-English users, by developers who speak English only as a foreign language at v...

Are nested HTML comments possible?

Hello, as per the title; is it possible to have nested comments in valid HTML? see the example below... <p>some text</p> <!-- comment 1 <p>commented out html</p> <!-- comment 2 // are nested html comment allowed? end of comment 2 --> <p>more commented out html</p> end of comment 1 --> <p>some more text<...

What is the best way to add summary tags to a generated webservice proxy class?

Aloha I'm referencing an external webservice in my .NET 2.0 application. Adding a service reference generated a nice proxy class for me. I'd like to add ///<summary> style documentation to this. If the service reference is updated, all my shiny comments are gone. Is there any solution to this? -Edoode ...

Importance of commenting your code

How do you explain your team mates the importance of commenting the code they write? I know some coders who write episodic comments while others leave a lot to be expected, what do you expect when you read comments? ...

Insert Comment Reply Form Into Page Using Jquery

I have been making a threaded comment system as a way to learn php and javascript/jquery properly. Ive done bits and bobs in the past but ive made a new years resolution to learn it properly. Im having trouble inserting a reply form into the comment tree below the comment being replied to. I know this is probably pretty basic but how do...

Improving/Fixing a Regex for C style block comments

I'm writing (in C#) a simple parser to process a scripting language that looks a lot like classic C. On one script file I have, the regular expression that I'm using to recognize /* block comments */ is going into some kind of infinite loop, taking 100% CPU for ages. The Regex I'm using is this: /\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*...

Would rich-text help comment code?

I always wondered why I have to write rich-text code comments a.k.a. pseudo code in a text editor (c'mon, bold, underline!) and come back to the IDE (integrated?) to write the actual program, not to mention ensuring these documents stay near the code. So the question is, What if IDEs allowed rich-text code comments. Would it help anyone...

What is the business logic that your code implements? Do you really know?

Do you keep separate (and complete) documentation of the business logic implemented in the code? I often get support cases where I dig into the code to find what's going on, and deep down discover some obscure case statement or an increment of a date by + 1, for example. Then I try to figure out what's going on, explain it to the users,...

How to make Emacs sql-mode recognize MySQL #-style comments?

I'm reading a bunch of MySQL files that use # (to end-of-line) comments, but my sql-mode doesn't support them. I found the syntax-table part of sql.el that defines /**/ and -- comments, but according to this, Emacs syntax tables support only 2 comment styles. Is there a way to add support for # comments in sql.el easily? ...

How do I specify input and output data types in python comments?

I have seen several standards for writing comments about the kind of data a function expects and returns in Python. Is there a consensus on which one is best-practice? Is the new functionality in http://www.python.org/dev/peps/pep-3107/ something I should start using for this? ...

How can I include user profile's images/logos on django comments

Hi all, I've posted this on django-users but haven't received a reply! So I have my own profile objects for users (subclass of User). One of the fields is imagefield, which is (obviously) used for users to upload their logo/thumbnail. The question is how I can include this on their comments? Any ideas? Thanks in advance! ...

What is your personal approach/take on commenting?

Duplicate What are your hard rules about commenting? A Developer I work with had some things to say about commenting that were interesting to me (see below). What is your personal approach/take on commenting? "I don't add comments to code unless its a simple heading or there's a platform-bug or a necessary work-around ...

Best way to automatically remove comments from PHP code

Whats the best way to remove comments from a PHP file? I want to do something similar to strip-whitespace() - but it shouldn't remove the line breaks as well. EG: I want this: <?PHP // something if ($whatsit) { do_something(); # we do something here echo '<html>Some embedded HTML</html>'; } /* another long comment */ some_mo...