When you write code, you have to create classes, write functions, write methods, and define variables, so you have to name them.
As a programmer’s basic literacy, not only to write quality code, but also to make people understand your code. It is important to follow the rules of naming English words.
A good name not only clearly conveys the intent of the code in context, but also improves code quality and reduces communication costs. Play a very good role in collaborative development.
All right, here comes the hero...Copy the code
Name prompt plug-in
A TypingCat is an IdeaThe word namingPrompt to complete the plug-in
compatibility
features
- Contains 10,000 common words
- Support applies to code naming: local variables, constants, method names, method parameters, and class names
- Fuzzy search support
- Based on code completion, use the shortcut key Ctrl + Space
- Offline mode for faster response
- Compatible with Idea, Android Studio, Pycharm, Goland
demo
More and more
For TpyingCat plugin communication, please go to Github, welcome star and issue
Github – TypingCatPlugin
List of naming conventions for additional dry goods words () :
The return value isBoolean typePrefix the method name of
location | The word | mean | case |
---|---|---|---|
The prefix | is |
Whether the object is in the expected state | isChecked |
The prefix | can |
Whether (the object) can do what you expect | canRemove |
The prefix | should |
Whether the instruction should be executed | shouldMigrate |
The prefix | has |
Whether (object) has expected data attributes | hasObservers |
The prefix | needs |
Whether (the caller) needs to execute instructions | needsMigrate |
Processing method when executing on demand
location | The word | mean | case |
---|---|---|---|
The suffix | IfNeeded |
Do what you need or do nothing when you don’t need | drawIfNeeded |
The prefix | might |
Same as above | mightCreate |
The prefix | try |
Try to execute, skip the exception if it fails, or return an error code | tryCreate |
The suffix | OrDefault |
Try to run, return default if unsuccessful | getOrDefault |
The suffix | OrElse |
Attempts to execute and returns the value specified by the argument on failure | getOrElse |
The prefix | force |
Try to force it. Errors are represented by exceptions or return values | forceCreate .forceStop |
Methods related to asynchronous processing
location | The word | mean | case |
---|---|---|---|
The prefix | blocking |
Method of blocking a thread | blockingGetUser |
The suffix | InBackground |
A method executed in a background thread | doInBackground |
The suffix | Async |
Asynchronous methods | sendAsync |
The suffix | Sync |
Synchronous methods (there are corresponding asynchronous methods) | sendSync |
A prefix or stem | schedule |
Queue jobs and tasks | schedule .scheduleJob |
A prefix or stem | post |
Same as above | postJob |
A prefix or stem | execute |
Perform asynchronous processing | execute .executeTask |
A prefix or stem | start |
Same as above | start .startJob |
A prefix or stem | cancel |
Stop asynchronous processing | cancel .cancelJob |
A prefix or stem | stop |
Same as above | stop .stopJob |
The callback method
location | The word | mean | case |
---|---|---|---|
The prefix | on |
Execute when something happens | onCompleted |
The prefix | before |
Do it before it happens | beforeUpdate |
The prefix | The prefix |
Same as above | The prefix Update |
The prefix | will |
Same as above | willUpdate |
The prefix | after |
I ran | afterUpdate |
The prefix | post |
Same as above | postUpdate |
The prefix | did |
Same as above | didUpdate |
The prefix | should |
Execute when asked if something will happen | shouldUpdate |
Methods of manipulating collections
The word | mean | case |
---|---|---|
contains |
Whether it has the same object as the object you specified | contains |
add |
add | addJob |
append |
Same as above | appendJob |
insert |
Add it to the NTH one | insertJob |
put |
Add the element corresponding to the key | putJob |
remove |
Remove elements | removeJob |
enqueue |
Add to the end of the matrix | enqueueJob |
dequeue |
Take the beginning of the matrix and delete it | dequeueJob |
push |
Add to the top of the stack | pushJob |
pop |
Take the top of the stack and remove it | popJob |
peek |
Remove the top of the stack (do not remove it from the stack) | peekJob |
find |
Find the one that fits the bill | findById |
State method
The word | mean | case |
---|---|---|
ensure |
Check the expected status, otherwise throw an exception or return an error code | ensureCapacity |
validate |
Check for correct status, otherwise throw an exception or return an error code | validateInputs |
Methods to handle the life cycle of an object
The word | mean | case |
---|---|---|
initialize |
Initialization. Also used as a lazy initialization method. | initialize |
abandon |
Destructor substitution | abandon |
destroy |
Same as above | destroy |
dispose |
Same as above | dispose |
Methods related to data
The word | mean | case |
---|---|---|
create |
Make a new one | createAccount |
new |
Make a new one | newAccount |
from |
Create a new data from existing data, or create a new data from another data | fromConfig |
to |
shift | toString |
update |
Rewrite existing | updateAccount |
load |
read | loadAccount |
fetch |
Read (remote) | fetchAccount |
delete |
delete | deleteAccount |
remove |
delete | removeAccount |
save |
save | saveAccount |
store |
save | storeAccount |
commit |
save | commitChange |
apply |
Save/Apply | applyChange |
clear |
Clear data or return to the initial state | clearAll |
reset |
Clear data or return to the initial state | resetAll |
Pairs of words
The word | The word |
---|---|
Get access to | The set set up |
Increase the add | Remove delete |
The create create | Destory removed |
Start starts | Stop stop |
Open to open the | Close close |
Read read | Write to write |
The load is loaded | Save save |
The create create | Destroy the destruction |
Begin to start | End to end |
Backup backup | Restore to restore |
The import import | Export export |
The split segmentation | The merge with |
Inject injection | The extract extracted |
The attach attached | Detach from |
Bind the binding | Separate separation |
The view to see | Browse through |
Edit to edit | The modify change |
Select select | Mark mark |
Copy copy | Paste paste |
Undo to cancel | Redo redo |
Insert to insert | Delete to remove the |
The add to join | Append to add |
The clean clean | The clear clear |
Happens to increase | Decrease reduce |
Play play | Pause suspends |
Launch start | Run run |
The compile compile | The execute perform |
The debug debugging | Trace tracking |
Observe observe | Listen to monitor |
Build building | The publish release |
The input input | The output output |
Encode coding | Decode decoding |
Encrypt encrypt | Decrypt decrypt |
Compress the compression | Decompress the decompression |
Pack pack | Unpack unpack |
The parse analytical | Emit generated |
Connect the connection | Disconnect disconnect |
Send to send | The receive receive |
Download download | The upload to upload |
Refresh to refresh the | The synchronize synchronization |
The update to update | Revert back |
The lock lock | Unlock the unlock |
Check out the checkout | Check in to check in |
Submit to submit | Commit to deliver |
Push push | Pull pull |
Expand open | The collapse collapse |
Begin to start | End to end |
Start start | Finish to complete |
Enter into the | The exit exit |
Abort to give up | The quit leave |
Obsolete scrap | Depreciate old |
Collect collect | Aggregate gathered |
Resources: Method naming references qiita.com/KeithYokoma…