All Questions

Filter by
Sorted by
Tagged with
135 votes
14 answers
26k 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 ...
Chris Barry's user avatar
  • 1,479
135 votes
16 answers
50k views

Why do people use C if it is so dangerous?

I am considering learning C. But why do people use C (or C++) if it can be used 'dangerously'? By dangerous, I mean with pointers and other similar stuff. Like the Stack Overflow question Why is ...
Tristan's user avatar
  • 1,285
135 votes
10 answers
104k 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 ...
135 votes
6 answers
147k views

What does it mean when data is scalar?

I don't know what scalar means exactly, but I'm trying to see if I'm thinking about it correctly. Does scalar relate to arbitrariness where the type of data could be any type, or a system is not able ...
Ryan's user avatar
  • 1,479
135 votes
5 answers
83k views

In Java, should I use "final" for parameters and locals even when I don't have to?

Java allows marking variables (fields / locals / parameters) as final, to prevent re-assigning into them. I find it very useful with fields, as it helps me quickly see whether some attributes - or an ...
Oak's user avatar
  • 5,255
135 votes
10 answers
105k views

What is the opposite of initialize (or init)? [closed]

The term will be used as a method name. The method is called when a part of the user interface is hidden (or removed), and it is used to reset values to default and dispose objects that will not be ...
Gabriel Diaconescu's user avatar
134 votes
8 answers
93k views

What does C++ do better than D?

I have recently been learning D and am starting to get some sort of familiarity with the language. I know what it offers, I don't yet know how to use everything, and I don't know much about D idioms ...
Anto's user avatar
  • 11.2k
134 votes
7 answers
21k 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 ...
GladstoneKeep's user avatar
133 votes
19 answers
16k 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 ...
133 votes
13 answers
44k views

(Why) is it important that a unit test not test dependencies?

I understand the value of automated testing and use it wherever the problem is well-specified enough that I can come up with good test cases. I've noticed, though, that some people here and on ...
dsimcha's user avatar
  • 17.2k
133 votes
16 answers
15k 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 ...
133 votes
14 answers
21k 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" ...
M4N's user avatar
  • 1,447
133 votes
6 answers
79k 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 ...
cobie's user avatar
  • 3,237
132 votes
14 answers
21k 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 ...
LoveProgramming's user avatar
132 votes
15 answers
24k 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 ...
JustinLovinger's user avatar
132 votes
17 answers
73k views

How does learning assembly aid in programming? [closed]

I have been programming in higher level languages (Python, C#, VBA, VB.NET) for around 10 years and I have completely zero understanding on what's going on, "under the hood." I am wondering what are ...
132 votes
8 answers
203k views

Difference between '\n' and '\r\n'

Yes yes, I am aware that '\n' writes a newline in UNIX while for Windows there is the two character sequence: '\r\n'. All this is very nice in theory, but my question is why? Why the carriage return ...
sukhbir's user avatar
  • 1,489
132 votes
8 answers
105k views

Is it better to document functions in the header file or the source file?

In languages that distinguish between a "source" and "header" file (mainly C and C++), is it better to document functions in the header file: (pilfered from CCAN) /** * time_now - return the ...
Joey Adams's user avatar
  • 5,585
132 votes
10 answers
66k views

Storing a re-orderable list in a database

I'm working on a wishlist system, where users can add items to their various wishlists, and I plan to allow users to re-order the items later on. I am not really sure about the best way to go about ...
Tom Brunoli's user avatar
  • 1,423
132 votes
8 answers
119k views

Why is trailing whitespace a big deal? [closed]

Trailing whitespace is enough of a problem for programmers that editors like Emacs have special functions that highlight it or get rid of it automatically, and many coding standards require you to ...
EpsilonVector's user avatar
132 votes
7 answers
73k views

Clean Architecture: Use case containing the presenter or returning data?

The Clean Architecture suggests to let a use case interactor call the actual implementation of the presenter (which is injected, following the DIP) to handle the response/display. However, I see ...
swahnee's user avatar
  • 1,455
131 votes
15 answers
29k 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 ...
Austin Day's user avatar
  • 1,361
131 votes
14 answers
11k 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 ...
131 votes
11 answers
33k 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 ...
Adam 's user avatar
  • 1,387
131 votes
7 answers
16k 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 ...
Den's user avatar
  • 4,847
130 votes
45 answers
45k 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
23 answers
32k 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, ...
130 votes
17 answers
30k 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 ...
130 votes
11 answers
38k 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 ...
Pikamander2's user avatar
  • 1,269
130 votes
9 answers
126k views

The difference between "concurrent" and "parallel" execution?

What is the difference between the terms concurrent and parallel execution? I've never quite been able to grasp the distinction. The tag defines concurrency as a manner of running two processes ...
Louis Thibault's user avatar
130 votes
4 answers
197k views

Can I use MIT licence plugins in my commercial web site?

If yes, what precautions should I take?
Harry Joy's user avatar
  • 2,217
130 votes
4 answers
96k views

IPv4 to IPv6. where is IPv5?

As all of us know that after IPv4 it came IPv6. How this transition happened? I just want to know was there any IPv5 also? or there is any other logic in naming this version of IP as IPv6?
Hemant's user avatar
  • 1,483
129 votes
12 answers
31k views

One-line functions that are called only once

Consider a parameterless (edit: not necessarily) function that performs a single line of code, and is called only once in the program (though it is not impossible that it'll be needed again in the ...
deprecated's user avatar
  • 3,297
129 votes
13 answers
124k views

What "version naming convention" do you use? [closed]

Are different version naming conventions suited to different projects? What do you use and why? Personally, I prefer a build number in hexadecimal (e.g 11BCF), this should be incremented very ...
Richard Stelling's user avatar
129 votes
6 answers
147k views

"Standard" format for using a timestamp as part of a filename [closed]

I searched for a standard format for using a date/time as part of a file name and was unable to come up with anything. My question is two parts: Is using time stamps to enforce unique in file names ...
dting's user avatar
  • 1,559
128 votes
14 answers
43k views

Is there any technical reason why, in programming, the default date format is YYYYMMDD and not something else?

Is there any engineering reason why is it like that? I was wondering in the case of a RDBMS that it had something to do with performance, since a "YEAR" is more specific than a "MONTH", for instance: ...
lucaswxp's user avatar
  • 1,387
128 votes
16 answers
29k 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'...
Orca's user avatar
  • 1,109
128 votes
11 answers
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 ...
kmote's user avatar
  • 3,322
128 votes
15 answers
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. Each time a new loop begins the player runs a recursive function that calls itself N times, ...
Tiago Marinho's user avatar
128 votes
10 answers
110k views

Don't Use "Static" in C#?

I submitted an application I wrote to some other architects for code review. One of them almost immediately wrote me back and said "Don't use static. You can't write automated tests with static ...
Infin8Loop's user avatar
  • 1,469
128 votes
6 answers
163k views

Method vs Function vs Procedure

Simple question, but I often hear these three terms defined with such ferocity, but which have been known to me to mean different things over the years. What are the "correct" definitions of "...
Django Reinhardt's user avatar
128 votes
11 answers
89k views

Why use Optional in Java 8+ instead of traditional null pointer checks?

We have recently moved to Java 8. Now, I see applications flooded with Optional objects. Before Java 8 (Style 1) Employee employee = employeeServive.getEmployee(); if(employee!=null){ System....
user3198603's user avatar
  • 1,896
128 votes
2 answers
127k views

What are the difference between an edge case, a corner case, a base case and a boundary case?

I'm not a native English speaker. In my native language I'm aware of some terms used to refer to the condition checked to stop a recursion, and to the condition checked for extreme, unlikely or super-...
Oak's user avatar
  • 5,255
128 votes
11 answers
39k 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 over ...
RichK's user avatar
  • 1,457
127 votes
14 answers
31k views

Why isn't TDD more popular in universities?

Recently, a person here asked a basic question about how to compute in Python all permutations of elements from a list. As for most questions asked by students, I haven't provided the actual source ...
Arseni Mourzenko's user avatar
127 votes
16 answers
135k views

Why is 0 false?

Why does 0 evaluate to false and any other integer value to true is most programming languages? String comparison First of all, it may seem evident to any programmer, but why wouldn't there be a ...
Morwenn's user avatar
  • 1,766
127 votes
16 answers
28k 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 ...
127 votes
16 answers
73k views

Should one check for null if he does not expect null?

Last week, we had a heated argument about handling nulls in our application's service layer. The question is in the .NET context, but it will be the same in Java and many other technologies. The ...
Stilgar's user avatar
  • 1,514
127 votes
15 answers
172k views

How is a "Software Developer" different from a "Software Consultant"? What makes a consultant? [closed]

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. ...
127 votes
11 answers
21k 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 ...
Monica Cellio's user avatar

15 30 50 per page
1
5 6
7
8 9
1273