SOLID principle 4: Interface Segregation. “Clients should not be forced to depend upon interfaces that they do not use.”

The interface segregation principle is about finding the most appropriate abstractions in your code. Wikipedia has a nice description of this principle: “ISP splits interfaces that are very large into smaller and more specific ones so that clients will only have to know about the methods that are of interest to them. Such shrunken interfaces are also called role interfaces “.

Let’s have a look at our previous Delphi interfaces from the Liskov Substitution Principle:

type
IBaseEmployee = interface
<getters and

The Liskov Substitution Principle in Delphi! I start with the official definition:

Subtype Requirement: Let Φ(x) be a property provable about objects x of type T. Then Φ(y) should be true for objects y of type S where S is a subtype of T.

Still here and wondering what that means? Good, I had some trouble understanding this too. 😊

Let us take a more practical approach to LSP: The principle defines that objects of a superclass shall be replaceable with objects of its subclasses without breaking the application. …


The second principle of SOLID is the Open/Closed principle: ‘Classes and other entities should be open for extension but closed for modification’. This article is about how in Delphi you keep a class closed for modification, but open for extension.

Let me emphasise one part; achieving this goal via inheritance or overriding classes is a bad idea in my opinion. If you want to read more about this, check out what Bertrand Mayer and Robert C. Martin have to say on this subject.

Okay, let’s take the following example:

type
TShip = class
// This is the actual ship
end;


Today, we’ll dive into the S of the Solid principles: The Single Responsibility Principle. But before we start, just a quick refresher on Solid.

SOLID is an acronym for a set of five software development principles, which if followed, are intended to help developers create flexible and clean code. The five principles are:

The Single Responsibility Principle — Classes should have a single responsibility and thus only a single reason to change.

The Open/Closed Principle — Classes and other entities should be open for extension but closed for modification.

The Liskov Substitution Principle — Objects should be replaceable by their…


Photo by Kelly Sikkema on Unsplash

Always wanted to know how to use Dependency Injection with Delphi? I’ve set up an example for you in which we go from strongly coupled code to beautiful, uncoupled code in a few steps via Dependency Injection and with the help of interfaces.

We’ll start with the following example:

unit DI1;interfacetype
TLanguageTools = class
private
procedure CheckGrammar;
procedure Translate;
end;
TWordApp = class
private
FLanguageTools: TLanguageTools;
public
constructor Create;
end;
implementationconstructor TWordApp.Create;
begin
FLanguageTools := TLanguageTools.Create;
FLanguageTools.Translate;
end;
{ TLanguageTools }procedure TLanguageTools.CheckGrammar;
begin
//
end;
procedure TLanguageTools.Translate;
begin
//
end;
end.

As you can see, there…


As a developer, you can always improve yourself, acquire skills, learn to program better. This can be done simply by programming more (and thus learning from the mistakes you make), but if you really want to get a push, you can best make use of the knowledge of others. That’s why at GDK Software we have a policy that you can always buy books at the expense of the company. You’ll earn this investment back in no time.

At GDK Software we work with both Delphi and Mendix. …


Photo by Carlos Muza on Unsplash

Last week, I analysed the top 1000 Delphi projects on GitHub, mainly out of curiosity, and also to play with another programming language (Python). I took Delphi projects because we at GDK Software have many customers with this programming language.

To be able to do the analysis, I did the following steps:

  1. Using the GitHub API, I created a list of Delphi projects (sorted by the number of stars).
  2. I cloned every repository to my environment.
  3. Then I analysed the source code. I mainly looked at some interesting statistics that I could get out of the code in this way.


Photo by Leone Venter on Unsplash

The absence of a good package manager in Delphi is, after 25 years, still a big problem. There are a lot of excellent third party components and libraries available for Delphi. It is what makes the development in Delphi so easy.

Unfortunately it also causes a problem with new installations, or when taking over a project from someone else. If you don’t have the right libraries and components installed you have a problem. Wouldn’t it be great to have a package manager -as available for many other languages and platforms- to resolve this automatically? …


#Delphi25th

This year (2020) Delphi celebrates its 25th anniversary. In those 25 years an enormous amount of code has been written. Many of these applications are still in full use by companies and individuals. This shows the power of Delphi; code written decades ago still works, even in the latest Delphi versions.

Still, there are some remarks to be made about this praise. Unfortunately we see that there are also many applications that are still being developed in old Delphi versions. That is a pity, because the new versions of Delphi really have a lot of advantages. …


Photo by Tim van der Kuip on Unsplash

At GDK Software we have been working with Delphi for years. We have collected quite a few tricks and tips, which I would like to share with you. I have organized Delphi’s tips and tricks into the following topics:

  • Delphi plugins
  • Delphi IDE Shortcuts
  • Live Templates (or Code templates)
  • Various useful links

Enjoy!

Delphi plugins

As a Delphi developer, you are working with the Delphi IDE on a daily basis. And although the Delphi editor works fine by itself, with the following plugins you can make your work even easier:

Marco

Co-owner of GDK Software, Delphi developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store