Most Popular

1500 questions
73
votes
3 answers

How does a single thread run on multiple cores?

I am trying to understand, at a high-level, how single threads run across multiple cores. Below is my best understanding. I do not believe it is correct though. Based on my reading of Hyper-threading, it seems the OS organizes the instructions of…
Evorlor
  • 1,411
  • 2
  • 17
  • 22
73
votes
3 answers

How does garbage collection compare to reference counting?

I starting working through an online course on iOS development in the new language from Apple, Swift. The instructor made a point that raised this question in my mind. He said something to the effect of: There's no need to worry about memory…
Aaron Anodide
  • 5,553
  • 6
  • 30
  • 37
73
votes
5 answers

Why are there so few C compilers?

C is one of the most widely-used languages in the world. It accounts for a huge proportion of existing code and continues to be used for a vast amount of new code. It's beloved by its users, it's so widely ported that being able to run C is to many…
anon
73
votes
4 answers

What's in the "contrib" folder?

Often open-source software projects have a folder called "contrib". For example, Django has one. What is it for?
73
votes
7 answers

Should I follow the normal path or fail early?

From the Code Complete book comes the following quote: "Put the normal case after the if rather than after the else" Which means that exceptions/deviations from the standard path should be put in the else case. But The Pragmatic Programmer teaches…
jao
  • 1,123
73
votes
9 answers

Why not expose a primary key

In my education I have been told that it is a flawed idea to expose actual primary keys (not only DB keys, but all primary accessors) to the user. I always thought it to be a security problem (because an attacker could attempt to read stuff not…
Angelo Fuchs
  • 1,096
73
votes
2 answers

What is a" feature envy" code and why is it considered a code smell?

This question on SO talks about correcting what the OP thought is feature envy code. Another example where I saw this nifty phrase being quoted is in a recently given answer here in programmers.SE. Although I did drop in a comment to that answer…
Geek
  • 5,177
73
votes
4 answers

How do functional languages handle random numbers?

What I mean about that is that in nearly every tutorial I've read about functional languages, is that one of the great things about functions, is that if you call a function with the same parameters twice, you'll always end up with the same…
73
votes
2 answers

Why do bitwise operators have lower priority than comparisons?

Could someone explain the rationale, why in a bunch of most popular languages (see note below) comparison operators (==, !=, <, >, <=, >=) have higher priority than bitwise operators (&, |, ^, ~)? I don't think I've ever encountered a use where this…
SF.
  • 5,156
73
votes
5 answers

Why do some big projects, like Git and Debian, only use a mailing list and not an issue tracker?

Bug tracker for any decent sized project seem like a bit of a no-brainer to me - it makes it really easy to organise hundreds or thousands issues, without issues colliding or getting mixed up. So when I see some really big projects, like Git, using…
naught101
  • 1,240
  • 11
  • 15
73
votes
26 answers

How do people read big technical books?

I see that most of the good programmers have the habit of reading big books for learning about technology. What does it really take to read technical books, apart from the real interest on the technology? How can I improve my ability to read these…
NLV
  • 367
73
votes
10 answers

My proposed design is usually worse than my colleague's - how do I get better?

I have been programming for couple of years and am generally good when it comes to fixing problems and creating small-to-medium scripts, however, I'm generally not good at designing large scale programs in object oriented way. Few…
73
votes
8 answers

Single Responsibility Principle - How Can I Avoid Code Fragmentation?

I'm working on a team where the team leader is a virulent advocate of SOLID development principles. However, he lacks a lot of experience in getting complex software out of the door. We have a situation where he has applied SRP to what was already…
73
votes
12 answers

How can I quantify the amount of technical debt that exists in a project?

Does anyone know if there is some kind of tool to put a number on technical debt of a code base, as a kind of code metric? If not, is anyone aware of an algorithm or set of heuristics for it? If neither of those things exists so far, I'd be…
73
votes
6 answers

Why is the Select before the From in an SQL query?

This is something that bothered me a lot at school. Five years ago, when I learned SQL, I always wondered why we first specify the fields we want and then where we want them from. According to my idea, we should write: From Employee e Select…
Cyril Gandon
  • 1,326