All Questions

Filter by
Sorted by
Tagged with
132
votes
14answers
19k views

Why are statements in many programming languages terminated by semicolons?

Is there a reason that a semi-colon was chosen as a line terminator instead of a different symbol? I want to know the history behind this decision, and hope the answers will lead to insights that may ...
132
votes
10answers
10k 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 ...
131
votes
16answers
12k views

How can I tactfully suggest improvements to others' badly designed code during review?

I'm a great believer in clean code and code craftsmanship, though I'm currently at a job where this isn't regarded as a top priority. I sometimes find myself in a situation where a peer's code is ...
131
votes
1answer
50k views

Understanding the differences: traditional interpreter, JIT compiler, JIT interpreter and AOT compiler

I'm trying to understand the differences between a traditional interpreter, a JIT compiler, a JIT interpreter and an AOT compiler. An interpreter is just a machine (virtual or physical) that executes ...
130
votes
45answers
42k views

Does giving a developer a slower development machine result in faster/more efficient code? [closed]

Suppose I give my developers a screaming fast machine. WPF-based VS2010 loads very quickly. The developer then creates a WPF or WPF/e application that runs fine on his box, but much slower in the ...
130
votes
14answers
10k views

Demonstrate bad code to client?

A client has asked me to do a redesign of their website, an ASP.NET Webforms application that was developed by another consultant. It seemed like a relatively straightforward job, but after looking at ...
130
votes
7answers
17k views

Are private, unguessable URLs equivalent to password-based authentication?

I want to expose a resource on the web. I want to protect this resource: to make sure it is only accessible to certain individuals. I could set up some kind of password-based authentication. For ...
130
votes
10answers
61k views

How should I test randomness?

Consider a method to randomly shuffle elements in an array. How would you write a simple yet robust unit test to make sure that this is working? I've come up with two ideas, both of which have ...
129
votes
16answers
17k views

When does bugfixing become overkill, if ever?

Imagine you are creating a video player in JavaScript. This video player loops the user's video repeatedly using a recursive function and, because of that, the browser will trigger a too much ...
129
votes
16answers
25k views

Is there any way to get faster at solving bugs? I've just had a warning from my boss [closed]

I've just been told by my boss that I will receive a negative performance review on Monday. He wants to talk to me about why I am so slow and why my bug fix rate is so low. I love programming and ...
129
votes
6answers
37k views

Should the variable be named Id or ID? [closed]

This is a bit pedantic, but I've seen some people use Id as in: private int userId; public int getUserId(); and others use: private int userID; public int getUserID(); Is one of these a better ...
129
votes
3answers
135k views

What are the real life implications for an Apache 2 license? [closed]

I want to use SVG Edit for a project. This software is distributed under the Apache 2 license. I've seen that: all copies, modified or unmodified, are accompanied by a copy of the licence all ...
128
votes
10answers
75k views

Why do most of us use 'i' as a loop counter variable?

Has anyone thought about why so many of us repeat this same pattern using the same variable names? for (int i = 0; i < foo; i++) { // ... } It seems most code I've ever looked at uses i, j, k ...
128
votes
18answers
28k views

How should I charge for programming things which take two minutes to fix? [closed]

I am really confused with this. I believe that the more I am getting experience, the more I am becoming an expert at finding mistakes and fixing them quickly. Now my boss got website from a ...
128
votes
11answers
27k views

Is there anything that can be done with recursion that can't be done with loops?

There are times where using recursion is better than using a loop, and times where using a loop is better than using recursion. Choosing the "right" one can save resources and/or result in fewer lines ...
128
votes
11answers
32k views

How has an increase in the complexity of systems affected successive generations of programmers?

As a "new" programmer (I first wrote a line of code in 2009), I've noticed it's relatively easy to create a program that exhibits quite complex elements today with things like .NET framework for ...
127
votes
15answers
23k views

Are single-character constants better than literals?

I recently encountered a class which provides pretty much every single-character as a constant; everything from COMMA to BRACKET_OPEN. Wondering whether this was necessary; I read an "article" which ...
127
votes
11answers
10k views

Is it appropriate for interviewers to ask candidates for their Stack Exchange user name? [closed]

Would you consider it appropriate if you were asked for your Stack Exchange username in a software job interview (or as a pre-interview screening question)? To me, it seems like a very reasonable ...
127
votes
17answers
12k 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 ...
126
votes
27answers
10k views

What are the worst false economies in software development? [closed]

What are the worst false economies (that is ways of saving money that ultimately cost more than they save) prevalent in the software industry and how do you combat them?
126
votes
14answers
18k views

Should the solution be as generic as possible or as specific as possible?

Say I have a entity that has "type" attribute. There could be 20+ possible types. Now I'm asked to implement something that would allow changing the type from A->B, which is the only use case. So ...
126
votes
23answers
31k views

Why did Git get so much hype? …while others don't? [closed]

In the recent years, the hype around Git raised greatly. Everybody knows about Git, nobody knows about alternatives. Other ones like Mercurial seem to be unnoticed. Both have been released in 2005, ...
126
votes
19answers
14k 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 ...
126
votes
9answers
26k views

Is there any “real” reason multiple inheritance is hated?

I've always liked the idea of having multiple inheritance supported in a language. Most often though it's intentionally forgone, and the supposed "replacement" is interfaces. Interfaces simply do ...
126
votes
8answers
56k views

When is it not appropriate to use the dependency injection pattern?

Since learning (and loving) automated testing I have found myself using the dependency injection pattern in almost every project. Is it always appropriate to use this pattern when working with ...
125
votes
16answers
24k views

Team constantly fails to meet sprint goals

We are a small software company with one product. We use scrum, and our developers choose the features they want to include in each sprint. Unfortunately over the past 18 month period, the team haven'...
125
votes
15answers
20k views

How do you write unit tests for code with difficult to predict results?

I frequently work with very numeric / mathematical programs, where the exact result of a function is difficult to predict in advance. In trying to apply TDD with this kind of code, I often find ...
125
votes
41answers
6k views

What kind of innovative non-cash financial benefits do I offer to my developers to retain them along with a competitive salary?

Stock options don't make much sense, since the company's private. [It still does, if you are a facebook of sorts AND the regulatory system permits sites like secondmarket, but I digress.] I could ...
125
votes
14answers
30k views

Does auto make C++ code harder to understand?

I saw a conference by Herb Sutter where he encourages every C++ programmer to use auto. I had to read C# code some time ago where var was extensively used and the code was very hard to understand—...
125
votes
20answers
21k views

How do you safely delete a piece of code that looks like it's never entered?

You've found some code that looks superfluous, and the compiler doesn't notice that. What do you do to be sure (or as close to sure as you can) that deleting this code won't cause regression. Two ...
125
votes
8answers
62k views

Recursion or while loops

I was reading about some development interview practices, specifically about the technical questions and tests asked at interviews and I've stumbled quite a few times over sayings of the genre "Ok you ...
125
votes
11answers
22k views

How does an event listener work?

During one of my lectures today about Unity, we discussed updating our player position by checking every frame if the user has a button pushed down. Someone said this was inefficient and we should use ...
125
votes
11answers
19k views

How can I minimize git pain when everybody is working on master?

Our documentation team of about ten people recently moved from SVN to Git. In SVN, everybody worked on master -- a model I've always hated, but I wasn't able to bring about that change. As part of ...
125
votes
14answers
75k views

What is the ideal length of a method for you? [closed]

In object-oriented programming, there is of course no exact rule on the maximum length of a method , but I still found these two quotes somewhat contradicting each other, so I would like to hear what ...
124
votes
15answers
156k views

How is a “Software Developer” different from a “Software Consultant”? What makes a consultant?

I have seen a lot of people claiming themselves to be a "software consultant". These consultants do what a normal software developer does, write code, estimate tasks, fix bugs and attend meetings etc. ...
124
votes
5answers
140k views

Two HTML elements with same id attribute: How bad is it really?

Just browsing the google maps source code. In their header, they have 2 divs with id="search" one contains the other, and also has jstrack="1" attribute. There is a form separating them like so: <...
124
votes
2answers
31k views

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 ...
123
votes
14answers
22k 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 ...
123
votes
36answers
42k views

Programming with ADD/ADHD [closed]

I have diagnosed ADD. Mild but enough to affect my work: Easily distracted Can't concentrate on one project at a time Addicted to the web Procrastination etc. What strategies do you use to ...
123
votes
7answers
43k views

What should you test with unit tests?

I'm freshly out of college, and starting university somewhere next week. We've seen unit tests, but we kinda not used them much; and everyone talks about them, so I figured maybe I should do some. ...
123
votes
6answers
76k views

Difference between a socket and a port

Could someone please explain quite clearly the difference between a port and a socket. I know that a port serves as a door into the network for an application process and that the application process ...
123
votes
13answers
167k views

What is the difference between requirements and specifications? [closed]

I've been tasked with developing requirements and specifications for a project our group is starting. I realized that I don't know the difference; a Google search just confused me more -- it seems ...
123
votes
11answers
103k views

Are there guidelines on how many parameters a function should accept?

I've noticed a few functions I work with have 6 or more parameters, whereas in most libraries I use it is rare to find a function that takes more than 3. Often a lot of these extra parameters are ...
122
votes
21answers
6k views

Is there a way to combat Sales perpetually overcommitting? [closed]

I seem to be repeatedly stuck in a situation where release dates are set not based on anything technical, but because someone in Sales has committed to a customer by then. Based on discussions with ...
122
votes
48answers
26k views

I still can't figure out how to program?

I've read lots of books for various programming languages, Java, Python, C, etc. I understand and know all of the basics of the languages and I understand algorithms and data structures. (Equivalent ...
122
votes
11answers
39k views

Are (database) integration tests bad?

Some people maintain that integration tests are all kinds of bad and wrong - everything must be unit-tested, which means you have to mock dependencies; an option which, for various reasons, I'm not ...
122
votes
7answers
14k 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 ...
122
votes
14answers
17k views

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

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" ...
122
votes
12answers
19k views

Effective Strategies for Localization in .NET [closed]

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 ...
121
votes
27answers
25k views

Is source code generation an anti-pattern?

If something can be generated, then that thing is data, not code. Given that, isn't this whole idea of source code generation a misunderstanding? That is, if there is a code generator for something, ...

15 30 50 per page