10 Big programming language features that are confusing to programmers--other integrated

Source: Internet
Author: User
Tags exception handling

Each language has its own uniqueness, or peculiar syntax, or uncommon functions, or non-standard ways of execution. Therefore, regardless of the new ding or veteran, looking at a certain feature will suddenly be drunk. The 10 "singular" features that are often mentioned are summarized in the paper.

1. Javascript: + is a connector

Problem Description:

In JS, the + number is used in the number, can be used as a general addition, but if you encounter a character, but also as a character connector. For example: The result of ' 1 ' + 1 is 11.

Genetic analysis:

The fundamental reason is that JS belongs to a weak type language. Python, for example, uses the + number as the character connector, but because it is a strongly typed language, once a character is added to an integer, it prompts for a wrong action.

The views of netizens:

"The problem is that this is an unpredictable, mandatory, silent conversion that can easily be ignored." "Anonymous

"JS should be thrown for exception handling in this case. "Crgwbr

"Using + for character concatenation is a nightmare. "Matteo Riva

2. Perl: module must return a true value

Problem Description:

In most cases, the Perl module must end with a 1 statement, or the system will complain if the last statement's return value is not true.

Genetic analysis:

The Perl module contains the initial code and subroutines. When a module file is loaded, Perl determines whether the code executed successfully, based on whether or not to return true. Even without the initial code, Perl expects the final statement to return true, or it will complain.

The views of netizens:

"This usually makes me feel uneasy. "Drew Hall

"This is the most worthless use of it. "Schwern

3. C + +: Three Letter word usage

Problem Description:

For example, the system sees??! will automatically turn it into |, see?? (will be converted to [. This can cause unexpected results and greatly reduce the readability of your code.

Genetic analysis:

In the early stages of programming, certain special characters, such as curly braces, cannot be typed directly on the keyboard. Therefore, this indirect method is used.

The views of netizens:

"Learned like Google, also must not understand what is??!??!" Isaac

"Since 1977, with three-letter words, C has become obscure and difficult to understand." "Martin Beckett

4. PHP: Case Sensitive processing

Problem Description:

The case of PHP is confusing, some places distinguish, some places do not distinguish. For example: variable name, constant name distinction; function name, method name, class name is not distinguished.

Genetic analysis:

It is likely that PHP has evolved from a set of CGI scripts into a sophisticated programming language.

The views of netizens:

"This is why PHP programmers are accustomed to using underscores for function naming, not the reason for adopting the hump nomenclature." "Paperstreet7

"In PHP, everything is possible!" "Grzechooo

5. ruby:0 as Truth value

Problem Description:

In Ruby, a value of 0 equals a value of true. This is a nightmare for programmers with a c,python base.

Genetic analysis:

Only the Boolean value false and nil are equivalent to false, and the rest are equal to true. 0 and 1,2,3 will be treated the same.

The views of netizens:

"This is downright maddening, although the original intention was well-intentioned," he said. "Chris Lutz

"0==true! My C-language head is freaking out! "Kenny

6. Python: Hierarchical division by number of spaces

Problem Description:

Unlike the use of keywords or punctuation characters, the indentation hierarchy is used in py to define the position of each line of code. Incorrect number of spaces (or inconsistencies in space and number of transposition characters) can cause a program to complain.

Genetic analysis:

The intention of the Py author is to want the code to be more readable, to reduce unnecessary input, and to expect the programmer to assume responsibility for maintaining the clarity of the code.

The views of netizens:

"To be honest, this is the root cause of my distance to py." "Wazoox

"If we really need a similar mandatory mechanism, we are not really lazy!" "Joris Meys

7. C: Array indexing working mode is equivalent to pointer

Problem Description:

In C, A[i] and I[a] are interchangeable, and the same results can be found in all two of them.

Genetic analysis:

In C, for a block of memory, the array is no different from the pointer, that is to say:

A[i] = * (A + i) = * (i + a) =i[a].

The views of netizens:

"In the C-Language Chaos Code competition, this is worthless." "Confusion

"I think this is exposing the core of C language, pointers and dealing more directly with memory." "Michael Neale

8. Perl ' s: predefined variables

Problem Description:

Perl has a very long and very long list of special variables, the names of which are very complex (despite the corresponding long English words). So, unless you're a senior Perl developer, it's often a matter of flipping through Perl documents.

Genetic analysis:

These variables have different meanings, for example: Process ID ($$), error message ($@), regular expression matching ($^r).

The views of netizens:

"Very annoying!" "Matrixfrog

"It might be the gospel for a thin developer. "Nixar

"The problem with these variables is: Can't find it through Google!" "Malvim

9. JavaScript: Automatic semicolon insertion

Problem Description:

JS uses semicolons as a sign to end the statement, and inserts itself, even if the code breaks. So it often leads to errors.

Genetic analysis:

The intention of automation is to bring convenience, especially for beginners.

The views of netizens:

"If we design the character of the language, we always think of the user as a fool, it will be a problem." "Rob Van Dam

"Automatic semicolon insertion is one of the most frustrating places in JS. "Fennec

Java: Automatic boxing (autoboxing) and integer caching

Problem Description:

Java automatically turns the underlying type data into objects (automatic boxing), such as converting an int to an integer object. At the same time, the cached integer object takes a value of-128 to 127. In this case, the problem occurs when using = = to compare two identical integer objects (in-128 and 127 is true and the rest is false)

Genetic analysis:

The automatic boxing mechanism reduces the amount of code input, while the integer cache increases processing speed.

The views of netizens:

"Luckily I'm just a C # programmer. "Would

"This is not a mistake, but it gives us a reason to use the original type (such as: Booleans) for digital processing." "Raviwallau

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.