What language is used in delphi. About programming and Delphi

Website:

Delphi(Delphi, pronounced /ˈdɛlˌfi:/ listen)) is an imperative, structured, object-oriented programming language, a dialect of Object Pascal. Starting with the Delphi 7.0 development environment, Borland began using the name Delphi to refer to the Object Pascal language in official documents. Since 2007, the Delphi language (derived from Object Pascal) began to live its own independent life and underwent various changes associated with modern trends (for example, with the development of the .NET platform) in the development of programming languages: class helpers, operator overloading, and more appeared.

Target platform

Initially, the development environment was intended exclusively for the development of Microsoft Windows applications, then it was also implemented for Linux platforms (as Kylix), however, after the release of Kylix 3 in 2002, its development was discontinued, and, shortly thereafter, support for Microsoft .NET was announced .

The Lazarus project's implementation of the development environment (Free Pascal, compiled in Delphi compatibility mode) allows it to be used to create Delphi applications for platforms such as Linux, Mac OS X and Windows CE.

There have also been attempts to use the language in GNU projects (such as GNU Notepad) and write a compiler for GCC.

History of the language

Object Pascal is the result of the development of the Turbo Pascal language, which, in turn, developed from the Pascal language. Pascal was a completely procedural language, Turbo Pascal, starting with version 5.5, added object-oriented properties to Pascal, and dynamic data type identification to Object Pascal with the ability to access class metadata (that is, the description of classes and their members) in compiled code , also called introspection - this technology is designated RTTI. Since all classes inherit the functions of the base class TObject, any pointer to an object can be converted to it, and then use the ClassType method and the TypeInfo function, which will provide introspection.

Another distinctive feature of Object Pascal from C++ is that objects are located in dynamic memory by default. However, you can override the NewInstance and FreeInstance virtual methods of the TObject class. Thus, absolutely any class can fulfill the “desire” “where I want, I will lie there.” “Multi-grouping” is organized accordingly.

Object Pascal (Delphi) is the result of a functional extension of Turbo Pascal.

Delphi was hugely influential in creating the language concept for the .NET platform. Many of its elements and conceptual solutions were included in C#. One of the reasons is the transfer of Anders Hejlsberg, one of the leading Delphi developers, from Borland Ltd. at Microsoft Corp.

  • Version 8 is capable of generating bytecode exclusively for the .NET platform. This is the first environment focused on the development of multilingual applications (only for the .NET platform);
  • Subsequent versions (indicated by release years rather than serial numbers as previously) can produce both Win32 applications and bytecode for the .NET platform.

However, in November of the same year, it was decided to abandon the sale of the IDE business. However, the development of IDE products will now be handled by a new company - CodeGear, which will be completely financially controlled by Borland.

In August 2006, Borland released a lightweight version of RAD Studio under the name Turbo: Turbo Delphi (for Win32 and .NET), Turbo C#, Turbo C++.

In March 2008, it was announced that development of this product line would be discontinued.

In March 2007, CodeGear pleased users with the updated line of Delphi 2007 for Win32 products and the release of a completely new product, Delphi 2007 for PHP.

In June 2007, CodeGear presented its plans for the future, that is, it published the so-called roadmap.

Embarcadero RAD Studio 2010

  • By default, full Unicode support in all parts of the language, VCL and RTL; replacing calls to all Windows API functions with Unicode analogues (that is, MessageBox calls MessageBoxW, not MessageBoxA).
  • Generalized types, aka generics.
  • New $POINTERMATH compiler directive.
  • The Exit function can now accept parameters according to the function type.

Compilers

  • Embarcadero Delphi (formerly CodeGear Delphi and Borland Delphi) is probably the most famous compiler that is a successor to Borland Pascal and Turbo Pascal. Uses Win16 (Delphi 1), Win32 (Delphi 2 and later), Win64 (Delphi 16 (XE2) and later), as well as .NET 1.x, 2.0 (Delphi 8, Delphi 2005-Delphi 2007). .NET support was subsequently spun off into a separate product known as Oxygene.
  • Free Pascal (FPC) is a free Object Pascal compiler that supports various Pascal dialects, including Turbo Pascal, Delphi and its own dialects. Currently, FPC can generate code for x86, x86-64, PowerPC, SPARC and ARM processors, as well as for various operating systems, including Microsoft Windows, Linux, FreeBSD, Mac OS. There are several software development environments for FPC (one of the most famous representatives is Lazarus).
  • GNU Pascal (separately developed version from GCC). It does not aim to continue the series of Delphi dialects as part of Pascal, but nevertheless contains a compatibility mode for Borland Pascal, and very slowly accommodates components of the Delphi language. Not suitable for compiling large projects containing Delphi code, but it is worth noting that most operating systems and architectures support it.
  • Oxygene (formerly known as Chrome listen)) is an Object Pascal compiler that is integrated into Microsoft Visual Studio. Also available as a compiler with a free CLI command line. Uses .NET and mono platforms. Currently sold under the Embarcadero Delphi Prism brand.
  • MIDletPascal is a programming language with a Delphi-like syntax and a compiler of the same name that converts source code into compact and fast Java bytecode.
  • PocketStudio - Pascal-based, IDE for Palm OS.
  • Virtual Pascal - Free compiler and text IDE for Win32, OS/2 and Linux. At that time it was very fast and very compatible (Delphi 5 designs are partially supported). Externally, it is very similar to the Borland Pascal 7 text environment, although there are no graphics compatible with it, for example. However, development ended in 2004, and the source code was not open. Since then, FPC has come a lot forward and is generally better for programming. Nevertheless, VP remains a very good option for quickly replacing even more outdated versions of Borland Pascal for school/institute, given its native work in Win32 without problems with Russian encodings.

Language syntax

Operators

List of operators separated by spaces: := + - * / div mod not and or with xor shl shr ^ =<> >= <= < >@in is as

Expressions

Expressions in Object Pascal (Delphi) can be arithmetic, logical, or string.

Basic logical expressions:
Logical expressions are mainly used in conditional statements. Logical expressions include operations such as:

  • not - “NOT”, negation of a logical expression (NOT<логическое_выражение>)
  • and - “And”, multiplication (intersection) of logical expressions (<логическое_выражение1>AND<логическое_выражение2>)
  • or - “OR”, combining logical expressions (<логическое_выражение1>OR<логическое_выражение2>)
  • xor - “Exclusive OR”, negation of OR, everything that does not fall under OR (<логическое_выражение1>XOR<логическое_выражение2>)

Data types

The data processed in the program is divided into variables, constants and literals. Constants are data whose values ​​are set in the constant declaration section and do not change during program execution.

Objects

  • Embarcadero products: Embarcadero Delphi, Embarcadero C++ Builder, Borland JBuilder versions 1 and 2.
  • Database administration and development: MySQL Tools, IBExpert.
  • Engineering software: Altium Designer.
  • File managers: Total Commander, Frigate.
  • Graphics viewers: FastStone Image Viewer, FuturixImager, drComRead.
  • Video and audio players: Light Alloy, The KMPlayer, AIMP, X-Amp.
  • Instant messaging programs: QIP, R&Q, Skype GUI, The Bat! , PopTray , FeedDemon .
  • Music creation: FL Studio, Guitar Pro (up to version 6.0).
  • Software development: Dev-C++, DUnit, Game Maker, Inno Setup, PyScripter.
  • Web Development: Macromedia HomeSite.
  • Text editors: BirEdit, Notepad GNU, Bred.
  • Accounting and taxation: “PARUS”, AVARDA (up to version 6.x inclusive).
  • Programs for creating animations: Pivot Stickfigure Animator.
  • Data compression programs: ALZip, PowerArchiver, PeaZip.
  • Computer games: Age of wonders, Space Rangers, Venom. Codename: Outbreak, Space Empires V, "The Truth about the Ninth Company."
  • Graphic editors: Real Paint.

Notes

Literature

  • Neil J. Rubenking. Delphi programming language for dummies. Introduction to Borland Delphi 2006 = Delphi for Dummies. - M.: Dialectics, 2007. - 336 p. - ISBN 0-7645-0179-8
  • Javier Pashecu. Programming in Borland Delphi 2006 for professionals = Delphi for .NET Developer’s Guide. - M.: Williams, 2006. - 944 p. - ISBN 0-672-32443-X
  • A. N. Valvachev, K. A. Surkov, D. A. Surkov, Yu. M. Chetyrko. Programming in Delphi language. Tutorial . - 2005.

Links

  • Programming environment page on the website Embarcadero Technologies

So, in this article we will talk about how to determine the bitness of the Windows operating system when programming in Delphi. This is necessary in order, for example, to select one or another driver version - x86 (32 bit) or x64 (64 bit).

So, let's get started.

Let's create a new project and add a Label component to the form.

Then we go to the source code editor and in the section with var variables, add the razr string variable (string data type, i.e. string).

var Form1: TForm1;

razr: string;

After that, double-click on the form, copy and paste the following code into it (in the procedure for creating the main form TForm1.FormCreate), between the phrases begin and end; (that is, the beginning and end of the procedure).

(using the Get Environment Variable function we read the value of the ProgramFiles(X86) variable

if the system is 32-bit, then it will have an empty value

if 64-bit, then it will have knowledge of C:Program Files(x86)

i.e. the folder in which 32-bit versions of programs are installed)

razr:= GetEnvironmentVariable("ProgramFiles(x86)");

label1.Caption:= razr;

if (razr = "") then

begin

label1.Font.Color:=clRed; (Changes the color of the inscription, you can choose any one to your taste, for example clGreen - green)

label1.Caption:= "You have x86"; (instead of the label name labl1 you can write anything else, for example metka)

else

begin

label1.Font.Color:=clBlue; (Changes the color of the inscription, you can choose any one to your taste, for example clGreen - green)

label1.Caption:= "You have x64";

end;

How does the program work?

The Get Environment Variable function reads the value of an environment variable in Windows ProgramFiles(X86).

If the system is 32-bit, then it will have an empty value.

If it is 64-bit, then it will have the knowledge C:Program Files(x86), i.e. this is the folder into which 32-bit versions of programs are installed.

Actually, that's all.

This is what happened to me.

Below you can download the archive with the source code of the program to try to figure out how it works on your own.


Comments ()

wdfm 90

The program works fine on Windows 7 x64, you can use it

Edward 300

Anyone who starts an off-topic + obscene language will be banned for 1 day! This does not apply to administrators.
.php?board=18.0

I didn’t create this forum for nothing!

Edward 300

Introduction

These guidelines are designed to help students gain practical skills in the technology of visually designing their own applications for Windows in the Delphi environment using object-oriented programming methodology. Laboratory work covers the main stages of program development for Windows.

The guidelines consist of three sections. The first section provides a description of the basic concepts of visual application design and the Delphi programming environment. The second section formulates general requirements for the implementation and presentation of laboratory results. The third section consists of descriptions of specific laboratory work with the necessary brief theoretical information, examples of program design, recommendations for performing work, variants of tasks for performing work and questions for self-test. To complete the work, students must be familiar with the Object Pascal language and the Delphi visual programming environment.

Basic concepts and definitions of Delphi

delphi program array visual

The screen after launching Delphi contains four windows: the main window, the forms, the object inspector and the code editor, which is almost completely covered by the form window.

The main window contains the Delphi command menu, toolbar and component palette.

The form window, its title FORM1, represents a template, a layout of one of the objects of the application being developed.

The Object Inspector window, its Object Inspector title allows you to see and change the properties of project objects. After launching Delphi, this window displays the properties of the FORM1 form.

The code editor window is intended for creating event handling procedures. In Delphi, code is the text of a program.

Objects or controls are form components from which a project is created; by the way, the form itself, as mentioned above, is also an object. Objects can be command buttons, text input fields, switches, labels, scroll bars and windows.

The properties of an object are, for example, the size of the title text, the background color of the form or the text on the command button and much more; a complete list of properties can be seen in the Object Inspector window for the selected object.

An event is something that happens while the application you created is running. In Delphi, each event has a name, for example, a mouse click is an OnClick event, a double click is an OnDblClick event.

A project is a set of files (program units - modules), using which the compiler creates an executable program file. One of the project files, called the project file and with the extension dpr, contains a general description of the project. The project file is the main application module that is generated by Delphi. In addition to the main module, the project includes one or more modules (Units). Project module files (Unit) contain the texts of procedures, functions, descriptions of types, as well as all the information for creating an executable program, and have the pas extension. A procedure is a group of operators in a programming language that allows you to perform specific actions (solve a problem). One way or another, all the executable code you compiled for initialization is necessarily placed in some procedure.

A Unit consists of three sections: interface (starts with the word interface), implementation (starts with the word implementetion) and. Below is the structure of the module.

unitModuleName;

(Here are descriptions of procedures and functions of this module that can be used by other modules)

(Here are declarations of module global constants that can be used by module procedures and functions)

(Here are declarations of global module types that can be used by module procedures and functions)

(Here are declarations of module global variables that can be used by module procedures and functions)

(Here are descriptions of module procedures and functions)

(Instructions for the module variable initialization section are located here)

Thus, the interface section tells the compiler which part of the module is accessible to other program modules. The implementation section begins with a directive ($R*.DFM), which tells the compiler to use a form description when generating the executable file. the form description is located in a file with the dfm extension, the name of which matches the name of the module. The directive ($R*.DFM) is followed by event handling procedures for the form and its components. The programmer can also place developed procedures and functions here. If the initialization section does not contain instructions, then the word begin is not specified.

Delphi is a programming language and software development environment. It is developed by Borland (formerly known as Inprise). Delphi programming language, formerly known as Object Pascal(Pascal with Object Oriented Extensions), originally targeted only at Microsoft Windows, but now allows you to build native applications for Linux and Microsoft. NET Framework, and others (see below). Programming for beginners.
The most popular use is the development of desktop applications and enterprise databases, and as a tool the Delph programming language And can be used for most types of developing projects. It was one of the first languages ​​to become known as a RAD (Rapid Application Development) tool when it came out in 1995. Delphi 2, released a year later, supported the 32-bit Windows environment, and only a few years later C, C++ Builder came out. In 2001, a Linux version became available known as Kylix (classical Greek urn). Each year there was one new version, in 2002 the product became known as Delphi 7 Studio, the language became officially called the Delphi programming language rather than Object Pascal, and support for Linux was added (via Kylix) and. NET (via the Precompiler). Full support. NET is planned for the upcoming Delphi 8. Programming for dummies.
The main components of Delphi and Kylix: the Delphi language (formerly officially known as the Object Pascal language), VK/CLX (Visual Component Library), strong database connections, combined with a powerful IDE (Integrated Development Environment) and additional support tools.
Great features of the Delphi language include:

  • Transparent handling of objects via references or pointers
  • Properties as part of the language, coupled with Get and Set functions that transparently encapsulate access to field members
  • Index and default properties that provide access to the collection in a convenient and transparent way
  • Delegates, or otherwise type-safe pointer methods, that are used to fire events raised by components
  • Delegating an interface implementation to a field or property of a class
  • Easy to implement Windows message handlers, mark a class method with the number/name of the message box to handle
  • Most of the features listed above were introduced in Delphi first and adopted into other languages ​​later.

The chief architect of Delphi, and its predecessor Turbo Pascal, was Anders Hejlsberg until he moved to Microsoft in 1996 to devote his work to programming fundamentals.
The Delphi product is distributed in various packages, each of which offers more functionality than the others:

  • Personal
  • Professional
  • Company
  • Architect

Good reasons to use Delphi:

  • Very informative and useful news for the community
  • Can compile into a single executable, making it easier to distribute and reduce issues with different DLLs
  • VCL and third party components are generally available with full source code
  • Powerful and fast optimizing compiler
  • One source code produces excellent machine codes for different operating systems
  • Support for the latest technologies and standards

Clones and alternatives

While not able to satisfy all the needs of programmers, there is a whole set of additional tools that are designed to expand the range of tasks solved using Delphi, or this can be done by inserting code in other languages ​​where Delphi and Kylix are powerless.
These Delphi substitutes can be used if you cannot pay for a development environment, need free development environments (for example, for operating systems and free software, or for educational purposes). In most cases, these alternatives are used for training, as well as for writing server components, for operating systems that are not widely used (this was until Kylix appeared for the Linux OS, which is used by the majority as an OS for servers ). .
Let's list some:

  • Free Pascal is a replacement that comes as a compiler that runs from the command line. This development is based on compatibility with the basic set of functions of both Turbo Pascal and Delphi dialects. Features of Delphi versions above 4 are implemented and working. Works on most x86 operating systems, including Win32, Dos, Linux, BSD and Novell Netware. There is no support for other operating systems on m68k and PowerPC, the status of which is still changing very quickly. Work on transferring to the SPARC platform has begun.
  • GNU Pascal (a separately distributed part of the GNU Compiler Collection), although not formally aimed at Borland Pascal dialects, does contain compatibility with Borland Pascal, and gradually absorbs the features of the Delphi language, although it is not suitable for recompiling large amounts of Delphi code. It is the most prolific compiler in terms of operating systems and processors, although it deserves mention only as a last resort.
  • There is a tool called Pocket studio that aims to compile stripped-down Delphi code for Pocket PCs.
  • Virtual Pascal - compiler, x86 32-bit Turbo Pascal and Delphi, compatible primarily with OS/2 and Windows, although a DOS Extender and an experimental Linux cross-compiler have been developed. The compiler is stuck at around Delphi version 2 and the site hasn't changed much in two years, but alternatively it's another of the best, with a great IDE and debugger, although Free Pascal is no slouch either.
  • BloodShed distributes a very good Win32 graphics editor (though not RAD) as an interface to GNU Pascal and Free Pascal.
  • Lazarus efforts are aimed at creating a development environment for Free Pascal. While the GTK port is becoming useful for writing small applications such as configuration tools, the win32 port still needs a lot of work.
  • InnerFuse is a Delphi translator for embedding into applications. There are rumors that work with several versions of Delphi.
  • WDOSX is a Win32 DOS Extender emulation API that can be used to get console applications written in Delphi running on regular DOS.

How to become a website development professional and start making money? Inexpensive video courses with an introductory introduction.

Let's begin our introduction to programming in the Delphi environment with questions such as the essence of programming itself, its basics and subtypes. We will also look at what the Delphi environment is, how it differs from others, and what path it has traveled since its inception 10 years ago.

What is programming

So, first of all, let’s understand for ourselves what is meant by the term programming? Now many people call themselves programmers, without even knowing what it is: when checked, it turns out that a person who has changed a couple of lines of code in an HTML document is already ready to consider himself a programmer. But in fact, working with HTML (namely, HTML itself), you cannot become a programmer, since HTML, as the name implies (Hypertext Markup Language), is not a programming language.

As a result, we have the first condition: to learn programming you need some kind of programming language. In our case, this will be the latest versions of Object Pascal (14.0 or 15.0).

Further, let's say someone who calls himself a programmer not only edited a couple of lines of HTML code, but also saw Delphi, and even drew a form in it with 2-3 buttons and a text field. Is this a programmer? Most likely not either. The fact is that under the visual shell, in fact, hides a very complex mechanism that ensures the interaction of controls (the same buttons) with the user and the operating system - on the one hand, and allows you to perform almost any computational action - on the other. With all this, you should be able to do the main thing - create algorithms for the behavior of the program - be it its reaction to pressing a particular button, or creating a function for solving a complex mathematical equation.

So, programming in its modern concept includes knowledge of the principles of operation of the operating system, the interaction of its components and internal structure. Well, at the same time, the classic definition of programming is preserved, namely, the ability to compose algorithms, mathematical and behavioral programs. All this is implemented in the context of some programming language, for example, the same Object Pascal from Delphi.

What is Delphi

Now we know that programming is the compilation of algorithms plus the use of a programming language. But if the language we are learning is Object Pascal, then what is Delphi? The answer is: Delphi is RAD, or Rapid Application Development - a rapid application development environment. In other words, Delphi includes not only all the tools for working with the Object Pascal language (especially since, starting with version 2005, Delphi has support for other programming languages, in particular C#), but also a number of additional tools designed to speed up the process as much as possible. and simplify the creation of programs. These tools include, first of all, a visual form editor, with the help of which you can create a full-fledged program in a matter of minutes and without extra effort, as well as other components of the visual component of program development.

As a result, program development time is significantly reduced, since there is no need to manually calculate the location of each user interface element.

Together with developed tools for writing and debugging code - a specialized text editor, an optimizing compiler and a debugger, Delphi is a tool for rapid application development. At the same time, the basis of Delphi for the end user is the IDE - Integrated Development Environment, which combines a code editor and visual development tools, and also connects this with a compiler, database development tools and other components of Delphi.

Delphi and others

Of course, Delphi is not the only rapid application development environment. There are other RADs that are equally useful for visual program development, such as Visual Basic. But BASIC is known as not the most powerful and convenient programming language; in addition, programs written on it are characterized by relatively low performance.

At the same time, there are programming languages ​​that are no less powerful than Object Pascal and have their own RADs - first of all, this is the C++ language along with such well-known development tools as Visual C++ and C++ Builder. However, C++ does not compare favorably with Object Pascal in terms of ease of learning. In addition, building and debugging programs in C++ is relatively slow, although ready-made programs run just as fast as those created using Delphi.

NOTE
Note that at the time of its appearance in 1995, Delphi was a truly unique environment that combined visual programming with an optimizing compiler and tools for working with databases.

As a result, we get an almost ideal product for rapid program development: on the one hand, simplicity and convenience comparable to Visual Basic, and on the other, the power, speed and flexibility characteristic of C++.

It should be noted here that the Object Pascal language used in Delphi has little in common with its progenitor - the Pascal programming language, which you may have studied at school or university. First of all, Delphi uses a pure object-oriented programming model, while Pascal was a regular procedural language. What is the essence of the differences between procedural programming and object-oriented programming? This is the question we will discuss in the next two paragraphs.

Procedural programming and algorithms

Almost all modern programming languages ​​are procedural in nature. This means that each program consists of a set of procedures, each of which solves a particular problem, while one procedure can call any other, including itself (the latter, i.e. a procedure calling itself, is called recursion) . The program itself is compiled on the basis of algorithms, and only three varieties of them are sufficient - selection (fork), repetition (cycle) and transition. However, the latter type is practically not used in practice due to its bad reputation (we are talking about GOTO - the once beloved, out of despair, operator of BASIC programmers).

Let's look at the simplest algorithm - for the game "guess the number". The logic of its operation is that you need to check whether the number is greater or less than the hidden one, and if so, you will display the corresponding hint, and if it is neither greater nor less (i.e. matches) then the game ends . The block diagram of such an algorithm will consist of 2 branches (Fig. 1.1).

Rice. 1.1. Flowchart of a simple algorithm

The first step here is to ask the user for a number A, which is compared twice with a pre-specified number B. First, it checks to see if the number A is greater than B, and if so, the program reports that a "overshoot" has occurred and returns to the entry point numbers. If the number is not greater, then a second comparison occurs - to see if A is less than B. If this is the case, then a message is displayed stating that the number is less ("undershot") and, again, a return to the beginning occurs. But if the number A is not less than the number B, then, given the fact that at the moment it is already known that it is not greater, therefore, it is equal to the number B, and the program terminates. At the same time, it can display congratulations to the user for guessing the number.

This algorithm may be part of another algorithm. For example, there is no provision for generating the number itself that needs to be guessed. There is also no replay option. To correct this situation, consider a block diagram of the algorithm that controls the execution of the program as a whole (Fig. 1.2).


Rice. 1.2. Program control flowchart

At the beginning of execution, a new number is generated that the user will guess. Then comes the guessing block itself, which we have already considered (see Fig. 1.1) - here it is presented in the form of one simple module, since it does not affect the execution of the program as a whole. Upon completion of this block, we have a single branch - depending on what the user responds to the offer to repeat the game. So, if the answer is positive, then the program will have to go to the beginning, i.e. to generate a new number. If the user refuses, then the program must be terminated.

The specific implementation of a particular algorithm depends on the programming language used, as well as on the preferences of the program creator, since, as a rule, the same construction can be solved using several different methods. For example, you can use both loops and unconditional jump statements to return to a point indicated on a block diagram. Well, the blocks themselves can be placed in separate procedures and called as subroutines. The only common feature is the conditional operator responsible for the fork - in almost all languages, and Pascal is no exception, it is called IF. However, we will still have time to get acquainted with the Object Pascal operators.

About object-oriented programming

If selecting, repeating, and jumping are the cornerstones of any procedural programming language, then object-oriented programming concepts such as encapsulation, inheritance and polymorphism are important. Let's look at these concepts, without which no object-supporting language can be called object-oriented, in more detail.

NOTE
The term “object” in programming is understood as a certain complex data type to which unique properties for this type can be attached, and in the case of OOP, also methods.

Encapsulation is the combination of data and the subroutines that process them - methods - inside one object, called a "class" in OOP. This means that the class encapsulates everything necessary to work with a particular object.

Inheritance is another important part of OOP. Inheritance means the ability to create a type (object) based on the definition of another object. In this case, all properties and methods of the parent object can be inherited by the child. For example, if we have a “car” object, then on its basis we can create another object, say, “tram”, which will inherit all its properties and receive, in addition to them, some of its own. In turn, this object will also be able to have its own descendants, etc. The result is a tree of objects called a class hierarchy.

In Object Pascal, all classes descend from a single ancestor - the TObject class, which implements actions on an object common to all classes, such as creation and deletion.

ADVICE
The boxed versions of Delphi include a poster showing the class tree for all the main Delphi components. Therefore, if you are the happy owner of a licensed product, you can visually study the structure of this system by placing this poster at your workplace.

Finally, the third pillar on which OOP stands is polymorphism, or the ability to create properties and methods of the same name within related objects, which will differ in essence. Let's say we already have the classes “car” and “tram”, and for both the “motor” property is defined, but if for a car the motor type is an object of one type, then for a tram it is a completely different one.

Another important component characteristic of OOP is hiding, which allows you to make a number of object properties invisible. In other words, if we can define an object of type “car”, for which, in turn, properties such as chassis, motor and wheels are defined. So, if the engine and wheels can be made visible (and accessible) everywhere where the “car” class itself is available, then the chassis cannot. Accordingly, access to such a property can only be obtained in those parts of the program in which the description of the “machine” object itself is made. Such properties are called protected.

More details about object-oriented programming will be discussed in the second part of this publication.

Visual Programming and Delphi

So, Delphi is an environment that works with the object-oriented structural programming language Object Pascal. In addition to this, Delphi is also a visual development environment. In other words, already in the process of creating a program you can see how it will look during execution. Visual programming dramatically reduces the time required to create a user interface for Windows applications. Before the advent of visual development tools, programming under Windows was fraught with great difficulties, since it was necessary to almost blindly calculate the location of each control in the application window, which led to many errors (Fig. 1.3).


Rice. 1.3. Classic and visual approaches to creating an interface

The fact that Delphi is a visual development environment leaves its mark on the programming language. In particular, it provides special means so that certain properties of classes can be available already at the stage of program development, and not just at run time. But the most important part of all this splendor is the class library - VCL (Visual Component Library). It is the VCL that hides all the rough edges of Windows internals, and allows you to easily create applications without engaging in a protracted war with the processing of system messages, callbacks, handles and pointers.

With all this, of course, no one forbids you to use Windows functions directly, bypassing VCL, if necessary. However, this may be needed very rarely, so for a novice Delphi programmer, nothing other than VCL is required to write Windows applications.

We will look at visual components in detail in Part 3 of this book.

Delphi versions and their differences

At the end of the introductory part, we will look at the differences between versions of Delphi, simultaneously studying the history of the development of this wonderful development environment.

Delphi 1. Released shortly before the advent of Windows 95, Delphi 1.0 was the first Windows (3.1) application development tool to combine an optimizing compiler, a visual development environment, and powerful database tools. This was a real reincarnation for the Pascal language - it became Object Pascal.

Delphi 2. The 2nd version of Delphi, released a year later, offered all the same, but for 32-bit versions of Windows (95/NT), again becoming the first tool combining a 32-bit compiler, tools for working with databases and a visual development environment, supporting OLE (and after the release of the updated Delphi 2.01 - and ActiveX). The language has also changed, becoming 32-bit oriented.

Delphi 3. Further improvement of Delphi in all directions led to the release of version 3, which had an expanded set of tools for creating applications thanks to support for COM and ActiveX. In this version, for the first time, emphasis was placed on the ability to create applications for the Internet, and an untyped data type - variant - appeared.

Delphi 4. Another key development milestone. In this version, many new and useful things were introduced to simplify application development, including a new environment with dynamic hints, etc. The model for working with components (VCL) was improved, and it became possible to quickly use technologies such as MIDAS, DCOM and CORBA. In this version, the Object Pascal language was also improved: new features characteristic of modern OOP appeared, new data types were introduced, including 64-bit ones.

Delphi 5. There were so many changes in Delphi 4 that, unfortunately, there were some annoying bugs and bugs. The result was the release of 3 update packages (our pirates sold them under the guise of Delphi 4.1, 4.2 and 4.3). But Delphi 5 should be considered the most complete and correct update package - in this version everything that was started in Delphi 4 was brought to fruition.

Delphi 6. With the release of the sixth version, Borland announced a new, cross-platform era in Delphi, simultaneously releasing a version of Delphi for Linux (Kylix 1.0). Now, when creating an application, you could choose its type - for Windows, or universal. Accordingly, the VCL library was supplemented by the CLX library, compatible with both Windows and Linux. In addition, in the 6th version, “native”, and not foreign ActiveX, components for working with the Internet finally appeared, and in both versions at once - for both VCL and CLX. Starting with this version, the Object Pascal programming language itself is officially called Delphi.

Delphi 7. Further development of Delphi 6, an improved CLX library and a new corresponding version of the development environment for Linux OS - Kylix 3. At the same time, starting with Delphi 7, Borland became concerned with the issue of compatibility with another platform - Microsoft .NET, for which some changes were made as in VCL, and in the language (and, accordingly, in the compiler).

Delphi 8. The first version of Delphi, focused on working with the Microsoft.NET platform. In this version, the developers took the risk of changing the interface of the environment, making it similar to the products of Microsoft, the new major shareholder of Borland. Accordingly, support for Kylix was discontinued.

Delphi 2005. Less than a year after the release of Delphi 8, a new version appeared, which quickly returned the ability to work in the classic IDE style when developing applications for Windows. At the same time, Delphi 2005, in the case of developing applications specifically for the NET platform, allows you to work not only with the Delphi language, but also with C#. At the same time, such innovations as the for...in operator and built-in procedures and functions were introduced into the Delphi language itself.

Delphi 2006. The latest version of Delphi released by Borland. A lightweight version was also released - Turbo Delphi. Then the journey to other developers began.

Delphi 2007. Version released by CodeGear. Added support for the Aero interface for Windows Vista.

Delphi 2009. Version released by Embarcodero. Unicode support has been implemented in VCL and RTL, calls to all Windows API functions have been replaced with Unicode analogues, generic types and anonymous methods have been added.

Delphi 2010. Windows 7 support, touch and gesture components, and dbExpress components now officially support Firebird.

Delphi XE (Delphi 2011). Added support for cloud computing.

Did you like the article? Share it
Top