-
Content Count
60 -
Joined
-
Last visited
Everything posted by Berocoder
-
Forward declarations
Berocoder replied to Berocoder's topic in Algorithms, Data Structures and Class Design
I investigated more now and unfortunately I don't get this as I want Declaration of TestAbstractB happen in unit TestA. I want to move it to unit TestB as there can be many classes that have references to that class. But then again I got [DCC Error] TestA.pas(6): F2047 Circular unit reference to 'TestA' as TestB have a reference to TestA. So I don't know. Using interfaces need huge changes in framework and insert Abstract classes don't work as I expected. So maybe we continue with original implementation with inc-files 🙂 [EDIT] Simple solution to that was to store abstract declarations in own unit. So far so good 🙂 -
Forward declarations
Berocoder replied to Berocoder's topic in Algorithms, Data Structures and Class Design
Hm ok. Thanks for the advice 🙂 -
Forward declarations
Berocoder replied to Berocoder's topic in Algorithms, Data Structures and Class Design
Btw, that means I have to typecast every access to the concrete class ? -
Forward declarations
Berocoder replied to Berocoder's topic in Algorithms, Data Structures and Class Design
The code I posted here is heavily simplified. I agree that cyclic dependencies is not good. But basically one class is one table in database for most cases. There is also some transient classes that reside only in memory. So this is about relations between classes. Many times I want to navigate both from class A to B and from B to A. For example class TPerson have a relation to TAddress. So to find the address: vAddress := aPerson.Address,AsString:; But to find the person who live at an address make also sense vName := aAddress.Person.AsString; So one way to break dependency is to use interface. But there are many questions left to work with as the whole framework now assume direct access. So I want to work with IAddress and IPerson instead of TAddress and TPerson. But at some point I must deal with the concrete class anyway. About abstract classes, that is a good point. But what happens with the inheritance chain. TObject TBoldMemoryManagedObject // inherited in framework TBoldFlaggedObject // inherited in framework TBoldSubscribableObject // inherited in framework TBoldElement // inherited in framework TBoldDomainElement // inherited in framework TBoldMember // inherited in framework TBoldObject // inherited in framework TBusinessClassesRoot // Dummy TAmObject // basic info TAmStateObject // have states TPerson // concrete class This is the inheritance tree for TPerson. Is it even possible to use a TAbstractPerson somewhere ? -
Forward declarations
Berocoder replied to Berocoder's topic in Algorithms, Data Structures and Class Design
See https://stackoverflow.com/questions/53980032/how-to-avoid-using-inc-files-for-code-with-delphi for more details. But I now believe that interfaces is the correct solutions instead of direct references between the classes. -
Forward declarations
Berocoder replied to Berocoder's topic in Algorithms, Data Structures and Class Design
Ok so basically it is not possible to have direct references in both directions between two classes if they are stored in separate units... -
Seems like links are not clickable https://github.com/mikerabat/mrmath http://www.mrsoft.org/home/downloads.html
-
Look at https://stackoverflow.com/questions/4652958/is-there-a-way-to-log-every-gui-event-in-delphi. It try to intercept all events. Advantage is that you need much less modifications of your code. Disadvantage is that not all your methods is logged.
-
Does anyone have some library/unit to make coding of tokeniser/parser/somekind of tree easier?
Berocoder replied to Tommi Prami's topic in Algorithms, Data Structures and Class Design
New book next year that could be interesting. http://interpreter.analogmachine.org/ -
How can I get updates for new posts in this forum on the phone? With the old Google+ forum I used the Google app for that.