Delphi Best Practices For A New Project In 2021 And Beyond

The goal of this tutorial is to describe the Delphi development ecosystem. It can be helpful for someone coming to Delphi from another programming language.

Delphi is really easy to learn – the programming language syntax can be learned in hours. Pascal, from which Delphi’s Object Pascal language has evolved, has long been a very popular language in colleges and education for teaching the basic concepts of software development. Knowing the fundamentals of programming is a crucial part of programming. But there lies a whole ecosystem of terminology and techniques. It is always overwhelming for someone coming from a different background in technology.

The other trouble is that there are so many different Delphi components, examples and libraries available and it can be quite daunting to decide which ones are the best for any given purpose. You’re spoilt for choice and sometimes too much choice can bring its own headaches.

So to try and ease this small learning curve this article brings together a list of some of the most popular tools, libraries, best practices in Delphi. You may find more interesting demonstrations, tips, and tricks on our blog.

How to start Delphi development?

The first thing to do is to download Delphi from You can find the latest Delphi 10.4.2 Community Edition which is free for everyone. Be sure to install Delphi IDE with samples and help files that might come for help sometime in the future.


How to work with Delphi programs in another code editor like VS Code?

There is an official extension for Embarcadero Delphi in VS Code marketplace which provides you to work with the Delphi code in VS Code smoothly. Note that you need an active license (paid or trial) for Delphi 11 in order to use the DelphiLSP VS Code add-on. It will not work with the community edition.


Yo use the DelphiLSP VS Code Add-In you just need to have the latest version of Embarcadero Delphi installed on your machine and generate an LSP config file.


How to write readable and maintainable code in Delphi?

Embarcadero Delphi compilers ignore any whitespace and allow for a lot of flexibility for writing code. But for the readability and maintainability purpose of the source code, Embarcadero has defined the style guide for Delphi’s Object Pascal. I recommend you to check out and learn how to write beautiful code with Object Pascal – or at least code that others find fits in with the generally accepted layout styling which is important if you work with a team or contribute to an Open Source project.

How to format Delphi source code?

Every developer writes code in their style. Since the Embarcadero compilers ignore any whitespace in which you can write the same code in hundreds of different ways, this can lead to unreadable source code.

We can prevent this by applying default source code formatting or generate our formatting config file.

While coding in the Code Editor, you can apply the Format Source context menu command to format the source code. Moreover, you can define your custom formatting style and save it to a config file. Then other team members can also utilize the same formatting style to make the source code maintainable.

Check out the official documentation to learn more about this.

Delphi GetIt Package Manager

Does Delphi have a package manager?

If you have been developing web apps you are familiar with different package managers. the Delphi ecosystem package manager is called The GetIt Package Manager which comes with the IDE. Moreover, there is the GetIt Portal where you can see all of the available packages.

But if you need a command-line like a package manager, you can use open-source Delphi package managers like boss or MultiInstaller. These package managers provide installing Delphi packages directly from git repositories and can configure a Delphi project.

How to do unit testing in Delphi?

Testing is an essential part of the software development lifecycle. In Delphi, you can do unit testing with the DUnitX open-source test framework – it enables you to develop and execute tests against Win32, Win64, macOS, and Linux in Delphi applications.

There is a full article on unit testing with DUnitX in Delphi:

How can I test independent units in Delphi?

One of the tricks with unit testing is to separate dependencies, but if your code depends on a database or network socket, how do you test it by itself? Enter Mocks. A brilliant tool to let you test the independent units of code without dependencies – Delphi-Mocks

How to create a fully functional cross-platform application with Delphi?

Delphi FireMonkey provides multi-platform development with a single code base. This means that you can target Android, iOS, macOS, Linux, and Windows by writing one application. Moreover, FireMonkey offers a wide variety of functionalities to you to customize as much as you by accessing platform-specific features through interfaces.

Here is a demonstration video that shows you how to create a cross-platform app in under 30 seconds with FireMonkey App Low Code Wizard.

How to integrate RESTful web APIs into a Delphi app?

There are several ways to integrate APIs into the Delphi application. The easiest way is to utilize REST Client components and REST Debugger. The REST Client components are enterprise-grade components that provide easy and fast integration with any web API.

In this tutorial, you can learn how to integrate one of the market-leading news API into the Delphi FireMonkey app and create a News application!

How to EASILY create REST-based applications in Delphi?

Delphi supports REST through the DataSnap infrastructure, support for WebBroker integration, and the creation of JavaScript proxies for methods exposed by web service.

You can create complex & business-grade REST-based applications using DataSnp in Delphi. Or you can use RAD Server which provides more functionality and better flexibility and scalability for your services-based apps.

Furthermore, you can utilize different open-source libraries and frameworks to build RESTful applications. This includes:

  • Horse web framework for Delphi – Fast, Opinionated & Minimalist
  • DMVCFramework popular & powerful web framework – Supports RESTful and JSON-RPC APIs development and offers official handbook.

Frequently, the cause of problems is a result of not knowing the language properly. Moreover, if you’re not aware of libraries, frameworks, and tools in the ecosystem, this might lead to over-engineering – doing the hard work yourself when someone has already done it all before and has all the answers for you.

To better understand the Delphi ecosystem and be able to apply industry best practices, I would like you to learn it with real-world examples. These samples provide you to grasp different techniques to build various applications with Delphi.

How about a final bonus list of useful Delphi links?

  • The curated list of all the shiny things in the Delphi/Object Pascal ecosystem – awesome-pascal
    • Game, multimedia, database, scripting, non-visual components for better and quicker Delphi development
  • Parallel Programming to achieve high performance
  • Analyze source code – Pascal Analyzer and Delphi Parser tools can be used to analyze and find issues in the code.

These are just part of the whole list. If you have some things to share, leave a comment!

RAD Studio can take your great ideas and turn them into reality – on Windows, macOS, Linux, iOS and Android. Why not download a free trial and see what it can do for you?

Sneak Peak for RAD Studio 11