Most Popular

1500 questions
63
votes
31 answers

Do I need to go to a big-name university?

As a soon-to-be graduating high school senior in the U.S., I'm going to be facing a tough decision in a few months: which college should I go to? Will it be worth it to go to Cornell or Stanford or Carnegie Mellon (assuming I get in, of course) to…
63
votes
10 answers

Is it bad practice to use a C++ compiler just for function overloading?

So I am working on a software design using C for a certain processor. The tool-kit includes the ability to compile C as well as C++. For what I am doing, there is no dynamic memory allocation available in this environment and the program is overall…
Snoop
  • 2,748
63
votes
11 answers

Are magic numbers acceptable in unit tests if the numbers don't mean anything?

In my unit tests, I often throw arbitrary values at my code to see what it does. For example, if I know that foo(1, 2, 3) is supposed to return 17, I might write this: assertEqual(foo(1, 2, 3), 17) These numbers are purely arbitrary and have no…
Kevin
  • 2,658
63
votes
11 answers

Is a big boolean expression more readable than the same expression broken down into predicate methods?

What is easier to understand, a big boolean statement (quite complex), or the same statement broken down into predicate methods (lots of extra code to read)? Option 1, the big boolean expression: private static bool…
willem
  • 1,053
63
votes
6 answers

Why is the minus sign, '-', generally not overloaded in the same way as the plus sign?

The plus sign + is used for addition and for string concatenation, but its companion: the minus sign, -, is generally not seen for trimming of strings or some other case other than subtraction. What could be the reason or limitations for…
63
votes
10 answers

Why would a program use a closure?

After reading many posts explaining closures here I'm still missing a key concept: Why write a closure? What specific task would a programmer be performing that might be best served by a closure? Examples of closures in Swift are accesses of an…
Bendrix
  • 759
63
votes
8 answers

Why does C provide language 'bindings' where C++ falls short?

I recently was wondering when to use C over C++, and vice versa? Fortunately someone already beat me to it and although it took a while, I was able to digest all the answers and comments to that question. However one item in that post keeps being…
smeeb
  • 4,870
63
votes
8 answers

What do you think about the Joel Test?

The Joel Test is a well known test for determining how good your team is. What do you think about the points? Do you disagree with any of them? Is there anything that you would add?
Casebash
  • 7,662
63
votes
8 answers

What is the "default" software license?

If I release some code and binaries, but I don't include any license at all with it, what are the legal terms that apply by default (in the US, where I am). I know that I automatically have copyright without doing anything, but what restrictions are…
Tesserex
  • 3,025
  • 4
  • 27
  • 27
63
votes
6 answers

Why was C# made with "new" and "virtual+override" keywords unlike Java?

In Java there are no virtual, new, override keywords for method definition. So the working of a method is easy to understand. Cause if DerivedClass extends BaseClass and has a method with same name and same signature of BaseClass then the overriding…
63
votes
16 answers

How to handle divide by zero in a language that doesn't support exceptions?

I'm in the middle of developing a new programming language to solve some business requirements, and this language is targeted at novice users. So there is no support for exception handling in the language, and I wouldn't expect them to use it even…
Reactgular
  • 13,080
63
votes
5 answers

When to use primitive vs class in Java?

I see that Java has Boolean (class) vs boolean (primitive). Likewise, there's an Integer (class) vs int (primitive). What's the best practice on when to use the primitive version vs the class? Should I basically always be using the class version…
Casey Patton
  • 5,241
63
votes
1 answer

The written roles of software development manager

We all know what a software development manager does, but I'm afraid that we only know it vaguely. We think we know what he is doing, but to exactly list down what is the job scope is a bit hard. In your opinion, what are the roles of a software…
Graviton
  • 4,005
63
votes
11 answers

Should a git commit message mention the file that was modified?

In the first line of a git commit message I have a habit of mentioning the file that modified if a change doesn't span multiple files, for example: Add [somefunc] to [somefile] Is this a good thing to do or is it unnecessary?
Matty
  • 1,164
63
votes
12 answers

What kind of problems does MapReduce solve?

I have been reading about MapReduce for a while -- but what I can't understand is how someone would make a decision to use (or not use) MapReduce. I mean, what are the problem patterns that signal that MapReduce could be used.
treecoder
  • 9,495