coding-standards

Good example of written Rails coding standards?

I'm in the process of developing written code standards for a Rails app and am looking for some good examples of coding standards developed by others. Something that expands a bit on the ideas discussed in... Does anyone have a good reference to share? http://www.scribd.com/doc/2889649/Rails-coding-standards-defined Examples: ...

Pascal case edge case

Pascal case now: is it "Nontaxable", or "NonTaxable"? ...

C#: is calling an event handler explicitly really "a good thing to do"?

This question is related to C#, but may be applicable to other languages as well. I have a reservation against using code such as the following: using System.Windows.Forms; class MyForm : Form { private Timer myTimer; private Button myButton; public MyForm() { // Initialize the components, etc. myTimer...

Coding constraints checker?

Hi, Please help me to get a coding constraints for action script and flex 3. Regards, Lalji ...

Juval Lowy's C# Coding Standards Questions

I enjoy and highly recommend Juval Lowy's - C# Coding Standard. Juval explicitly avoids rationale for each directive in order to keep the standard tight (see the preface). However, there are a few directives for which I find myself curious as to the rationale. What is the specific rationale to the following directives from Lowy's C# st...

Where do you add new methods?

When you add a new method to a class where do you put it? At the end of the class...the top? Do you organize methods into specific groupings? Sorted alphabetically? Just looking for general practices in keeping class methods organized. Update When grouped where do you add the new method in the group? Just tack on the end or do you use...

Setting variable to NULL after free ...

In my company there is a coding rule that says, after freeing any memory, reset the variable to NULL. For example ... void some_func () { int *nPtr; nPtr = malloc (100); free (nPtr); nPtr = NULL; return; } I feel that, in cases like the code shown above, setting to NULL does not have any meaning. Or am I missin...

Are there coding standards for XML files?

I would like to know if there are any xml coding standards. <?xml version="1.0"?> <overlay id="tutorboy-toolbar-Overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"&gt; <toolbox id="navigator-toolbox"> <toolbar id="tutorboy-toolbar-Toolbar" toolbarname="TutorBoy Toolbar" ...

What is the name of a Function\Method whose success\failure is not necessary for successful execution?

Evening, Is there a common or standardised name given to a function or method whose execution is not crucial or necessary for the successful execution of a program? Whether the function fails or succeeds in its purpose is not important, only that it was attempted. I've been naming such functions as "volatile" (e.g. volatileInsertSearch...

Why is '//' style multiline comment bad (in Java)?

http://java.sun.com/docs/codeconv/html/CodeConventions.doc4.html#286 I was reading the above section of Java coding convention and started to wonder why it says "// comment.....shouldn't be used on consecutive multiple lines for text comments" Copy pasted the relevant section here for convenience: The // comment delimiter can comment ...

The field must have a documentation header - Style Cop - Code smell?

I was just running style cop against some of my code and got a few: SA1600: The field must have a documentation header. Now don't get me wrong I like style cop, it's great when you work on a project with more then one person but this rule seems a bit excessive to me. Why would you want to add: /// <summary> /// blah blah bla...

Help me understand this Brian Kernighan quote

"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." --Brian Kernighan It seems to be a subjective question, but in your opinion, 'What exactly is he intending "clever" to be?' ...

C# this.everything?

I've decided to use this.variableName when referring to string/int etc.. fields. Would that include ArrayList, ListBox etc too? Like: private ListBox usersListBox; private void PopulateListBox() { this.usersListBox.Items.Add(...); } ...Or not? And what about classes? MyClass myClass; private void PlayWithMyClass() { this.myClas...

Automatically reformat long-lined Java code to 80 columns and still compile?

My apologies if this is a duplicate, I've seen a couple threads on the subject of 80-column code, but didn't see an answer to this specific problem: My team is developing Java code in a couple different IDEs, with differing numbers of columns. It's worked well so far, but we've been asked to deliver compilable code to a partner with th...

Do you end your exception messages with a period?

I've seen both exception messages with and without a period. And I can think of some reasons of why both could be good. No dot would give you the freedom to add the period or leave it out if you wanted to. Could be useful if the message was going in some sort of a titlebar or something. WIth a dot you would always know that you had a "...

Putting constants on the left side in comparisons?

Possible Duplicates: == Operator and operands How to check for equals? (0 == i) or (i == 0) Why does one often see null != variable instead of variable != null in C#? I saw many people suggesting to put constants on the left side in all comparisons to avoid the problem of missing an equal sign. Example: use "if (0 == value)"...

Java development standards and tools (compared to C#)

I don't have any knowledge of Java platform and I wonder which tools (and methodologies) could be used to help developing maintainable code written in Java. I know one can use: Agile methodology in any environment jUnit/jMock for unit testing code (similar to NUnit/Moq in .net world) Checkstyle for coding standards - is this similar t...

Should I use string constants or string literals

By default I use string constants in my code when I have a string of text that will be output to the screen via a messagebox, label, etc. My main reason for doing so is that I do not want these strings to change at runtime and this way nobody really touches them. My question is: It seems that from a memory point of view, this approach ...

Are there any tools for verifying coding standards?

Hello, I'm having some trouble finding a tool for verifying if a code respects certain coding rules. For example I want to make sure of things like the following: class names start with a C class member names start with m_ global variables should start with g_ static variables should start with s_ comments should follow the doxygen r...

Refactoring policy for real-time code for critical system

I'm working in a company which produce real-time C program for home-made hardware, the program is 15-years old, and still need to be maintained. Even though we do not verify manually the code, We have a strict no-refactoring policy. Even if a certain code is hard to grasp, or have many clear code smells, you must make minor changes to i...