Should Class Helpers Be Used In Developing New Code?
Delphi 8 introduced Class Helpers for the purposes of mapping the VCL/RTL to the .NET object hierarchy. They allow injecting methods into an existing class without overriding the the class or modifying the original. Later versions of Delphi found class helpers improved and they were ported to Win32.
In the help it says "they should not be viewed as a design tool to be used when developing new code."
Class Helpers violate traditional OOP, but I don't think that makes them a bad thing. Is this warning warranted?
Should class helpers be used when developing new code?
Do you use them when developing new code?
Why or why not?
Per Malcolm's comments: New code means daily application development, where you have some 3rd party libraries, some existing code, and then code you are writing.
Depends what you mean by "new code".
They aren't really relevant for classes you are newly developing, so in that case, no, they probably shouldn't be used.
But even in a brand new project, you may still need to modify an existing class that you can't change in other ways (vcl class, third-party class, etc). In this case, sure, I'd say go ahead.
They're not evil in and of themselves. Like most other things, you just need to understand how they work and use them in an appropriate context.
- → Index out of range (-1) when I click on any item in the TListBox
- → How can I display only specified database results based on TListbox items?
- → SQL How to sum from another table and insert in another table
- → Can a Windows dll retrieve its own filename?
- → TObjectList<T>.IndexOf giving incorrect result
- → Add field to FDMemTable in Delphi
- → What impact (if any) does Delphi 2009's switch to Unicode(/UTF16) have on executable size and memory footprint?
- → How to solve Delphi's [Pascal Fatal Error] F2084 Internal Error: LA33?
- → Do I have to use Disable/EnableControls when using Locate in a TClientDataSet?
- → What is the best way to make a Delphi Application completely full screen?
- → Is it possible to get a delphi project to create a lib file as the output of the project?
- → How to get currently logged in username?
- → How to fix the endless printing loop bug in Nevrona Rave