What would you name a variable that has type Promise<Todo> ?
Comments (8)
necovek · 12d ago
I though we were past naming variables by their types? That's what their types are for.
So try naming it about what is it promising to have?
c5n8 · 11d ago
What would you name it?
necovek · 10d ago
What is it going to have as the value?
c5n8 · 10d ago
a promise that, if fulfilled, will return an object of uncompleted todo
necovek · 10d ago
Something to the tune of "unfinished", "uncompleted"/"incomplete" or — even better — "outstanding".
I avoid negatives when I can, so I'd go with `outstandingTask` or `outstanding_task` (or `todo` if that's the term you use throughout the application).
behnamoh · 12d ago
I have this convention:
<group-name><object-name><object-type>
So in your case:
ToDoPromise
if it's the only todo.
c5n8 · 10d ago
I could see what group name is.
What sets apart object name and object type?
Because, both Todo and Promise are object type.
zzo38computer · 10d ago
I would think it would depend what the meaning of the variable is? Usually, it is not only the type which is relevant, I think.
So try naming it about what is it promising to have?
I avoid negatives when I can, so I'd go with `outstandingTask` or `outstanding_task` (or `todo` if that's the term you use throughout the application).