List of type Party a good practice, bad practice, or just a practice?
I’m still new to Daml and have only built small toy apps. I’ve been reviewing other apps and noticed on occasion people creating templates with lists of Parties, like this:
template Asset
with
owner : Party
description : Optional Text
observers : [Party]
My understanding of Party types in Daml is that a Party is a role that can represent an individual account, a group, or even a group of groups depending on the identity management system (IMS) and how the IMS maps to Party assignments. It seems to me that having the observers set as a list of Parties makes working with observers needlessly complex. Obviously you can do it and the Daml compiler/linter doesn’t restrict assignments that are a list of parties, but I wonder if this is a good or bad practice?
As a best practice should parties be managed by the identity management system exclusively and thereby (almost) always singular? Or, is this a fine practice and assigning observers to a list of parties is reasonable if needed?
Multiple parties are fine at least up to reasonable sizes, let’s say ~50. Once you go above that you might run into some performance issues.
The option of “use a single party and manage it at the IMS/IAM” level is fairly limited in two major ways:
- You’re giving up on representing things in Daml. It now depends on your external system. That’s perfectly fine in some cases but can be a problem in others.
- The “control through IAM” option works fine if all users are hosted on the same participant. But in a distributed system you cannot assume that in general. If that’s not the case you can’t really make this work.