Top "Conventions" questions

When should I use double or single quotes in JavaScript?

console.log("double"); vs. console.log('single'); I see more and more JavaScript libraries out there using single quotes when …

javascript string conventions
What is trunk, branch and tag in Subversion?

Possible Duplicate: What do “branch”, “tag” and “trunk” really mean? What is a trunk, branch and tag in Subversion and …

svn branch tags conventions trunk
Is there a standardized method to swap two variables in Python?

In Python, I've seen two variable values swapped using this syntax: left, right = right, left Is this considered the standard …

python syntax swap conventions
Code line wrapping - how to handle long lines

I'm facing a particular line that is 153 characters long. Now, I tend to break things after 120 characters (of course, this …

java coding-style conventions line-breaks
Are there any Java method ordering conventions?

I've got a large-ish class (40 or so methods) that is part of a package I will be submitting as course-work. …

java methods conventions
Convert Enumeration to a Set/List

Is there some one-liner bridge method to dump a given Enumeration to java.util.List or java.util.Set? Something …

api collections conventions java
Should I use past or present tense in git commit messages?

I read once that git commit messages should be in the imperative present tense, e.g. "Add tests for x". …

git git-commit conventions commit-message
How do I add the contents of an iterable to a set?

What is the "one [...] obvious way" to add all items of an iterable to an existing set?

python set conventions iterable
Java: Infinite Loop Convention

What is the convention for an infinite loop in Java? Should I write while(true) or for(;;)? I personally would …

java infinite-loop conventions
Python: using 4 spaces for indentation. Why?

While coding python I'm using only 2 spaces to indent, sure PEP-8 really recommend to have 4 spaces, but historically for me …

python indentation conventions pep8