vendredi 11 juin 2021

How to design classes when we need to apply an action affecting multiple items of a kind

Say we have a class "Users". If we want to perform an action which will affect many (or all) users, the solution is not to instantiate all those users iteratively and perform this action but "batch" together those operations at the lower levels. This could be an operation in the DB (e.g. update those 1000 users with this attribute) or an operation in an mqtt broker -my current case- (update topics related to those "User"s with this value). How would one do this efficiently but in an OO way?

Aucun commentaire:

Enregistrer un commentaire