4 ms·
really not a fan of "return early" style, because of logging: I like to have the ability of look at the business logic flow as/if needed and monitor its states
by LoSboccacc 9y ago
really not a fan of "return early" style, because of logging: I like to have the ability of look at the business logic flow as/if needed and monitor its states but multiple returns per method force having complex "ifs" logged one after another, while in a single return pattern you can concatenate the reasoning into a single log line.
Having a single log line is extremely useful in general as you don't have to filter all the relevant information within other log lines and makes easier to extract a single thread pathway within a multi-threaded application.
however I do like this snippet:
> Try keep the “meat” of your method at the lowest indentation level.
but I prefer doing that isolating atomic logics within their own method, instead of having multi-step pathway with early returns