language-agnostic

Your criteria in using a new technology or programming language

What are your criteria or things that you consider when you are an early adopter of a programming language or technology? Two of the most common explanations I've heard are: It should be "fun" (what I've heard from technical people). It should be capable of solving our problem (what I've heard from business people). So what's yours?...

How to ask programming questions "correctly"

I would like to know what is your style when you want to get quality answers from experts. Normally, my stumbling blocks are the following: My co-workers are either being sarcastic in giving their answers and their body language and vibe shows that the answer is pretty obvious or trivial to them. (This happens when I ask for their opi...

"Proper" way to give clients or managers a reality check on software estimates

Looking back at my past projects I often encounter this one: A client or a manager presents a task to me and asks for an estimate. I give an estimate say 24 hours. They also ask a business analyst and from what I've heard their experience is mostly non-technical. They give an estimate say 16 hours. In the end, they would consider th...

When is it OK for an abstract base class to have (non-static) data members?

I guess the question title sums it up. Is there a time when it would be considered good design for an ABC to have data members? I have been wondering if there is a situation where this is OK. The only ones I can come up with all are static, and even then it's kind of a stretch. ...

Fast algorithm for finding next smallest and largest number in a set

I have a set of positive numbers. Given a number not in the set, I want to find the next smallest and next largest numbers that are in the set. The only way I can think to do it now is to find the next smallest by decreasing by 1 until I find a number in the set, and then do the same for finding the next largest. Motivation: I have a bu...

Maintaining code that is close to software rot

Let's say you're the lucky programmer who inherited a code that is close to software rot. Software rot as defined in Pragmatic Programmer is code that is too ugly (in this case, unrefactored code) it is compared to a broken window that no one wants to fix it and in turn can damage a house and can cause criminals to thrive in that city....

How to convince team other parts of software development are important?

Sometimes, when I present a part of the software development process to certain people, say the supervisor or the manager that they don't have experience say Automated unit tests and integration tests vs. their manual functional testing. Using code generators, and scripts for repetitive tasks. I sometimes met with resistance. Some o...

Consequences of doing "good enough" software

Does doing "good enough" software take anything from you being a programmer? Here are my thoughts on this: Well Joel Spolsky from JoelOnSoftware says that programmers gets bored because they do "good enough" (software that satisfies the requirements even though they are not that optimized). I agree, because people like to do things th...

Do you still limit line length in code?

This is a matter on which I would like to gauge the opinion of the community: Do you still limit the length of lines of code to a fixed maximum? This was certainly a convention of the past for many languages; one would typically cap the number of characters per line to a value such as 80 (and more recnetly 100 or 120 I believe). As far ...

Is there any programming language that accept this?

Suppose I have a class like this, in pseudo-code: public class someClass { public void doSomething() { someClass aux = new someClass(); // here something is done to alter the internal structures of aux . . this = aux; } } The attribution "this = aux", would return an error since it's no...

How do I write a desktop application that syncs with the iPhone?

For example, how would I write a program like senuti? Are there any libraries I can use for this? It would be ideal if I could do this in Python or .Net, but I'm open to other things as well. ...

Should I use special Unicode characters for punctuation marks such as ellipsis in programs?

Unicode has a set of characters for punctuation such as ellipsis (…), En-Dash (–) and others. It's believed that using these characters improves typography and therefore visual appearance of the texts. Many development tools, Visual Studio included, support Unicode and so I could easily make use of these characters in programs resources...

Implementation of excel's ROUND function

How would you implement a ROUND function: ROUND(value, number of digits) pi=3.14159265358979323 so, for example, ROUND(pi, 3) = 3.142 if you had these functions at your disposal: AINT - truncates a value to a whole number ANINT - calculates the nearest whole number NINT - returns the nearest integer to the argument or never minding...

What is the advantage of having this/self pointer mandatory explicit?

What is the advantage of having this/self/me pointer mandatory explicit? According to OOP theory a method is supposed to operate mainly (only?) on member variables and method's arguments. Following this, it should be easier to refer to member variables than to external (from the object's side of view) variables... Explicit this makes it...

Required reading for a soon-to-be web developer

I am about to start working with web development after doing (non-web) server and client development for about ten years. I'm not looking for info on any particular framework, library or about TCP/IP. What I am looking for is reading (dead tree or online) that will help me understand the different challenges and terminology that is ne...

What is Cyclomatic Complexity?

A term that I see every now and then is "Cyclomatic Complexity". Here on SO I saw some Questions about "how to calculate the CC of Language X" or "How do I do Y with the minimum amount of CC", but I'm not sure I really understand what it is. On the NDepend Website, I saw an explanation that basically says "The number of decisions in a m...

How to encourage new programmers to read documentation?

New developers seem to have a hard time reading documentation. They either skip it entirely, or if they do read it they don't read it carefully. Conversely, I've never met a skilled developer who doesn't regularly and thoroughly inspect framework and API documentation. Even here on Stack Overflow, a good percentage of questions are re...

Throw Exceptions with custom stack trace.

Is it possible to throw an exception (could be any exception) with a customized stack trace? As a concrete example: lets say I have a set of some small static utility methods which might throw exceptions. However I would like the exception to appear to have originated from the previous method instead of the utility method (I want to ign...

Good introductory text on static analysis for bug finding?

I'm looking for a good introductory text on the theory of static analysis for bug finding. Any recommendations? ...

Has anyone solved a programming puzzle similar to this?

"Suppose you want to build a solid panel out of rows of 4×1 and 6×1 Lego blocks. For structural strength, the spaces between the blocks must never line up in adjacent rows. As an example, the 18×3 panel shown below is not acceptable, because the spaces between the blocks in the top two rows line up. There are 2 ways to build a 10×1 pane...