2 ms·
Reusing a function like this is not clean code. It violates several principals. 1. Functions should have as few parameters as possible and almost never have fl
by gvjddbnvdrbv 7y ago
Reusing a function like this is not clean code. It violates several principals.
1. Functions should have as few parameters as possible and almost never have flag parameters. This is a basic thing and costs very little to follow. As soon as you want to add a flag to a function you need to make a new function.
2. Minimize coupling.
3. Single responsibility principal. A unit of code should have one reason to change.
Of course in order to follow principles 2 and 3 here you may well need to consider the business logic.