DEV Community

Discussion on: Boolean - The Good, The Bad and there is no place for the Ugly

Collapse
 
srobfr profile image
srobfr • Edited

This works well until the business says that a Thing in your model can be updated only by (Managers) and (Normal users that own this Thing).
Then you have to bin all this and implement a roles system with an access control list.
This is the normal life of an evolving project...

Collapse
 
macsikora profile image
Pragmatic Maciej

Users and roles was only naive example. Not like I wanted to go deeper in that domain, it was just for me natural fit to show the problem in clean way.

Collapse
 
srobfr profile image
srobfr

You did it very well :)
Also, boolean function arguments are often considered a code smell, as they are mostly used to implement things that should be done with the Strategy design pattern.