Most Popular

1500 questions
56
votes
6 answers

Most readable way to format long if conditions?

Long winding if conditions should be avoided if at all possible, yet sometimes we all end up writing them. Even if it's a very simple condition, the involved statements are sometimes simply very wordy, so the whole condition ends up being very…
deceze
  • 2,215
  • 1
  • 19
  • 19
56
votes
3 answers

What is a type system?

Background I am designing a language, as a side project. I have a working assembler, static analyser, and virtual machine for it. Since I can already compile and run non-trivial programs using the infrastructure I've built I thought about giving a…
56
votes
7 answers

Why does the call stack have a static maximum size?

Having worked with a few programming languages, I've always wondered why the thread stack has a predefined maximum size, instead of expanding automatically as required.  In comparison, certain very common high level structures (lists, maps, etc.)…
Lynn
  • 826
  • 1
  • 6
  • 8
56
votes
6 answers

Is making a small change, testing it, then "rinse and repeat", a bad habit?

I am a programmer with a number of years of experience. I realized I got a certain habit. I'm not sure whether it's really a bad habit or not. I get a list of tasks to perform for a solution, even small small tasks, for example, Change resources of…
Mathematics
  • 997
  • 6
  • 15
56
votes
11 answers

What is meant by, "A user shouldn't decide whether it is an Admin or not. The Privileges or Security system should."

The example used in the question pass bare minimum data to a function touches on the best way to determine whether the user is an administrator or not. One common answer was: user.isAdmin() This prompted a comment which was repeated several times…
56
votes
3 answers

What's is the point of PImpl pattern while we can use interface for the same purpose in C++?

I see a lot of source code that uses PImpl idiom in C++. I assume Its purpose is to hide the private data/type/implementation, so it can remove dependence, and then reduce compile time and header include issue. But interface/pure-abstract classes in…
ZijingWu
  • 1,047
  • 1
  • 9
  • 15
56
votes
5 answers

Why are reference-counting smart pointers so popular?

As I can see, smart pointers are used extensively in many real-world C++ projects. Though some kind of smart pointers are obviously beneficial to support RAII and ownership transfers, there is also a trend of using shared pointers by default, as a…
user99541
56
votes
4 answers

Boolean Method Naming Affirmative vs Negative

Should boolean methods always take the affirmative form, even when they will only ever be used in the negative form? Say I wanted to check whether an entity exists before creating one, my argument is that the first form below is better than the…
lynks
  • 663
  • 1
  • 5
  • 6
56
votes
10 answers

Should Junior Programmers be involved as code reviewers in the projects of Senior Programmers?

One of my team members, a junior programmer, has impressive programming skills for his level of experience. And during code reviews, I believe in emphasizing learning, not pointing out mistakes. But should junior programmers be involved in code…
Md Mahbubur Rahman
  • 4,747
  • 5
  • 32
  • 38
56
votes
8 answers

Should a stack trace be in the error message presented to the user?

I've got a bit of an argument at my workplace and I'm trying to figure out who is right, and what is the right thing to do. Context: An intranet web application that our customers use for accounting and other ERP stuff. I'm of the opinion that an…
Vilx-
  • 5,320
  • 4
  • 20
  • 24
56
votes
9 answers

Are Intel compilers really better than the Microsoft ones?

Years ago, I was surprised when I discovered that Intel sells Visual Studio compatible compilers. I tried it in particular for C/C++ as well as fantastic diagnostic tools. But the code was simply not that computationally intensive to notice the…
user7071
56
votes
6 answers

Who created the idea(s) of the first loop constructs?

while (1) { if (1+1==2) { print "Yes, you paid attention in Preschool!"; } else { print "Wait... I thought 1+1=2"; } } As a developer, we all have to use loops very frequently. We know that. What I was…
Dynamic
  • 5,746
  • 9
  • 45
  • 73
56
votes
20 answers

Must developers understand the business domain or should the specification be sufficient?

I work for a company for which the domain is really difficult to understand because it is high technology in electronics, but this is applicable to any software development in a complex domain. The application that I work on displays a lot of…
Jerome C.
  • 229
  • 3
  • 7
56
votes
17 answers

How to deal with tautology in comments?

Sometimes I find myself in situations when the part of code that I am writing is (or seems to be) so self-evident that its name would be basically repeated as a comment: class Example { /// /// The location of the update. ///…
Tamás Szelei
  • 7,737
  • 7
  • 38
  • 42
56
votes
8 answers

What is the difference between 'layer of abstraction' and 'level of indirection'?

I am not sure if both terms can be used interchangeably. Maybe there is some academic distinction in computer science which is not relevant for day-to-day programming? Or can I use both term interchangeably without being wrong? Maybe it depends on…
Theo Lenndorff
  • 2,534
  • 1
  • 18
  • 15