3 ms·
This may not be a popular opinion, but for me read and retrieve are indicative of a side-effect. I consistently use retrieve to indicate fetching things from da
by slau 10y ago
This may not be a popular opinion, but for me read and retrieve are indicative of a side-effect. I consistently use retrieve to indicate fetching things from database, or remote locations (REST, RPC, whatever). Similarly, read, in the case of a parser or whatnot, indicates that the buffer will be advanced.
Maybe I'm just too biased because I try to have const-correct/mutable-correct code?
- grzm 10y agoSounds like you're building up a set of conventions which can be very useful when you're consistent with them and communicate them to others reading your code.
- clusmore 10y agoAgreed, these words have similar connotations for me as well. I have also seen deliberate usage of set vs update to indicate changes to objects in memory only vs persistence to databases, etc.
- dllthomas 10y agoAnd of course, with sufficiently aggressive optimization, there may not actually even be a change to an object in memory (or the object in memory to change) in some cases. Not so with the database.
- partycoder 10y agoIf it's a partial read that requires to track state, then yes. If it's a somehow self-contained read operation that returns a result, while it has side effects (I/O), it may not necessarily have to mutate variables in your program (e.g: load a small file into string variable, make a HTTP response and return the body, etc).