This tag is for questions that aren't specific to a programming language or environment.
187
votes
27answers
13k views
How do you know you're writing good code? [duplicate]
Serious question here. I love programming. I've been messing around with code since I was a kid. I never went the professional route, but I have coded several in-house apps for various employers, ...
98
votes
53answers
6k views
Harmful temptations in programming [closed]
Just curious, what kinds of temptations in programming turned out to be really harmful in your projects?
Like when you really feel the urge to do something and you believe it's going to benefit the ...
93
votes
16answers
19k 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 ...
76
votes
21answers
2k views
What is the best way to discern an excellent programmer in a job interview?
In the setting of an interview: What is the best way to reliably identify when somebody is an excellent programmer. By this I mean he is one of those that is 10-15 times more efficient / rapid / ...
72
votes
38answers
6k views
What programming skills have provided you the best return on investment? [closed]
What are the things that took you only a little time to learn, but had a big payoff? And how long did it take to learn enough before the they began to pay off?
For instance, I’m not a master of ...
69
votes
10answers
4k 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 ...
67
votes
16answers
4k views
What is the/Is there a right way to tell management that our code sucks?
Our code is bad. It might not have always been considered bad, but it is bad and is only going downhill. I started fresh out of college less than a year ago, and many of the things in our code puzzle ...
53
votes
17answers
3k views
How to deal with tautology in comments?
Sometimes I find myself in situations when the part of code that I am writing is (or seems to be) so self-evident that its name would be basically repeated as a comment:
class Example
{
/// ...
52
votes
12answers
3k views
Why don't we store the syntax tree instead of the source code?
We have a lot of programming languages. Every language is parsed and syntax checked before being translated into code so an abstract syntax tree (AST) is built.
We have this abstract syntax tree, why ...
49
votes
17answers
3k views
How to train yourself to avoid writing “clever” code?
Do you know that feeling when you just need to show off that new trick with Expressions or generalize three different procedures? This does not have to be on Architecture Astronaut scale and in fact ...
42
votes
21answers
4k views
Is it true that once you learn one language most of the rest come easy?
I was told by someone that I should start with Python and then, once I'm fluent in Python, the rest of the languages will be learned quickly. Is there any truth to this?
41
votes
24answers
4k views
Most common “Y2K-style” bugs today? [closed]
I don't specifically mean date-related issues like 2038, but more generally, bugs that fit the pattern:
A generation ago, programmers tended to write code that ass-u-me-d X, which was reasonable at ...
41
votes
40answers
4k views
Is anything in programming truly evil? [closed]
So, there are a bunch of questions appearing asking is X evil, is Y evil.
My view is that there are no language constructs, algorithms or whatever which are evil, just ones which are badly used. ...
41
votes
4answers
2k views
What should I do to be language-agnostic?
By now I work with asp.net and C#. I have done a decent work in Java as well. I am planning my career in such a way I should be language-agnostic someday. What are the things that I need to learn?
...
37
votes
13answers
4k views
Is it bad interview practice to have candidates write a linked-list implementation?
Reading this site and SO I've seen many stories of interview questions and answers saying a candidate had to implement a linked list from scratch. Usually this is a "gimme" exercise for programming ...
37
votes
7answers
750 views
Is it a bad sign that I am often redesigning as I develop a project?
When I first started programming, I assumed that I would one day get to the point where I would start a project by sitting down and sketching a UML diagram of all the classes, then pretty much stick ...
36
votes
17answers
3k views
Why Use !boolean_variable Over boolean_variable == false
A comment on this question: Calling A Method that returns a boolean value inside a conditional statement says that you should use !boolean instead of boolean == false when testing conditions. Why? To ...
34
votes
11answers
2k views
Is there ever a reason to do all an object's work in a constructor?
Let me preface this by saying this is not my code nor my coworkers' code. Years ago when our company was smaller, we had some projects we needed done that we did not have the capacity for, so they ...
32
votes
15answers
3k views
Is it bad practice to name an unused variable with a single underscore?
Often when the syntax of the language requires me to name a variable that is never used, I'll name it _.
In my mind, this reduces clutter and lets me focus on the meaningful variables in the code. I ...
31
votes
9answers
2k views
What should be allowed inside getters and setters?
I got into an interesting internet argument about getter and setter methods and encapsulation. Someone said that all they should do is an assignment (setters) or a variable access (getters) to keep ...
30
votes
15answers
3k views
Why use other number bases when programming
My coworkers and I have been bending our minds to figuring out why anyone would go out of their way to program numbers in a base other than base 10.
I suggested that perhaps you could optimize longer ...
30
votes
27answers
4k views
Can someone find a job as a programmer without an education? [closed]
Interested in knowing from the more experienced ones if someone can find a job as a programmer without even a highschool degree. Consider the said person to be an average programmer. Would someone ...
30
votes
13answers
1k views
Problems (such as maintenance) in development with unpopular language
I'm developing some application with clojure(lisp) alone in my team. It starts as small application. No problem. But as it's having features and extending the area, it's becoming important program.
I ...
27
votes
10answers
3k views
Why is it impossible to produce truly random numbers?
I was trying to solve a hobby problem that required generating a million random numbers. But I quickly realized, it is becoming difficult to make them unique. I picked up Algorithm Design Manual to ...
27
votes
15answers
331 views
Staying Relevant As a Programmer
I am interested in hearing how various people remain in the Software Engineering industry for so long in their careers. I am at a crossroads myself as I have worked with Network Engineering, ...
27
votes
11answers
2k views
Should a server “be lenient” in what it accepts and “discard faulty input silently”?
I was under the impression that by now everyone agrees this maxim was a mistake. But I recently saw this answer which has a "be lenient" comment upvoted 137 times (as of today).
In my opinion, the ...
27
votes
4answers
2k views
Which algorithms/data structures should I “recognize” and know by name? [closed]
I'd like to consider myself a fairly experienced programmer. I've been programming for over 5 years now. My weak point though is terminology. I'm self-taught, so while I know how to program, I don't ...
26
votes
10answers
1k views
Reaching Intermediate Programming Status
I am a software engineer that's had positions programming in VBA (though I dare not consider that 'real' experience, as it was trial and error!), Perl w/ CGI, C#, and ASP.NET. The latter two are ...
26
votes
9answers
716 views
Data migration - dangerous or essential?
The software development department of my company is facing with the problem
that data migrations are considered as potentially dangerous, especially for my managers.
The background is that our ...
25
votes
11answers
2k views
Maintenance wise, is `else while` without intervening braces considered safe?
Is else while without intervening braces considered "safe" maintenance wise?
Writing if-else code without braces like below...
if (blah)
foo();
else
bar();
...carries a risk because the ...
25
votes
9answers
961 views
Scientific evidence that supports using long variable names instead of abbreviations?
Is there any scientific evidence that the human brain can read and understand fully written variable names better/faster than abbreviated ones?
Like
PersistenceManager persistenceManager;
in ...
24
votes
3answers
821 views
Are static classes with static methods considered SOLID?
SOLID includes the Liskov substitution princicple
which has the notion that “objects in a program should be replaceable with instances of their subtypes without altering the correctness of that ...
22
votes
12answers
2k views
Techniques for getting off the ground in any language
When I start learning a new language, I have a couple of simple implementations that I like to complete to familiarise myself with the language. Currently, I write:
Fibonacci and/or factorial to get ...
22
votes
7answers
997 views
Pattern for a class that does only one thing
Let's say I have a procedure that does stuff:
void doStuff(initalParams) {
...
}
Now I discover that "doing stuff" is quite a compex operation. The procedure becomes large, I split it up into ...
22
votes
6answers
937 views
What are the arguments against parsing the Cthulhu way?
I have been assigned the task of implementing a Domain Specific Language for a tool that may become quite important for the company. The language is simple but not trivial, it already allows nested ...
21
votes
7answers
2k views
What does it mean that “language A is written in language B”?
I often hear the term that language A is written in language B. For example, PHP has been written C, C# is written in C++.
Can someone please explain what does that mean and if it is even correct? ...
21
votes
6answers
1k views
C programming in 2011
Many moons ago I cut C code for a living, primarily while maintaining a POP3 server that supported a wide range of OSs (Linux, *BSD, HPUX, VMS ...).
I'm planning to polish the rust off my C skills ...
20
votes
6answers
1k views
How can I say that programming language compiles to other languages?
How can I say in english, that programming language can be compiled to other programming languages?
The example can be Haxe. On the website the language is decribed as "Multiplatform":
...
20
votes
8answers
1k views
Should comments say WHY the program is doing what it is doing? (opinion on a dictum by the inventor of Forth)
The often provocative Chuck Moore (inventor of the Forth language) gave the following advice (paraphrasing):
"Use comments sparingly. Programs are self-documenting, with a
modicum of help from ...
20
votes
14answers
878 views
How managers choose programming languages
It's not a secret to anyone that managers can and often will impose the programming language that will be used for a project.
Being a programmer myself, I have never been able to understand this.
...
20
votes
5answers
904 views
Beginner's guide to writing comments?
Is there a definitive guide to writing code comments, aimed at budding developers?
Ideally, it would cover when comments should (and should not) be used, and what comments should contain.
This ...
20
votes
3answers
1k views
Can you use Pi as a crude random number generator?
I recently saw this question over at math.SE. It got me thinking. Could Pi be used as a crude random number generator? I mean the results are well known(how long has pi been computed to now?) but, Pi ...
19
votes
11answers
787 views
How To Explain To My Dad What I have Programmed [duplicate]
Possible Duplicate:
My Dad is impatient with the pace of my learning to program. What do I do?
I am 14 and have been studying programming for 4 months now (3 months Python, 1 Month of ...
18
votes
14answers
2k views
Is slower performance of programming languages, really, a bad thing? [closed]
Here's how I see it.
There's machine code and it's all that computers needs in order to run something. Computers don't care about programming languages. It doesn't matter to them whether the machine ...
18
votes
8answers
1k views
Should laying out a GUI graphically be considered “cheating?”
I have a friend who has a slightly greater amount of programming experience as me. We were talking about all the different programming technologies we use and Interface Builder came up in ...
18
votes
8answers
1k views
Is the average number of bugs per loc the same for different programming languages?
I have been told that the average number of bugs/defects per line of code is "constant" for different programming languages. 10 KLOC of Ruby would have the same number of bugs as 10 KLOC of c++. The ...
18
votes
1answer
379 views
Good keyboard layouts for a disabled programmer [closed]
I am specifically asking a question of what key layout might help a handicapped programmer work through their day with less fatigue (though solutions for regular people are useful too).
I am a ...
17
votes
14answers
1k views
What Impact Do Scripting Languages Have on Junior Programmers?
I had a discussion with one of my teachers the other day.
We debated the impact that simpler scripting languages (like Python or Ruby) have on junior programmers.
He argued that scripting ...
17
votes
8answers
546 views
How do “You Ain't Gonna Need it” and “Now is better than never” play together?
I often find myself embracing "now is better than never" when I'm advancing the DRYness of a design. Typically, I find that I need to cultivate an understanding of the One Authoritative Location for ...
17
votes
8answers
6k views
Chromebook - is it interesting for Programmers?
Google announced the chromebook yesterday (11 May 2011). While this is surely a nice thing, I have no clue whether it was interesting to buy one for a (non-javascript)-programmer.
What do you think? ...