Forum > General

OOP structures in fpc and Lazarus

<< < (11/14) > >>

ArtLogi:

--- Quote from: jollytall on November 30, 2021, 06:09:38 pm ---
--- Quote from: ArtLogi on November 30, 2021, 12:58:56 pm ---For the angry answer

--- End quote ---
I don't know if you mean me had an angry answer, but if that is what you feel, you feel it wrong. There was nothing angry in it, (hence the 'Please' and the mentioning that I had the same confusion).

--- End quote ---
Sorry for lack of clarity in my post.

No I meant _other_ responders who were irked by this statement of TObject.  :)

--- Quote from: jollytall on November 30, 2021, 06:09:38 pm ---
--- Quote from: ArtLogi on November 30, 2021, 12:58:56 pm ---PS. Isn't type SET also a primitive object datatype, kind of list-object as lack of better description.  :-\

--- End quote ---
Sets are covered by the experts in the last few posts in details, so I cannot add much to it. I however mentioned it in Chapter 2.2 as a structure (like e.g. arrays as well) that I do not deal with, as for OOP they have no relevance.

--- End quote ---
Yes, answers were nice. I also need to re-read your really nice summary article again.


edit. For clarity I move this following "braindump" at the end here:


--- Quote ---(even though, I do not see much difference - as of defining by type and using such [in build] handlers to access them - compared records, looking from again from surface. As in the end any structure is just series of preset and latching bits in oscillator screen if we dive deep enough). I do not want to derail this topic by trying to figure out what SET is or is not.

I will do end discussion of SET and a lists from my part to this quote from Merriam-Webster dictionary, as non-native English user: "List: a simple series of words or numerals (such as the names of persons or objects)"
--- End quote ---

MarkMLl:

--- Quote from: ArtLogi on December 01, 2021, 12:25:05 pm ---No I meant _other_ responders who were irked by this statement of TObject.  :)

--- End quote ---

I'm sorry, that was probably me.

I agree, the choice of names is irksome :-)


--- Quote ---I will do end discussion of SET and a lists from my part to this quote from Merriam-Webster dictionary, as non-native English user: "List: a simple series of words or numerals (such as the names of persons or objects)"

--- End quote ---

Yes, but note that while there is no explicit statement as to whether or not that's ordered the word "series" implies it is.

The important point is that sets are unordered, and set elements are uncounted. So adding an element to a list twice has exactly the same result as adding it once, and once you've removed an element removing it a second time has no effect.

(That reads like the start of Laws of Form, which might be familiar to some.)

MarkMLl

Warfley:

--- Quote from: ArtLogi on December 01, 2021, 12:25:05 pm ---I will do end discussion of SET and a lists from my part to this quote from Merriam-Webster dictionary, as non-native English user: "List: a simple series of words or numerals (such as the names of persons or objects)"
--- End quote ---

Well that is the common understanding of a list, but we are talking about programming here, and as such have our own terminology (the same way that the dictionary definition of a tree says something about wood, while for computer scientists a tree is a datastructure).
There are professional glossaries, for example wikipedia has a neat one for CS terminology: https://www.wikiwand.com/en/Glossary_of_computer_science
List:

--- Quote ---An abstract data type that represents a countable number of ordered values, where the same value may occur more than once. An instance of a list is a computer representation of the mathematical concept of a finite sequence; the (potentially) infinite analog of a list is a stream.[139]: §3.5  Lists are a basic example of containers, as they contain other values. If the same value occurs multiple times, each occurrence is considered a distinct item.
--- End quote ---
Set:

--- Quote ---Is an abstract data type that can store unique values, without any particular order. It is a computer implementation of the mathematical concept of a finite set. Unlike most other collection types, rather than retrieving a specific element from a set, one typically tests a value for membership in a set.
--- End quote ---

Language is not really universal, each profession has it's own terminology and means potentially completely different things. A big part of learning a profession is learning the terminology to efficiently communicate

Blade:

--- Quote from: jollytall on November 05, 2021, 03:50:50 pm ---advanced records...
...provide feedback.
...any comment you have or any topic that should be added...

--- End quote ---

"In the world of Free Pascal, one can question what to use advanced records at all, when object is still
fully supported and class is also available. Probably it is again not a top priority to use...
...Advanced records, or also called extended records are a rarely used feature of Pascal."

Outside of correcting the grammar, the document seems to give some mixed signals about advanced records.  I don't think that was necessarily the intention, as it's conveyed that OOP is a tool to use when appropriate. Maybe the introduction language used about advanced records should be neutral, where they are presented as being of equal standing to OOP's objects and classes.  Kind of like, "another tool in the toolbox".

Later in the document, how advance records compare to other structures are given, which is good information.  I'm just emphasizing the introduction, as a newbie/beginner might get a negative impression, as it's something not needed.  However, many users of Free Pascal can be hobbyists, IT personnel, workers or owners of a small business creating utility programs for productivity, etc...  In the context of the task or smaller size of the programs they are creating, records or advanced records could be highly suitable.

jollytall:
Well, if it gives mixed signals, it might be because I have mixed feelings. My approach is the following:
- Advanced records are really a rarely used feature in the Free Pascal world. I do not have statistics, but it would be interesting to see how many one can find vs. e.g. class.
- Experts clearly stated above in the discussion, that it is there in FPC for full Delphi compatibility and also the reason is given why Embarcadero created it at the first place.
- If there is a tool and that is the best for a given purpose, we should not be shy to use it. This is why I detailed it.
- However there are not too many real usecases where advanced records have a real benefit. To me the only one is the variable record with methods, although I have never come across such a case in real life.
- As it is clear from my document, all these structures behave slightly differently in different cases, and for the hobbyists and alike, that would be an extra reason not to use advanced records. Somebody who is not using these features every day, it is much easier to remember only one-two structures. My recommendation after studying them for some time, if somebody starts programming and does not have a very strong argument to use something else, stick to only two structures, record for very simple cases and class for everything else where OO features are needed.

Last my trump card: I like if my programs are clean and simple and are based on the standard of the tool I use. So, I try to stick to mode objfpc and advanced records are simply not there (except if its modeswitch is used).

Nonetheless, if you have a suggestion how to change some of the sentences, I am happy to modify.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version