Although probably a violation of the YAGNI principle, this is an entirely valid way to structure this code with an eye for future maintenance. Perhaps the dev who wrote this has done the refactor from return isSomethingTrue(); to this structure so many times -- to add logic to one or both branches -- that they now default to the latter. And they expect that in the average case it will save time.
I don't do this thing in particular, but I will sometimes opt to do longer-form ways of structuring things when they are more amenable to maintenance in the future.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Although probably a violation of the YAGNI principle, this is an entirely valid way to structure this code with an eye for future maintenance. Perhaps the dev who wrote this has done the refactor from
return isSomethingTrue();
to this structure so many times -- to add logic to one or both branches -- that they now default to the latter. And they expect that in the average case it will save time.I don't do this thing in particular, but I will sometimes opt to do longer-form ways of structuring things when they are more amenable to maintenance in the future.