eugeneloza / decoherence

Project moved to https://gitlab.com/EugeneLoza/decoherence
GNU General Public License v3.0
10 stars 7 forks source link

Constructor architecture: Modular data #55

Open eugeneloza opened 6 years ago

eugeneloza commented 6 years ago

Thinking on using modular design like in previous version of the constructor. Looks like I should stick to it where it's needed. Would require some redesign of the architecture, but doesn't look too complex

eugeneloza commented 6 years ago

see also #235

eugeneloza commented 6 years ago

The expected architecture is:

TSomeModule = class(TDataModule)
  name: string; //e.g. if this is a header (content of the data is strings in this case)
  shortname: string;
  comment: string;
  isChanged: boolean;
  procedure WriteModule; override; //override abstract parent
  procedure ReadModule; override; //and thrown as a @link to write routine
end;
type TSomeData = class(TDataContainer)
  Header: TSomeHeaderModule;
  SomeModule1: TSomeModule1;
  SomeModule2: TSomeModule2;
  procedure WriteData; //architecture for writing
  procedure ReadData; //architecture for reading
  procedure ConstructInterface; //which will make a tab for edit
  procedure ProcessInterface; //which will compare tab's content onchange and will save changes to data
end;

Would require some major architecture changes in Constructor (and a bit in the game). But after all the hard work - it'll become much more convenient/easier/bug-proof to work further. Merge this with file read/write? #235 #236 - YES

eugeneloza commented 6 years ago

I really don't like the idea. While much better than nothing, it's still too complex to work with. Requires hell of a work to add a simple editor interface (yes, I hate making interfaces :)) just for a single module. And it doesn't look like it'll become easier in future. Taking a month just to make a child of TStringGrid is a horrible waste of time.