Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

No matter how much you love a programming language, there are always a few details in it that aren’t quite as nice as they could be.

In this question, I would like to specifically focus on syntax elements. In a programming language that you use frequently (perhaps your favourite programming language, or perhaps the one you are forced to use at work), which syntax element do you find most unreadable, unclear, inconvenient or unpleasant?

share

locked by Yannis Rizos Oct 1 '13 at 10:37

This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not use it as evidence that you can ask similar questions here. This question and its answers are frozen and cannot be changed. More info: help center.

closed as not constructive by Morgan Herlocker, NickC, ChrisF May 26 '11 at 20:37

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

29  
Is "Java" an acceptable answer? –  Nathan Taylor Sep 3 '10 at 1:47
show 6 more comments

36 Answers

REGEX / preg_match() in PHP

Firstly, its completely different syntax than PHP uses. While the preg_match() function emulates regex quite excellently, I have to completely switch my mode of thinking to work with it.

Secondly, its just plain obscurification half the time. I usually have to quite literally take out a scratch pad and figure out WTF its doing half the time.

Besides, I program in PHP, not Perl. If I liked Perl, I would program in Perl. (no, sir I don't like it.)

To make matters worse, with the new PCRE delimiter format, you can practically use any character, which includes having to escape that same nested character, making the pattern even more obscure.

Sure, its great if you want to be cryptic.. or even efficient... but holy hell the amount of time it wastes to normally perform simple tasks.

share
5  
The fact that you have your answer written with PERL in all caps tells me that you've never actually looked into the language at all and don't know anything about it. –  Daenyth Sep 17 '10 at 19:06
show 2 more comments

I know this is an older question, but how come no one mentioned.

CODE NUGGETS

<% %> <-- Regular

<%= %> <-- Buffalo style

<%:%> <-- extra crispy

share
add comment

$this->... in PHP ... unnecessary, looks bad and considerably slows down "quick-grasp-on-short-glance" (my closed thread on SOF).

share
1  
as optional is useful, as mandatory is unnecesary... –  umlcat Mar 15 '11 at 21:23
add comment

SSIS - SQl Server I hate everything about the Expression Builder. I already know how to write these types of conditions in t-sql. Why can't they Expression builder use the same syntax t-SQl would use (especially The equivalent to the CASE statement)? Or let me write t-sql statements instead of creating stupid wierd expressions. And why am I stuck doing complex conditions in a form that only allows me to use one line so I am in scroll bar hell?

share
show 1 more comment

& && | || in C

C++ has rectified it to some extend with explicit "and" "or" keywords. Many a bugs and torn hair could have been avoided in C if logical operations and bitwise operations weren't so hard to differentiate.

share
1  
The and and or keywords are provided by <iso646.h>. #include that your C programs and that's a complete non-issue. C++ is also required to provide the same header. –  greyfade Oct 29 '10 at 18:16
4  
I've never ever had trouble distinguishing the two... –  Carson Myers Dec 7 '10 at 4:13
1  
That's nonsense, it's trivial to remember and optically very different. Using the keyword and is even a bigger nonsense. Without reading the definition, what does and mean? Is it logical or bitwise? People confused by the difference between & and && probably need something like logand and bitand. –  maaartinus Apr 27 '11 at 3:04
add comment

Ternary statements. They are generally much harder to read yet only save a few lines of code.

if (myCondition) {
    return firstAlternative();
}
return secondAlternative();

versus

return myCondition ? firstAlternative() : secondAlternative();
share
1  
Ergh. If you are going to write it longhand, at least use an else. –  Tom Hawtin - tackline Feb 27 '11 at 14:28
4  
Your example saves 3 out of 4 lines of code, i.e. 75%. This means that significantly more code will fit on my screen at a time. I think that is a pretty clear benefit. If you find statements involving the conditional operator “harder to read”, you probably just need to train yourself a bit more, and then you’ll have no trouble with them :) –  Timwi Feb 27 '11 at 16:16
1  
In addition, there is no such thing as a "ternary statement". It's an expression and he who doesn't recognize the difference should go look for another job. –  Ingo Sep 6 '11 at 11:32
show 1 more comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.