Most Popular

1500 questions
59
votes
11 answers

Are utility classes with nothing but static members an anti-pattern in C++?

The question Where should I put functions that are not related to a class has sparked some debate over whether it makes sense in C++ to combine utility functions in a class or just have them exist as free functions in a namespace. I come from a C#…
PersonalNexus
  • 2,989
  • 5
  • 27
  • 42
59
votes
12 answers

Is it considered bad practice to have PHP in your JavaScript

So many times on this site I see people trying to do things like this : I don't…
Greg Guida
  • 737
  • 1
  • 6
  • 11
59
votes
17 answers

What programming problems are best solved by using pointers?

Well, I basically understand how to use pointers, but not how best to use them in order to do better programming. What are good projects or problems to resolve involving the use of pointers so I can understand them better?
dsocolobsky
  • 963
  • 9
  • 15
58
votes
17 answers

How can I make refactoring a priority for my team?

The codebase I work with daily has no automated tests, inconsistent naming and tons of comments like "Why is this here?", "Not sure if this is needed" or "This method isn't named right" and the code is littered with "Changelogs" despite the fact we…
Joseph Garland
  • 431
  • 4
  • 3
58
votes
19 answers

Does OOP fulfill the promise of code reuse? What alternatives are there to achieve code reuse?

Perhaps the greatest promise of using object-oriented paradigm is the code reuse. Some dispute that this was achieved. Why was it (not) achieved? Does code reuse as OOP defines it, make projects more productive? Or more manageable? Or easier to…
Maniero
  • 10,826
  • 14
  • 80
  • 133
58
votes
12 answers

What are the chances of Google's Go becoming a mainstream language?

Who here is learning Go? Are other companies looking at using it? Is it likely to become widely used?
interstar
  • 1,449
  • 10
  • 15
58
votes
13 answers

When do you not give help to less experienced programmers?

Do you think that its a good idea when a junior programmer needs help to always jump in and try to educate them? Or will they ignore all the "teaching to fish" advice you give them and just focus on the "fish" you just brought them? Do you let them…
Doug T.
  • 11,642
  • 5
  • 43
  • 69
58
votes
3 answers

Why Python and not Lua?

Why has Python been backed by google and become so rapidly popular and Lua has not? Do you know why Lua has stayed in background?
BenjaminB
  • 1,706
  • 1
  • 12
  • 15
58
votes
11 answers

If two individual branches pass unit tests, once they're merged, is the result also guaranteed to pass unit tests?

Suppose we have two branches A and B which have been forked from master. Both branches A and B make some changes and implement some unit tests. They pass all current and new tests, then are merged back into master. For simplicity, there are no merge…
kentrid
  • 721
  • 1
  • 4
  • 6
58
votes
12 answers

Is it common to have to iterate on a design due to overlooking problems with it?

When I'm designing a system for a program, I often make misjudgements that will prevent the design from either working, being maintainable, easy to use or all the above. This means I will usually have to iterate several times, refactoring my code…
Sebastian King
  • 709
  • 5
  • 7
58
votes
8 answers

How do I ensure that interface implementations are implemented in the manner I expected?

Let's say there is a member SomeMethod in an interface ISomeInterface as follows: public interface ISomeInterface { int SomeMethod(string a); } For the purposes of my program, all consumers of ISomeInterface act upon the assumption that the…
user4779
  • 929
  • 1
  • 6
  • 13
58
votes
11 answers

Why does C++ have 'undefined behaviour' (UB) and other languages like C# or Java don't?

This Stack Overflow post lists a fairly comprehensive list of situations where the C/C++ language specification declares as to be 'undefined behaviour'. However, I want to understand why other modern languages, like C# or Java, doesn't have the…
Sisir
  • 828
  • 1
  • 7
  • 17
58
votes
2 answers

How would you implement Google Search?

Supposed you were asked in an interview "How would you implement Google Search?" How would you answer such a question? There might be resources out there that explain how some pieces in Google are implemented (BigTable, MapReduce, PageRank, ...),…
ripper234
  • 1,114
  • 1
  • 8
  • 13
58
votes
16 answers

How should I store "unknown" and "missing" values in a variable, while still retaining the difference between "unknown" and "missing"?

Consider this an "academic" question. I have been wondering about about avoiding NULLs from time to time and this is an example where I can't come up with a satisfactory solution. Let's assume I store measurements where on occasions the measurement…
exhuma
  • 1,191
  • 1
  • 10
  • 16
58
votes
6 answers

Why do many functions that return structures in C, actually return pointers to structures?

What is the advantage of returning a pointer to a structure as opposed to returning the whole structure in the return statement of the function? I am talking about functions like fopen and other low level functions but probably there are higher…
yoyo_fun
  • 2,267
  • 3
  • 17
  • 22