This article is about 11 things I've learned over the years as a professional programmer to really improve my code quality and overall productivity.
1. Never copy Code
Avoid duplicate code at any cost. If a commonly used code fragment appears in several different parts of the program, refactor it and put it into one of its own functions. Duplicate code can cause your colleagues to be confused when reading
Lai Yong Hao (http://laiyonghao.com) flexpmd is a good thing I recently found, practice down to think for improvement
Code Quality is very useful, so we recommend it. Flexpmd is an as3 code review tool that helps improve code quality by finding various defects in the Code through static code analysis. PMD is a tool used to analyze Java code errors and learn code
. Compared to a knife flat, more smart and not lose the balance feeling.
Foreign excellent cases we have seen a lot, however, Chinese apps in visual design, often with the Western apps can not be compared. For a variety of reasons-such as the font of the mishap, even if the dots than the original less than many, such helplessness to the Chinese apps designers have a lot of trouble. But the Jiangshan generation has talent, and let us also pay attention to the side, summed up in recen
!!!1. Calculate the unit test time when estimating and making the project plan2. Write unit test code before developmentWhen the house is built, the workers ' master walls will first be put on the line with a stake, so that the bricks can be erected straight, because the base bricks are based on this line. TDD is like this, first write the test code, just like the worker's master first pull the line with a stake, and then code the time to use this as a benchmark, write only the function code tha
Php code quality is greatly improved. For more information, see
1. do not use relative pathsWe often see:
Require_once ('../lib/some_class.php ');
This method has many disadvantages:
It first looks for the specified php inclusion path and then finds the current directory.
Therefore, excessive paths are checked.
If the script is included by another script, its basic directory is changed to the directory where another script is located.
Another problem
157 suggestions for writing high-quality code to improve C # programs [correct string operations, use default transformation methods, but do not treat forced conversions with as and is],
Preface
This document describes the first three suggestions.
1. Correct string operations
Suggestion 2. Use the default Transformation Method
Suggestion 3. differentiate between forced conversion and as and is
There are a l
157 suggestions for writing high-quality code to improve C # programs-recommendation 39: understand the essence of delegation,
Suggestion 39: understand the essence of delegation
To understand the delegation in C #, two key points need to be grasped:
1) delegate is a method pointer.
2) A delegate is a class. when instantiating it, you must use the referenced method as its constructor parameter.
Imagine this
["8" = "low per capita price priority"; m_sortpref["9" = "per capita price high priority";}This is the data that a helper method uses to initialize our filter.void Query::run (Sc::searchreplyproxy const Reply) {qdebug () We create a filter from the code above, and we can get the value of the filter that the user chooses, and the member variableM_prefInQString Query::getdepturl (QString dept) { qmapIn the code above, we take advantage of m_pref and make it part of the API request.This allow
It is very easy to teach to improve the quality of php code by 36. 1. do not use relative paths. you will often see: require_once (... libsome_class.php). This method has many disadvantages: it first looks for the specified php inclusion path and then finds the current directory.
1. do not use relative pathsWe often see:
Require_once ('../lib/some_class.php ');
This method has many disadvantages:
It first l
processing
Residue is an optional parameter. If this parameter is not used, you can set it to null or use Preprocessor to control it.
The key to the problem is to process the relationship between input and echo,That is to say, the latency between the captured signal and the playback signal must be small enough to improve the efficiency.
Writetosndcard (echo_frame, frame_size)Readfromsndcard (input_frame, frame_size)Speex_echo_cancel (echo_state
1. Use strings in ways that reduce performance overheadThe str1+9 completes a boxing behavior at run time, and 9.ToString () does not have a boxing behaviorStringBuilder to compensate for string boxing, but because StringBuilder does not have a defined length, the default allocation length is 16, and when the length is greater than 16 o'clock, new allocations are made. Suitable for applications where memory does not need to be allocated frequently.StringBuilder sb = new StringBuilder (a);Sb. App
157 suggestions for writing high-quality code to improve C # programs-Recommendation 32: always give priority to generics,
Recommendation 32: always give priority to generics
Generics have many advantages. both generic and generic methods have the reusability, type security, and high efficiency features at the same time, this is not possible for non-generic and non-generic methods.
Take reusability as an e
Writing high-quality code to improve the C # program's 157 suggestions-recommendation 57: the sub-type implementing ISerializable should be responsible for serialization of the parent class,
Recommendation 57: the sub-type implementing ISerializable should be responsible for serialization of the parent class
The type of Employee that inherits from ISerializable has a parent class Person. Assume that the Per
157 suggestions for writing high-quality code to improve C # programs-recommendation 55: reduce serializable fields by using custom features,
Recommendation 55: use custom features to reduce serializable Fields
Attribute can be declared to add comments to the target element in the code. During running, you can query metadata information in these managed blocks to change the running behavior of the target el
157 suggestions for writing high-quality code to improve C # programs-suggestion 61: Avoid writing Invalid code in finally,
Suggestion 61: Avoid writing Invalid code in finally
Before explaining the suggestions, you need to ask whether there is a situation that breaks the try-finally execution sequence. The answer is: does not exist (unless the application exits in the try block due to some rare special cir
157 suggestions for writing high-quality code to improve C # programs-recommendation 94: Treat override and new differently,
Suggestion 94: Treat override and new differently
Override and new enable the type system to present polymorphism for inheritance. Polymorphism requires that subclass has a method with the same name as the base class. The functions of override and new are:
If the method in the subcl
157 suggestions for writing high-quality code to improve C # programs-recommendation 100: there is no difference between static methods and instance methods,
Recommendation 100: there is no difference between the static method and the instance method
The static method is identical to the instance method in terms of the loading time and memory usage. Here, we first introduce the concept "type object ". For
Title, in the face of fussy designers, said uploading pictures have jagged (PS: I don't quite see!). = =)
Can you tell me how to improve the picture quality when uploading pictures, no aliasing?
Reply to discussion (solution)
Upload is just a copy, not affect the picture qualityOf course, you can use GD, it's another matter.
Upload is just a copy, not affect the picture qualityOf course, you can u
How to Use Filter in Ubuntu Scope to improve the search quality more accurately?
In Ubuntu Scope, a new Filter function is being developed. We can find more information about filter on our developer website. Here you can see some introduction to filter, but it is still difficult to use it. In our routine today, we will show how to use filter to achieve better search. In practical applications, for example,
* Development Website:
Www.pinstudy.com Experience Sharing (2 )*
Generally, access records can be divided into 1. General access records 2. access records of problem domains
(* This refers to writing access records to the database and disabling IIS "record access ;)
1. General access records: including accessTime (access time), clientip (Client IP address), and Referer (from which link to access ), cookies (Client IP addresses used for last access), methods, useragent, etc.
2. Access record of
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.