Is there any practical benefits/reasons to use a collection instead of a map or collection instead of a list?
In reading through the Zoho Creator Deluge documentation there doesn’t look to be criteria to consider for when it is better to use to use collections in instead of maps or lists. Could someone point to the specific documentation that covers when (and why) to use collections or maps-and-lists. Or describe the criteria you consider when making this design choice?
Sucasa’s response references a good resource that describes what collections are and includes a brief description of how they differ from maps and lists.
However this question is: what criteria to consider when deciding to a collection instead of a list or map. In other words, when should a developer use a map or a list instead of a collection?
Lists use add() for inserting values and Maps use put() for inserting key/value pairs. So those distinct function names re-enforce to the developer which data structure is being acted on. That seems like it is beneficial.
A collection can be created as a list-collection or a map-collection, and can use the same insert() function to insert values in the collection. What is an example situation where that is useful?
Using a collection reduces the visibility of whether a developer is using a list or a map data-structure and the developer still needs to know which structure is being used when doing an insert() action or a ‘for each’ loop because the syntax will be slightly different for each depending on whether the collection is a list-collection or map-collection. So it seems slightly better to use lists and maps directly and not use collections.
Are there other considerations to think about when evaluating whether to use a collection instead of a map or a list?
A collection is different from a collection-variable. A collection-variable is a Zoho-Deluge-Query result. There can be a bit of confusion here because the Zoho-Deluge online editor displays a tooltip that says 'collection' when one has a Zoho-Deluge-Query result. The Zoho-Deluge-Query result (collection-variable) seems to behave like an object with direct database access to the query results.
This answer is based my current knowledge. If better information comes available, I'll update it.
Use Lists and Maps. They are different data structures and in most cases developers need to know what data structure they are working with. The different insert functions (add() for Lists, and put() for Maps) help remind the developer which type of data structure is being acted on.