Search code examples
delphidelphi-2010

What are the essential skills for advanced programming with Delphi 2010?


I'm an intermediate level programmer who's interested in lifting my game as far as Delphi programming is concerned. I need to hear from the experts out there.

If I'm about to undertake a Win32 app project using Delphi 2010, what are the essential skills I need to be proficient in (I'd appreciate a list of topics that's neither too brief nor as exhaustive as a TOC in a book)? You can assume that there will be reading from and writing to separate databases and perhaps communications with other system components using web services. Please leave out Unicode compliance as I'm aware of that. Also, is there a good source on the internet for "best practice" programming using Delphi, or is it always a case of "it depends what you're trying to do" (ie. ask individual questions here on SO)? Thanks.


Solution

  • First advice is to read some part of the RTL/VCL code. Like Classes.pas SysUtils.pas Graphics.pas Controls.pas... this is the reference when coding in Delphi. Some other part of the code (like SOAP or FireMonkey) is perhaps not such a good reference to learn from... Use the source, Luke!

    Some topics, perhaps not specific to Delphi programming, but which I came accross with my team experiment and project code maintenance:

    • How Delphi handles memory: there is no garbage collector, but every class instance shall be freed, or have an owner (TComponent children);
    • Do not forget to handle exceptions: think what may occur (may be the worse), then protect your code with try .. finally and try .. except blocks (to release resources/memory + handle errors);
    • If you have some pre-Delphi 2009 code around, be aware that the string type changed from Ansi to Unicode: some code over the Internet is not Delphi 2010 ready;
    • Learn about Unit testing - and use it;
    • Learn about n-tier architecture, and do not abuse of the Delphi RAD approach (easy to click and code, but nightmare to maintain if GUI, DB and logic are mixed) - true OOP coding is IMHO mandatory for any serious project.