News for hackers. Stuff that matters.
Re:Goodbye, Clean Code by gvjddbnvdrbv on Sunday January 12, 2020 @05:56AM (#22025654)
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.

There are no comments on this comment yet.