update/3 in the
LiveView module updates the socket’s assigns (similar to
update/2 callback in
LiveComponent module is invoked as part of the component’s lifecycle (if defined) and is also invoked (if defined) by
send_update/3 in the
LiveView module updates a mounted component by invoking
Somebody new to the framework might get confused and have to remember which update is which.
A quick fix might be renaming the
update/3 function to something like
update_assign/3 if this is a real problem for newcomers.
I would like to know what other users of LiveView think.
You explained them in short sentences, so they are not that confusing?
I’d rather stick to simple and short words for function name. Let’s not go down the road of:
- Very long name, a la Objective-C:
[ NSDistributedNotificationCenter postNotificationName: ...]
- Too cute a name, a la Perl: croak? cull?
Many Elixir users are non-native English speakers. I find simple but imprecise word much easier to remember than long name or uncommon words.
Good points about the naming principles. I shouldn’t have provided an example.
Maybe the right approach to the thinking is:
update/3 have very different functionality but have the same name when using
LiveComponent. I know I was able to explain it but for a newcomer this can be I believe confusing.