110
votes
17answers
23k views

Is there an excuse for short variable names?

This has become a large frustration with the codebase I'm currently working in; many of our variable names are short and undescriptive. I'm the only developer left on the project, and there isn't ...
110
votes
10answers
11k views

On developing deep programming knowledge

Occasionally I see questions about edge cases and other weirdness on Stack Overflow that are easily answered by the likes of Jon Skeet and Eric Lippert, demonstrating a deep knowledge of the language ...
110
votes
10answers
8k views

Should we define types for everything?

Recently I got into a problem with the readability of my code. I had a function that did an operation and returned a string representing the ID of this operation for future reference (a bit like ...
109
votes
14answers
20k views

“Never do in code what you can get the SQL server to do well for you” - Is this a recipe for a bad design?

It's an idea I've heard repeated in a handful of places. Some more or less acknowledging that once trying to solve a problem purely in SQL exceeds a certain level of complexity you should indeed be ...
109
votes
17answers
6k views

Should I tell someone that their commit caused a regression?

When you track down and fix a regression—i.e. a bug that caused previously working code to stop working—version control makes it entirely possible to look up who committed the change that broke it. ...
109
votes
8answers
9k views

Why does the US government disallow dynamic languages for secure projects?

I know some people that are currently working on a project for the US military (low security level, non-combat human resources type data). An initial state of the project code was submitted to the ...
109
votes
12answers
12k views

Effective Strategies for Localization in .NET

I am developing the UI for a .NET MVC application that will require international localization of all content in the near future. I am very familiar with .NET in general but have never had a project ...
109
votes
9answers
9k views

When is it a good idea to force garbage collection?

So I was reading a question about forcing the C# garbage collector to run where almost every single answer is the same: you can do it, but you shouldn't - except for some very rare cases. Sadly, ...
109
votes
20answers
5k views

Is the phrase “never reinvent the wheel” suitable for students?

I find myself constantly running into this expression "don't reinvent the wheel" or "never reinvent the wheel" when I ask some questions on SO. They tell you to use some frameworks or existing ...
106
votes
18answers
26k views

Dealing with engineers that frequently leave their jobs

My friend is a project manager for a software company. The most frustrating thing for him is that his engineers frequently leave their jobs. The company works hard to recruit new engineers, transfer ...
106
votes
15answers
16k views

Is it always a best practice to write a function for anything that needs to repeat twice?

For myself, I can't wait to write a function when I need to do something more than twice. But when it comes to the things that only appear twice, it's a bit more tricky. For code that needs more than ...
106
votes
16answers
8k views

How to avoid “DO YOU HAZ TEH CODEZ” situations?

I have a strange situation at work, where a colleague of mine often asks me and other co-workers for working code. I would like to help him, but this constant request of trivial snippets interrupts ...
105
votes
18answers
9k views

Can a function be too short?

Whenever I find myself writing the same logic more than once, I usually stick it in a function so there is only one place in my application I have to maintain that logic. A side effect is that I ...
105
votes
12answers
50k views

Why do we need private variables?

Why do we need private variables in classes? Every book on programming I've read says this is a private variable, this is how you define it but stops there. The wording of these explanations always ...
104
votes
24answers
57k views

Why are data structures so important in interviews?

I am a newbie into the corporate world recently graduated in computers. I am a java/groovy developer. I am a quick learner and I can learn new frameworks, APIs or even programming languages within ...
104
votes
22answers
12k views

Do job postings exaggerate their requirements? [closed]

I feel like a reasonably qualified programmer, but a lot of job postings I run into make me feel otherwise. Almost all of them separate qualifications into requirements and desirables, but even the ...
104
votes
10answers
28k views

Is Ken Thompson's compiler hack still a threat?

Ken Thompson Hack (1984) Ken Thompson outlined a method for corrupting a compiler binary (and other compiled software, like a login script on a *nix system) in 1984. I was curious to know if modern ...
103
votes
20answers
5k views

Project Manager that wants to lock in time estimate with a signed contract

At a previous employment, a project manager (PM) wasn't satisfied with the delivery time of the code on a project I was on. I was told by my project lead that that the PM was considering having me ...
103
votes
18answers
7k views

When should I make the first commit to source control?

I'm never sure when a project is far enough along to first commit to source control. I tend to put off committing until the project is 'framework-complete,' and I primarily commit features from then ...
103
votes
16answers
5k views

How do you store “fuzzy dates” into a database?

This is a problem I've run into a few times. Imagine you have a record that you want to store into a database table. This table has a DateTime column called "date_created". This one particular record ...
103
votes
10answers
4k views

TDD vs. Productivity

In my current project (a game, in C++), I decided that I would use Test Driven Development 100% during development. In terms of code quality, this has been great. My code has never been so well ...
102
votes
8answers
10k views

How to avoid being forked into oblivion by a more powerful contributor?

As recently reported here: Xamarin has forked Cocos2D-XNA, a 2D/3D game development framework, creating a cross-platform library that can be included in PCL projects. However the founder of ...
101
votes
15answers
44k views

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). ...
101
votes
11answers
9k views

Strategy for keeping secret info such as API keys out of source control?

I'm working on a website that will allow users to log in using OAuth credentials from the likes of Twitter, Google, etc. To do this, I have to register with these various providers and get a ...
100
votes
11answers
11k views

Where should my team start with becoming “modern”? [closed]

I'm a relatively new developer, fresh from college. While in college and during subsequent job-seeking, I realized that there were a lot of "modern" software development methodologies that my ...
100
votes
16answers
5k views

Should I remove unreferenced code?

I'm working on a medium sized (100k lines) code base, it's all relatively recent code (less than a year old) and has good unit test coverage. I keep coming across methods which are either no longer ...
99
votes
14answers
11k views

Is it possible to rewrite every line of an open source project in a slightly different way, and use it in a closed source project?

There is some code which is GPL or LGPL that I am considering using for an iPhone project. If I took that code (JavaScript) and rewrote it in a different language for use on the iPhone would that be ...
99
votes
8answers
15k views

Why is polling accepted in web programming?

I am currently working on a Ruby on Rails project which shows a list of images. A must-have for this project is that it shows new posts in realtime without the need of refreshing the web page. After ...
99
votes
5answers
23k views

Scheme vs Common Lisp: Which characteristics made a difference in your project? [closed]

There are no shortage of vague "Scheme vs Common Lisp" questions on both StackOverflow and on this site, so I want to make this one more focused. The question is for people who have coded in both ...
98
votes
60answers
10k views

Which things instantly ring alarm bells when looking at code? [closed]

I attended a software craftsmanship event a couple of weeks ago and one of the comments made was "I'm sure we all recognize bad code when we see it" and everyone nodded sagely without further ...
98
votes
17answers
8k views

Importance of hobby projects

I want to know, how important is it to program in your spare time? Is it necessary to work your 9-5 as a programmer and then get home and work on your hobby to become a better programmer? This said, ...
98
votes
10answers
54k views

What is MVC, really? [closed]

As a serious programmer, how do you answer the question What is MVC? In my mind, MVC is sort of a nebulous topic — and because of that, if your audience is a learner, then you're free to ...
98
votes
22answers
8k views

Elegant ways to handle if(if else) else

This is a minor niggle, but every time I have to code something like this, the repetition bothers me, but I'm not sure that any of the solutions aren't worse. if(FileExists(file)) { contents = ...
97
votes
16answers
48k views

When are Getters and Setters Justified

Getters and setters are often criticized as being not proper OO. On the other hand most OO code I've seen has extensive getters and setters. When are getters and setters justified? Do you try to ...
96
votes
19answers
54k views

Why are interfaces useful?

I have been studying and coding in C# for some time now. But still, I can't figure the usefulness of Interfaces. They bring too little to the table. Other than providing the signatures of function, ...
96
votes
19answers
24k views

Should I return from a function early or use an if statement?

I've often written this sort of function in both formats, and I was wondering if one format is preferred over another, and why. public void SomeFunction(bool someCondition) { if (someCondition) ...
96
votes
15answers
7k views

How can I convince management to deal with technical debt?

This is a question that I often ask myself when working with developers. I've worked at four companies so far and I've become aware of a lack of attention to keeping code clean and dealing with ...
96
votes
9answers
8k views

Am I too young to burn out? [closed]

I feel like I have burned out, even though I am only out of college for 5 years. For the first 3 years of my career, things were going awesome. I was never anything special in school, but I felt ...
95
votes
15answers
14k views

Why did memory-managed languages like Java, Javascript, and C# retain the `new` keyword?

The new keyword in languages like Java, Javascript, and C# creates a new instance of a class. This syntax seems to have been inherited from C++, where new is used specifically to allocate a new ...
93
votes
17answers
7k views

Being stupid to get better productivity?

I've spent a lot of time reading different books about "good design", "design patterns", etc. I'm a big fan of the SOLID approach and every time I need to write a simple piece of code, I think about ...
92
votes
14answers
9k views

Why do most programming languages only support returning a single value from a function?

Is there a reason why functions in most(?) programming languages are designed to support any number of input parameters but only one return value? In most languages, it is possible to "work around" ...
92
votes
4answers
34k views

Difference between Dependency Injection (DI) & Inversion of Control (IOC)

I've been seeing a lot of references of Dependency Injection (DI) & Inversion Of Control (IOC), but I don't really know if there is a difference between them or not. I would like to start using ...
91
votes
13answers
10k views

I'm in over my head at my job. What should I do? [closed]

About 8 months ago I was hired as the sole developer at a small company to take on a certain project. Although there are other small projects that come up from time to time, I've been spending about ...
91
votes
11answers
13k views

The modern way to perform error handling…

I've been pondering this problem for a while now and find myself continually finding caveats and contradictions, so I'm hoping someone can produce a conclusion to the following: Favour exceptions ...
90
votes
16answers
17k views

Is premature optimization really the root of all evil?

A colleague of mine today committed a class called ThreadLocalFormat, which basically moved instances of Java Format classes into a thread local, since they are not thread safe and "relatively ...
90
votes
21answers
8k views

What's the benefit of avoiding the use of a debugger?

Over the course of my career, I've noticed that some developers don't use debugging tools, but do spot checking on erroneous code to figure out what the problem is. While many times being able to ...
90
votes
12answers
7k views

Should the commit history be used to convey critical information to developers?

During a meeting regarding the rollback of a third-party SDK from the latest version it was noted that the our developers already flagged in the commit history that the latest version should not be ...
90
votes
11answers
25k views

What backs up the claim that C++ can be faster than a JVM or CLR with JIT? [closed]

A reoccurring theme on SE I've noticed in many questions is the ongoing argument that C++ is faster and/or more efficient than higher level languages like Java. The counter-argument is that modern JVM ...
90
votes
6answers
5k views

Ship of Theseus applied to GPL - Can I relicense my program if I replace all of the derivative parts?

I translated a GPLv2 C program to Python, but found it was hard to extend as designed and rewrote significant portions of it. The program is now structurally completely different, but there are ...
90
votes
5answers
35k views

How can Swift be so much faster than Objective-C in these comparisons?

Apple launched its new programming language Swift at WWDC14. In the presentation, they made some performance comparisons between Objective-C and Python. The following is a picture of one of their ...

15 30 50 per page