In these cases I do like OOP approach better. Like from userHasAdminRole(user); to user.hasAdminRole():
That is not an OOP approach. OOP means instantiate a user and call a hasAdminRole() method on it. :P
This is how classes and hierarchies gets bloated.
Sounds great in theory but maybe administration rights and server may end up in different classes and systems.
One thumb of rule state to not make a method if you do not modify the object by reference.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
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.
In these cases I do like OOP approach better. Like from userHasAdminRole(user); to user.hasAdminRole():
That is not an OOP approach. OOP means instantiate a user and call a hasAdminRole() method on it. :P
This is how classes and hierarchies gets bloated.
Sounds great in theory but maybe administration rights and server may end up in different classes and systems.
One thumb of rule state to not make a method if you do not modify the object by reference.