Article Title: Develop a good Linux coding style. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
The Linux operating system is an open-source operating system. For this reason, you have developed a tool software on the Linux system, including the source code, which may
capitalized (INITIALCAP), the other function name, all the first letter lowercase.10. Self-increment and decrement operatorsThe increment (+ +) and decrement (-) operators, placed before or after a variable, return a different value and are prone to errors.In fact, all the + + operators can be replaced with "+ = 1".++xEquivalent tox + = 1;The code becomes clearer. There is a ridiculous example where the following fragment appears in the source code of a JavaScript library:++x;++x;The programmer
member variable: Need to use GET, set method read, setting9.2. Important or repetitive expressions or methods should be extracted.9.2. Exception handling: Do not ignore any exception information. If you want to track more advanced exceptions, do not ignore the lower level exception information.9.3. Release resources: If you need to release resources, you need to put them in a finally block.Other references:Http://www.oracle.com/technetwork/java/codeconvtoc-136057.htmlhttp://www.infoq.com/news/2
The Linux operating system is an Open-source operating system that you develop on a Linux system, including source code, which may be needed by other system administrators. To do this, you need to follow certain rules when writing code. This is not only for the convenience of others to read, but also for their own maintenance and upgrade considerations. Specifically, the author believes that the Linux system administrator to develop some of the following good
, for example:#include int g; Double h; int foo (void) { → statement list}int bar (int a) { → statement list} int Main (void) { → statement list}6, a function of the statement list if it is long, you can also be divided into groups according to the correlation, separated by a blank line. This rule is not strictly required, usually the definition of a variable to form a group, followed by a blank line, the return statement before the blank line, for example:int Main (void) {
++, because i++ produces intermediate variables in memoryelse if (arg1[i] = = Arg2[j])//The value of the expression being present, and the value of I. And ++i only exists the value of I, which isreturn true; The value of I is the value of an expression.Else++j;}return false;}Else{cout Exit (0);}}int main (void){int Arg1[max] = {1, 4, 6, 7, 8, 9, 10};int Arg2[max] = {2, 3, 5, 12, 23, 44, 55};if (MyComp (Arg1, arg2))//The return value here is bool, the return value can implement a chain expression
time-Read the code without looking at the function declaration for I/O at a glanceThe above is still a high degree of readability, but also can quickly locate the issue of compile time.Of course, it is difficult and unnecessary to consider these details in actual team development, but it is possible to understand the tastes and logic of a person. The quality of the code is really not particularly related to the success or failure of the product and the company, but as an engineer, we should pur
---------------------------------
Linux Kernel encoding Style
---------------------------------
This short document describes the encoding style used in Linux kernel programming. The encoding style is very personal, so I don't want to impose my opinion on anyone, but at least these rules must be followed in the code I maintain. Of course, I also strongly recomme
A programmer's good qualities can be seen in his code style.The official Python Developer's Guide, PEP8, lists style guides for Python Code.Excerpts from the Python ' s tutorial are listed.1. Indent with 4 spaces instead of the TAB key.2. Make each line not more than 79 characters, the purpose is small screen user also can read very well.3. Use an empty line to separate functions, classes, and functions from the large blocks of code.4. If possible, wr
), when using abstract and finalization (final) to make class declarations, they must be placed before the visibility declaration (public or protected or private). When static is used to make a class declaration, it must be placed behind the visibility declaration.Directly on the code:3. Control StructureThe control interface is the if else while switch. This type of code is often prone to problems, but also to standardize.(1), if,elseif,else writing, directly on the code bar:(2), switch,case no
marked on the MAC software are considered not to be retained by the class.When an instance variable points to corefoundation, C + +, or other non-objective-c objects, you need to use __strong and __ Regardless of whether the pointer is retained. The weak type modifier is explicitly specified. Corefoundation and other non-OBJECTIVE-C object pointers require explicit memory management, even if an automatic reference count or garbage collection mechanism is used. When the __weak type modifier is
. Since I have set the operation as a high-level concept, more work can be done freely at the underlying runtime.
For imperative objects, developers often consider using reusable classes because their language encourages classes as building blocks. Function programming languages tend to reuse functions. Functional Languages construct complex general functions (suchfilter(),map()Andreduce()) And can be customized by functions provided as parameters. In functional languages, it is common to conver
to what extent is the brush problem enough? won't the question be said directly? Why do the questions come up or are they always hanging? think interviewers are always embarrassing you? you never know what dynamic planning is? how to properly ride a donkey to find a horse? What is the right coding Style? How should I communicate with the interviewer during the interview? this Sunday, nine chapters algorithm
Original: Based on the HTML5 bootstrap building background templates, pagination, fuzzy query has all JS implementation, no coding, embedded data can be developed, built-in 8 skin, European and American style, very easy to use!Source code: Http://www.zuidaima.com/share/1550463575788544.htmPaging, query function has all been implemented with JS, no need to do such code writing, embedded data can, really beau
Java Coding Style:1. Factory method should be stateless.State normally refers to the member variables of class. Stateless, more precisely, it means immutable.Factory was just to create objects, and one call should not affect anothers, if it was mutable, then the method call Mnight The chance to the States.And then it would affect other calls which is not supposed to happen.2.Restrict the access level of any
the object by value, it should be passed with "Const ", saving the construction and destruction process of temporary object, and improving the efficiency.16, the function body size to be small, as far as possible to control within 50 lines, the function of low coupling convenient call17. Using assertions, assert only works in the debug version of VS, helping us to find out why the error occurred, using assertions to make explicit comments18, after malloc or new application memory, should immedi
JavaScript specification for front-end coding style specifications and front-end javascriptJavaScript specification global namespace pollution and IIFE
Always wrap the code into an IIFE (Immediately-Invoked Function Expression) to create an independent and isolated definition domain. This action prevents global namespace contamination.
IIFE also ensures that your code is not easily modified by the code in o
Delegate modeTipThe delegate object should not be retainThe class that implements the delegate pattern should:
Has an instance variable named Delegate_ to refer to the delegate.
Therefore, accessor methods should be named Delegate and setdelegate:.
Delegate_ objects should not be retain.
Model/view/controller (MVC)TipDetach the model from the view. Detach the controller from the view, model. The callback API uses @protocol.
Detach a model from a view: Do not assum
1. Indents and SpacesWhen writing code, you must be aware of the code's indentation rules:Use 4 spaces as indents without using the tab indentWhen a variable is assigned, a space is left around the equals sign.For a greater degree of effort reduction, it is recommended that you use large IDE management code to maintain code aesthetics.2. Sentence breakCode writing should follow these guidelines:Try to ensure that the program statement line is a sentence.Try not to make one line of code too long,
Indent inThe hierarchy of each row consists of 4 spaces
Length of LineEach line is not more than 80 characters long. If a row exceeds 80 characters, wraps after an operator (comma, plus sign), and the next line increments by 2 indents
Original valueAvoid using special value undefined to determine whether a variable is defined with the TypeOf operator
CommentsA) an exclusive line of comments to explain the next line of code;B) a comment at the end of the code line to explain the code before
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.