the user to confirm the readability of the file
{
echo "The program has an exception during the run:". $e->getmessage (). \\n ";
echo "Please confirm the readability of the file. ";
}
catch (Exception $e)
{
echo "[Unknown exception]";
echo "Exception information:". $e->getmessage (). " \\n "; Returns user-defined exception information
echo "Exception code:". $e->getcode (). " \\n "; Returns the user-define
PHP coding specifications 21 Introduction nbsp; in order to better improve development efficiency and ensure development effectiveness and rationality, this specification is formulated to maximize code readability and reusability. This specification includes PHP coding specification for PHP Development 2
1 Introduction
This specification is formulated to better improve development efficiency, ensure development effectiveness and rationality, and max
Software Catalog Structure specificationWhy design a directory structure?The design project directory structure, like code coding style, belongs to the personal style problem. There are always two approaches to this style of regulation:
One class of students believes that this personal style problem is "irrelevant". The reason is that the program work is good, the style problem is not a problem at all.
Another class of students think that standardization can better control procedure
parameters, you have to change them in multiple methods.
Constant Value is everywhere:It is often found that developers (especially new users) use some constants with clear meanings (mainly devil numbers), but do not assign them appropriate constant variables. This reduces code readability and comprehension.
Fuzzy Method Name:In many cases, the following method names affect the readability and comprehens
What is timeunit?
Timeunit is Java. util. A class in the concurrent package. timeunit provides a thread pause operation with better readability, which is usually used to replace the thread. sleep (), for a long time, the thread's sleep () method is used as the standard way to suspend a thread. Almost all Java programmers are familiar with it, in fact, the sleep method is also very common and appears in many interviews. If you have used thread. slee
value. Everyone mayIf you are familiar with BMP files, take it as an example. Its header is a fixed-length file header, the first two bytes.The record file is in BMP format. The next 8 bytes are used to record the file length, and the next 4 bytes are used to recordThe length of the bmp file header... We can see that the encoding is based on the value (not long, 2, 4,8-byte long value), so BMP is a binary file.
Ii. Access to text files and binary files
What is the process of opening a file usin
In JDBC applications, if you are already a relatively level developer, you should always replace Statement with PreparedStatement. That is to say, do not use Statement at any time.For the following reasons:I. code readability and maintainability.Although the use of PreparedStatement instead of Statement will lead to several more lines of code, such code is much higher than the use of Statement code in terms of rea
Translation: http://net.tutsplus.com/tutorials/html-css-techniques/top-15-best-practices-for-writing-super-readable-code/
Jiang Yujie (reprinted please indicate the source-http://blog.csdn.net/hfahe)
Twice in January, we review the favorite articles in Nettuts's history.Code readability is a common topic in the computer programming world. It is the first thing we learn as developers. This article describes the fifteen most important best practices for
branch commands (the cache of branch commands) within the CPU, so Static branch prediction does not have much meaning. If the branch is meaningful, it means that any branch will be executed, so under certain circumstances, the static branch prediction results are not very good, in addition, likely/unlikely has a great impact on the Code (affecting readability), so this method is generally not recommended.
4) Data prefetch (Data prefetch), recommendat
is a creation mode, also called the staticfactory method mode, but not one of the 23 gof design modes. The simple factory mode is determined by a factory object to create a product instance.Scenario: In the customer code, you need to create different objects according to different situations.In this case, a large number of IF... else... are used to determine whether different conditions are used to create different objects.Is this good? Obviously not good. If you need to select a lot of objects
EntrepreneursGuo Yu: Based on the encoding capability, it can be divided into five types.
1. Beibei type
The Beibei contestants are the legendary "Code copywriters" who have little idea about implementing functions. What they do is to copy fragments from the code written by the Internet or other team members, put it in the project. If the expected result is displayed in the running project, the task is completed. Such people only change the code, but do not write the code. Most of them are not i
lower.
Of course, if the logic is as simple as the above Code, there is no problem in using the evensquarefast implementation method. In fact, we do not have to force that all steps are fully merged (that is, only one loop is used) or completely separated. We can seek a balance between readability and performance. For example, it is more appropriate to use two cycles in five steps.
Speaking of "decomposition loop", this is actually similar to one
Prototype
IntSelect (IntNFDs,Fd_set *Readfds,Fd_set *Writefds,Fd_set *Exceptfds,Const struct timeval *Timeout);
NFDs: this parameter is ignored and only works for compatibility.Readfds: (optional) pointer pointing to a set of interfaces waiting for readability check.Writefds: (optional) pointer pointing to a set of interfaces waiting for writable checks.Required TFDs: (optional) pointer pointing to a set of interfaces waiting for error checks.Timeout:
1. Single Responsibility Principle (SRP)
Original Definition: There shoshould never be more than one reason for a class to change.
BOTH: there should be and only one reason for class changes.
Benefits of a single responsibility:
1. The complexity of classes is reduced, and all responsibilities are clearly defined;
2. improved readability, reduced complexity, and improved readability;
3. Enhanced
in a subroutine called popstack. Hiding such information is better than hiding it in the system.
F. Hide pointer operations
Pointer operations are generally poorly readable and error-prone. By isolating these operations within the subroutine, you can focus on the intent of the operation, rather than the details of the pointer operation. At the same time, if such and all can be completed in one location, you will be more confident about the correctness of the Code. If you find a data type that
programmers, in PHP programming, we can give full play to the advantages of object-oriented language and encapsulate the objects in programming. In the previous code, we used an object-oriented method. For example, when managing a database, we encapsulated the query () function into the database class, which greatly facilitates code management, added the readability of the program.3. Pursuing program speed, not programming speedDuring website constru
only consist of lower-case letters and underscores. It is recommended that you use descriptive variables. The more detailed the variable, the better, so that $ I or $ n is not encouraged.15. The constant and define constants in the global range in the class can only consist of uppercase letters and underscores. Each word is separated by an underscore.16. Both boolean and null values are in lower case.
Iii. Encoding Style
1. php code must be fully bounded (2. When a string is composed of plain t
of lower-case letters and underscores. It is recommended that you use descriptive variables. The more detailed the variable, the better, so that $ I or $ n is not encouraged.15. The constant and define constants in the global range in the class can only consist of uppercase letters and underscores. Each word is separated by an underscore.16. Both boolean and null values are in lower case.
Iii. Encoding Style
1. php code must be bounded in the complete form (
), That is, do not use php short la
, although enumeration must be compatible with a certain integer, the C standard does not specify the type of integer.
Be careful when repackaging the struct, the enumerated variables are usually int, which is related to the compiler; but they may also be short, long, or even char by default. Your compiler may have progma or command line options to specify the enumerated size.
Long double is a similar fault point. Some C platforms implement it with 80 bits, some are 128 bits, and some 80 bits fi
9 standard best practices for front-end code: CSS and css
Front-end engineers pay high attention to writing standard front-end code. These best standard practices are not published by the authoritative organization, but are summarized by a large number of front-end engineers in their experience in the practice process to improve code readability, maintainability, and performance. Next, let's talk about some standard practices of CSS code in the previo
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.