Having partial classes in Delphi would be nice.

Having partial classes in Delphi would be nice.

Some of my units are getting too big to my liking even though they contain only one class and a handful of methods. I see no way to refactor these classes into smaller ones because they manipulate complex XML documents and nothing re-usable would come out it.

I currently use {$region} code folding a lot but still it's unsatisfactory. So I find myself longing for the possibility to put different methods of a class into different files. There is currently no elegant way of doing this that I'm aware of: Delphi has no partial classes and using "include" files takes the included code out of its context which interferes with code completion etc.

Comments

  1. Attila Kovacs

    These 1750 lines map one data structure (SQL tables) to a completely differently data structure (XML document). The code has to run sequentially to produce an output document that validates correctly against the XSD. There's nothing to refactor, it's just.... big.


    ReplyDelete
  2. Arthur Hoornweg Could those 1750 lines be broken up into smaller functions?

    ReplyDelete
  3. Joseph Mitzen 8 methods is just about it... Each contains stuff that must run sequentially and belongs together.

    ReplyDelete

Post a Comment