The importance of naming normalization

    The naming convention is helpful for the clear description of the logic, good naming, when others maintain, you can understand the general function through the naming.

    A big cow said: The first thing to write code is to let others see it, and the second is to let the program run by the way.

There are two conclusions about the naming rules:

1. When there is an actual scene, name it with words that can better express the scene.

   For example: the words that represent the state are commonly used, state, status, and such fields are also available in the state machine.

However, when expressing clear information such as price status and whether there is inventory status, it is best to use price_status, inventory_status, which looks very intuitive and has a clear language.

2. When defining general methods, use language-broad words to name them.

   For example: There is a report function for the last 7 days. When defining a report data, you can use the name daily_report, but considering that this method of checking report data may also call this data query in other places, but not necessarily is a reporting requirement. So for such a method named recent_orders

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326173958&siteId=291194637