Previously, I grouped async tasks inside a task object. This helps in keeping the function name short and easy to search, but I ended up rarely using it.
The idea seems good enough, it looks clean, but it adds up to the complexity of the writing now that I have to selectively group the async functions.
A Better Approach
So I'm back at square one but with a better idea. Instead of using "Task-" prefix, which is adapted from C# by the way, it's better to use "-Async" postfix :
js |
---|
// previous writing async function TaskRefreshList() { // ... } // updated writing async function RefreshListAsync() { // ... } |
This way, it's easy to search a function name by the first letter, and I still can tell an async function at first glance.
Improving from Here
I've tested yet a better way to name an async function, i.e. to use an even shorter postfix.
https://vanillawebdev.blogspot.com/2024/05/naming-the-async-function-part-3.html https://www.blogger.com/blog/post/edit/8166404610182826392/767020910098491524 https://www.blogger.com/blog/page/edit/8166404610182826392/767020910098491524Naming The Async Function - Part 3
Previously, I grouped async tasks inside a task object. This helps in keeping the function name short and easy to search, but I ended up rarely using it.
The idea seems good enough, it looks clean, but it adds up to the complexity of the writing now that I have to selectively group the async functions.
A Better Approach
So I'm back at square one but with a better idea. Instead of using "Task-" prefix, which is adapted from C# by the way, it's better to use "-Async" postfix :
js |
---|
// previous writing async function TaskRefreshList() { // ... } // updated writing async function RefreshListAsync() { // ... } |
This way, it's easy to search a function name by the first letter, and I still can tell an async function at first glance.
Improving from Here
I've tested yet a better way to name an async function, i.e. to use an even shorter postfix.
Comments
Post a Comment