As a normal programmer, what to do [unfinished, continuous update]

Code of Conduct:

1. What other people say to you (individual or group chat), find a place you can't forget, and make sure to complete it in the corresponding time. If it is not completed, tell others in advance and explain why. Don't wait for others to ask you, and don't keep asking people what they said at the time.

2. Find a place where you can't lose the things that others send you (alone or in group chat), make sure you can find them, and don't keep asking others for them.

 

 

Development specifications:

1. Functional buttons, such as delete, lock, click to give a confirmation box

2. Required fields, give a red star prompt, give a prompt when it is not filled, instead of reporting a bunch of errors returned by excuses

 

 

 

Code specification:

Core idea: encapsulation

1. Constant parameters, use the newly defined class, the class name is all uppercase, and the attributes are all uppercase;

For example: delivery method, divided into delivery, self-pickup, and in-store food

Definition class: PEISONG_TYPE

Attribute: PEI_SONG=1

ZI_QU=2

TANG_SHI=3

2. A piece of processing code, if it is possible to be used for the second time, encapsulate it

3. A method that may make mistakes, try every means to prevent it from having a chance of mistakes.

For example: Android has a method of locally caching information, the most common method on the market is this,

sharePreferenceUtils.putInt(key, value);

sharePreferenceUtils.putString(key, value);

If the key is A, putInt used for the first put, and putString used for the second put, then the getInt used when fetching, then the program must crash because the type does not match; the modification method is: encapsulate a new one Class, pass the value of the method parameter, because the method needs to define the type, so there will be no type errors caused by inattention (equivalent to mandatory parameter types): SharePreferenceMethodUtils.setA(int a)

4. Write as many comments as possible:

The class begins to write clearly what this class does and what capabilities this class has;

An explanation is added after the attribute, what does this attribute do, if there are multiple enumeration values, simply write the enumeration value, what does it mean;

Write clearly the ability of the method, what the business logic is, and what steps can be divided into the method, and write the corresponding steps

5. Do not use Chinese in the code; the name of the class starts with uppercase, and the name is camel; the name of the method and attribute starts with lowercase, and the name is camel.

 

 

Guess you like

Origin blog.csdn.net/zwx_lucky/article/details/104636557