jeudi 23 septembre 2021

What to do when all methods start with the same condition

In a class, all my methods start with the same if

if (locked)
    return;

Is there a design pattern to use in these situations? There has to be a better way than write the same 2 lines in like 8 methods.

Aucun commentaire:

Enregistrer un commentaire