Forum > Beginners

Data Structures, Containers, Collections

(1/3) > >>

pascal111:
ﻷخذ فكرة فقط! ما الفرق بين هذه المفاهيم الثلاثة ولو أمكن بعض الأمثلة السطحيّة إن كان الموضوع مُعقّداً ويحتوي تفاصيل كثيره ،والمفاهيم هي Data Structures, Containers, Collections وأظنّني أعرف مفهوم الـ Data Structures؟

google translate:

"Just "to" take an idea! What is the difference between these three concepts and if possible some superficial examples if the topic is complex and contains many details, and the concepts are Data Structures, Containers, Collections and I think I know the concept of Data Structures?"

lucamar:
If you know the concept of Data Structure then you'll know what it refers to: it's any mean of "structuring" data so that it corresponds with the abstract entities which a programmer uses to group data. In that sense, it's almost anything beyond simple types: records, arrrays, lists, classes, etc.

A container is a data structure specialized (i.e. designed) to contain other "simpler" data and data structures like e.g. an array of records, a string list or even a file or database; in Lazarus particularly it's also usually meant as a control which can contain other controls: forms, panels, etc.

Collections and containers are very similar, the differences being mainly that the term "collection" is usually used to refer to containers which store entities of a single type (like a TCollection, where all its members usually have the same base type--see the wiki page on them for an example) and that collections usually maintain references rather than "contain" the entities that form them.

Note also that there is always some overlap in concepts and the distinction depends somehow on who is talking about them; it's frequentely not easy to know whether you're dealing with a collection or a container ... or both! And, of course, all of them are "data structures" in one way or other!

That's, very basically, it in all its muddy "glory" ;)

pascal111:

--- Quote from: lucamar on May 30, 2021, 02:40:37 am ---If you know the concept of Data Structure then you'll know what it refers to: it's any mean of "structuring" data so that it corresponds with the abstract entities which a programmer uses to group data. In that sense, it's almost anything beyond simple types: records, arrrays, lists, classes, etc.

A container is a data structure specialized (i.e. designed) to contain other "simpler" data and data structures like e.g. an array of records, a string list or even a file or database; in Lazarus particularly it's also usually meant as a control which can contain other controls: forms, panels, etc.

Collections and containers are very similar, the differences being mainly that the term "collection" is usually used to refer to containers which store entities of a single type (like a TCollection, where all its members usually have the same base type--see the wiki page on them for an example) and that collections usually maintain references rather than "contain" the entities that form them.

Note also that there is always some overlap in concepts and the distinction depends somehow on who is talking about them; it's frequentely not easy to know whether you're dealing with a collection or a container ... or both! And, of course, all of them are "data structures" in one way or other!

That's, very basically, it in all its muddy "glory" ;)

--- End quote ---

لقد شرحتَها بالـ Old English أو يبدو ذلكـ ،جميل!

google translate:

"You explained it in Old English or it sounds (that) - beautiful!"

pascal111:

--- Quote from: jamie on May 30, 2021, 01:34:34 am ---A TCollection is like a TStringList except it manages a list of TCollectionItem class.

This TCollection can do the basic things like insert a new CollectionItem in the list, delete, search for etc..

A TCollectionItem has information for each item like the Display Name for example.

For the most part, these are classes designed to be inherited from so that you can build a more complete managed handler..

when you create a Tcollection, the constructor requires you to enter the CLASS it will be managing, this will actually point to the class implementation, not just a string name. So it ends as a TCLASS storage property..

 You use collection and collectionitems as part of a more complete class around something you are building..
 
 The object inspector uses this class too.

--- End quote ---

جيّد! وسأنظُر كذلكـ في الوثائق.

google translate:

"good! I will also look at the documents."

lucamar:

--- Quote from: pascal111 on May 30, 2021, 02:43:10 pm ---You explained it in Old English or it sounds (that) - beautiful!
--- End quote ---

People is always telling me that I talk like a book, both in my mother tongue and in other languages. For these later it's, I think, because the way I learn them: study the base grammar and a little vocabulary, and then start (and keep on) reading their literature. Makes for a "bookish" kind of result, but I'm glad you find it "beautiful" :D   

Navigation

[0] Message Index

[#] Next page

Go to full version