Most Popular
1500 questions
306
votes
10 answers
I'm a Subversion geek, why should I consider or not consider Mercurial or Git or any other DVCS?
I try to understand the benefits of distributed version control system (DVCS).
I found Subversion Re-education and this article by Martin Fowler very useful.
Mercurial and others DVCS promote a new way of working on code with changesets and local…
user2567
302
votes
5 answers
Is there any reason to use the "var" keyword in ES6?
Babel's guide to ES6 says:
let is the new var.
Apparently the only difference is that var gets scoped to the current function, while let gets scoped to the current block. There are some good examples in this answer.
I can't see any reason to use…

callum
- 10,417
302
votes
19 answers
Should I return from a function early or use an if statement?
I've often written this sort of function in both formats, and I was wondering if one format is preferred over another, and why.
public void SomeFunction(bool someCondition)
{
if (someCondition)
{
// Do Something
}
}
or
public…

Rachel
- 24,029
301
votes
9 answers
Aggregation vs Composition
I understand what composition is in OOP, but I am not able to get a clear idea of what Aggregation is. Can someone explain?

Vinoth Kumar C M
- 15,565
301
votes
38 answers
How Can I Know Whether I Am a Good Programmer?
Like most people, I think of myself as being a bit above average in my field. I get paid well, I've gotten promotions, and I've never had a real problem getting good references or getting a job.
But I've been around enough to notice that many of…

Kristopher Johnson
- 1,729
301
votes
2 answers
Python file naming convention?
I've seen this part of PEP-8 https://www.python.org/dev/peps/pep-0008/#package-and-module-names
I'm not clear on whether this refers to the file name of a module/class/package.
If I had one example of each, should the filenames be all lower case…

darkace
- 3,121
300
votes
20 answers
What does SVN do better than Git?
No question that the majority of debates over programmer tools distill to either personal choice (by the user) or design emphasis, that is, optimizing design according to particular uses cases (by the tool builder). Text editors are probably the…

doug
- 558
299
votes
14 answers
How do you unit test private methods?
I am working on a java project. I am new to unit testing. What is the best way to unit test private methods in java classes?

Vinoth Kumar C M
- 15,565
298
votes
6 answers
Why squash git commits for pull requests?
Why does every serious Github repo I do pull requests for want me to squash my commits into a single commit?
I thought the git log was there so you could inspect all your history and see exactly what changes happened where, but squashing it pulls it…

hamstar
- 3,091
297
votes
17 answers
Is premature optimization really the root of all evil?
A colleague of mine today committed a class called ThreadLocalFormat, which basically moved instances of Java Format classes into a thread local, since they are not thread safe and "relatively expensive" to create. I wrote a quick test and…

Craig Day
- 563
294
votes
16 answers
Grokking Java culture - why are things so heavy? What does it optimize for?
I used to code in Python a lot. Now, for work reasons, I code in Java. The projects I do are rather small, and possibly Python would work better, but there are valid non-engineering reasons to use Java (I can't go into details).
Java syntax is no…

Mikhail Ramendik
- 1,549
294
votes
8 answers
Why are people making tables with divs?
In modern web development I'm coming across this pattern ever more often. It looks like this:
…

Vilx-
- 5,320
291
votes
7 answers
Does using == in JavaScript ever make sense?
In JavaScript, the Good Parts, Douglas Crockford wrote:
JavaScript has two sets of equality operators: === and !==, and their evil twins == and !=. The good ones work the way you would expect. If the two operands are of the same type and have the…

Robert Harvey
- 199,517
289
votes
6 answers
Can I use GPL software in a commercial application
I have 3 questions about the GPL here:
If I use GPL software in my application, but don't modify or distribute it, do I have to release my application under the GPL?
What if I modify some software that my application uses. Then do I have to release…

Petah
- 3,441
288
votes
7 answers
How to write a very basic compiler
Advanced compilers like gcc compile code into machine readable files according to the language in which the code has been written (e.g. C, C++, etc). In fact, they interpret the meaning of the code according to library and functions of the…

Googlebot
- 3,233