Most Popular
1500 questions
186
votes
10 answers
Why is Clean Code suggesting avoiding protected variables?
Clean Code suggests avoiding protected variables in the "Vertical Distance" section of the "Formatting" chapter:
Concepts that are closely related should be kept vertically close to each other. Clearly this rule doesn't work for concepts that…

Matsemann
- 1,948
185
votes
17 answers
Is there a benefit in compiling your code as you go along?
I recently had a job interview in which they gave me an hour to write some real code. It wasn't a huge amount, probably less than 100 lines. After about 45 minutes, I compiled, ran it, and got it to work. I may have spent 5-10 minutes working out…

CaptainCodeman
- 1,895
185
votes
16 answers
Why does automated testing keep failing in my company?
We have tried to introduce developer automated testing several times at my company. Our QA team uses Selenium to automate UI tests, but I always wanted to introduce unit tests and integration tests. In the past, each time we tried it, everyone got…

Mag20
- 3,301
184
votes
23 answers
How can I deal with a team member who dislikes making comments in code?
One of my team members consistently avoids making comments in his code.
His code is not self-documenting, and other programmers have a difficult time understanding his code.
I have asked him several times to comment his code, however he just gives…

Md Mahbubur Rahman
- 4,777
184
votes
15 answers
What is the advantage of currying?
I just learned about currying, and while I think I understand the concept, I'm not seeing any big advantage in using it.
As a trivial example I use a function that adds two values (written in ML). The version without currying would be
fun add(x, y)…

Mad Scientist
- 2,826
- 2
- 19
- 19
184
votes
3 answers
Is Entity Framework Suitable For High-Traffic Websites?
Is Entity Framework 4 a good solution for a public website with potentially 1000 hits/second?
In my understanding EF is a viable solution for mostly smaller or intranet websites, but wouldn't scale easily for something like a popular community…

niaher
- 1,949
- 3
- 12
- 7
183
votes
5 answers
When do you use a struct instead of a class?
What are your rules of thumb for when to use structs vs. classes? I'm thinking of the C# definition of those terms but if your language has similar concepts I'd like to hear your opinion as well.
I tend to use classes for almost everything, and use…

RationalGeek
- 10,077
183
votes
23 answers
How to apologize when you have broken the nightly build
My first commit in my project resulted in the nightly build being broken and people are all over me as we are nearing the release. I want to send an apology email that should sound sincere
and at the same time hinting that this was my first commit…

rajachan
- 723
183
votes
3 answers
Which SPDX license is equivalent to 'All Rights Reserved'?
I've got a package.json that's expecting a SPDX-approved license acronym, but I can't find one that means 'proprietary commercial license, all rights reserved'.
Is there one for non-FOSS, where I want to specify that I want to allow no reuse?

Bryce
- 2,029
182
votes
4 answers
What is the benefit of git's two-stage commit process (staging)?
I'm learning git and I've noticed that it has a two-step commit process:
git add
git commit
The first step places revisions into what's called a "staging area" or "index".
What I'm interested in is why this design decision is made, and…

thomasrutter
- 2,301
180
votes
8 answers
Exceptions: Why throw early? Why catch late?
There are many well-known best practices about exception handling in isolation. I know the "do's and don'ts" well enough, but things get complicated when it comes to best practices or patterns in larger environments. "Throw early, catch late" - I've…

shylynx
- 2,134
180
votes
22 answers
Are null references really a bad thing?
I've heard it said that the inclusion of null references in programming languages is the "billion dollar mistake". But why? Sure, they can cause NullReferenceExceptions, but so what? Any element of the language can be a source of errors if used…

Tim Goodman
- 2,644
179
votes
5 answers
What's the reason for not using C++17's [[nodiscard]] almost everywhere in new code?
C++17 introduces the [[nodiscard]] attribute, which allows programmers to mark functions in a way that the compiler produces a warning if the returned object is discarded by a caller; the same attribute can be added to an entire class type.
I've…

Christian Hackl
- 1,964
179
votes
13 answers
Is it OK to split long functions and methods into smaller ones even though they won't be called by anything else?
Lately I've been trying to split long methods into several short ones.
For example: I have a process_url() function which splits URLs into components and then assigns them to some objects via their methods. Instead of implementing all this in one…

Stas Bichenko
- 3,709
179
votes
6 answers
What is the point of using DTO (Data Transfer Objects)?
What is the point of using DTO and is it an out dated concept? I use POJOs in the view layer to transfer and persist data. Can these POJOs be considered as an alternative to DTOs?

Vinoth Kumar C M
- 15,565