Home > Article > Backend Development > Should I use terminology or jargon in naming PHP functions?
When it comes to naming PHP functions, both terminology and jargon have their pros and cons. Terminology provides professionalism and precision, while jargon is easy to understand and remember. In practice, using terminology is important for professionalism, but jargon is easier to understand for non-technical users. Best practices include maintaining naming consistency, clear intent, and considering the expertise level of your audience.
#PHP Function Naming: Terminology or Jargon?
Using terminology or jargon when naming PHP functions has always been a controversial issue. Some developers feel that using terminology is more professional and precise, while others feel that using jargon is easier to understand and remember.
Advantages of using terminology:
Advantages of using jargon:
Practical case:
Consider the following function, used to obtain user data from the database:
Terms used:
function getUserDataByUId($userId) { ... }
Using Jargon:
function getUserById($id) { ... }
In this case, "UId" is the standard term in SQL for a user ID. However, "id" is more common jargon and easier to understand for non-technical users.
Best Practices:
Ultimately, whether to use terminology or jargon depends on your specific situation. However, here are some best practices to consider:
The above is the detailed content of Should I use terminology or jargon in naming PHP functions?. For more information, please follow other related articles on the PHP Chinese website!