other
1. [Mandatory] When using regular expressions, make good use of its precompilation function to effectively speed up regular expression matching.
Note: Do not define it in the method body: Pattern pattern = Pattern . compile(rule);
2. [Mandatory] Velocity is recommended when calling attributes of the POJO class Just use the attribute name to get the value. The template engine will automatically call the POJO's getXxx() according to the specification. If it is a boolean basic data type variable (the boolean name does not need to be prefixed with is
) , the isXxx() method will be called automatically.
Note: Note that if it is a Boolean wrapper class object, the getXxx() method will be called first.
3. [Mandatory] The variables sent to the page in the background must be added with $!{var} - an exclamation mark in the middle.
Note: If var = null or does not exist, ${var} will be displayed directly on the page.
4. [Mandatory] Note that Math . random() returns a double type. Please note that the value range is 0≤ x <1 (you can get zero value, pay attention to the division by zero exception), if you want to obtain a random number of integer type, do not magnify x by several times of 10 and then round it, directly use the ## of the Random object # nextInt or nextLong method.
Note: If you want to obtain a more accurate nanosecond time value, use System . nanoTime(). In JDK 8, it is recommended to use the Instant class for scenarios such as counting time. 6. [Recommendation] Try not to add variable declarations and logical operators to vm, let alone any complex logic to the vm template.
7. [Recommendation] The size should be specified for the construction or initialization of any data structure to avoid unlimited growth of the data structure and eating up the memory.
8. [Recommendation] For "code and configurations that are clearly out of use", such as methods, variables, classes, configuration files, dynamic configuration properties, etc., must be resolutely removed from the program to avoid causing excessive What rubbish.