News for hackers. Stuff that matters.
Re:How not to write shitty code: Intentional Conditions by 04091948 on Sunday April 19, 2020 @04:53PM (#22918699)
I personally, would've overridden the equal function of record (or made an equality helper function).

so the code would become

if(!record.isBuiltIn() || !user.canChange(record) || !record.equals(oldRecord)){ // can't save / or no need too }

and if no one can change a builtin, then a user certainly can't change it.

so it becomes:

if( !user.canChange(record || !record.equals(oldRecord))){ // can't save / or no need too }

There are no comments on this comment yet.