I think that writing pseudo code on a whiteboard explaining what I have in mind, it's not the same as writing production code.
The uncecessary if and return statement will help exposing the implementation to another humans.
It's just that, I often refctor boolean expressions as you did here, so it is just that I was courious about your reasons about failing a job interview.
I see.
I think that writing pseudo code on a whiteboard explaining what I have in mind, it's not the same as writing production code.
The uncecessary if and return statement will help exposing the implementation to another humans.
It's just that, I often refctor boolean expressions as you did here, so it is just that I was courious about your reasons about failing a job interview.
The code should never be written that way in the first place - it's as bad as writing something like this in pseudocode:
Definitely a red flag
Also, violates SOLID's first principle, because now function
does two thing instead one.
The Single Responsibility Principle has nothing to do with "do just one thing" - that is a common misconception.
The Single Responsibility Principle:
So "those (many) things that change for the same reason" revolve around the same single responsibility.
Don't Repeat Yourself is another one - it' not about removing repetition or duplication:
Sometimes duplication isn't about the same thing (The Wrong Abstraction):
Also: The SOLID Design Principles Deconstructed (2013)
Basics of the Unix Philosophy: