I realized I don't do this consistently. I have name_from_id()
, ranked_election_to_matrix()
, matrix_from_scores()
, etc. Is there a good convention for this?
-
How is this opinion-based?– endolithyesterday
1 Answer
The most important convention is to be consistent.
The next most important thing is to be readable. I consider "A to B" more intellegible, since A precedes B both in the name and in the execution flow, while "B from A" reverses the association.
(This concerns the names of free functions. If you're writing methods, then you might be forced to write both an "Address.fromString(s)" and an "Address.toString()" if there is an existing policy about creation methods.)