2.2. User manual
Now we will solve our problem using Delphi application, but firstly I want to tell about Delphi environment.
Embarcadero Delphi is a programming language and integrated development environment (IDE) for desktop, mobile, web, and console applications [9]. Delphi's compilers use their own Object Pascal dialect of Pascal and generate native code for several platforms: Windows (x86 and x64), OS X (32-bit only), and iOS and Android (ARM).
Figure 2. The environment of Delphi IDE
Delphi, part of RAD Studio, includes a code editor with Code Insight (code completion), Error Insight (real-time error-checking), and other features; refactoring; a visual forms designer for both VCL (native Windows) and FMX (cross-platform, partially native per platform); an integrated debugger for all platforms including mobile; source control (SVN, git, and Mercurial); and support for third-party plugins. It has strong database support. Delphi is remarkably fast to compile: unlike any other common languages, including C# and Swift, it is not unusual for a Delphi project of a million lines to compile in a few seconds - one benchmark gave 170,000 lines per second. It is under active development, with (in 2016) releases every six months, with new platforms being added approximately every second release [10].
Delphi was originally developed by Borland as a rapid application development tool for Windows as the successor of Turbo Pascal. Delphi added full object-orientation to the existing language, and since then the language has grown and supports many other modern language features, including generics and anonymous methods, as well as unusual features such as inbuilt string types and native COM support. Delphi and its C++ counterpart, C++Builder, share many core components, notably the IDE, the Visual Component Library (VCL), and much of the RTL, and are compatible with each other: C++Builder 6 and onwards can consume Delphi-language files and C++ in the one project, and packages compiled with C++Builder written in C++ can be used from within Delphi. In 2007, the products were released jointly as RAD Studio. RAD Studio is a shared host for Delphi and C++Builder, and can be purchased with either or both.
In 2006, Borland’s developer tools section were transferred from Borland to a wholly owned subsidiary known as CodeGear, which was sold to Embarcadero Technologies in 2008. In 2015, Embarcadero was purchased by Idera, but the Embarcadero mark was retained for the developer tools division.
Delphi supports rapid application development (RAD). Among the features supporting RAD are application framework and visual window layout designer. It supports native cross-compilation.
Delphi uses the Pascal-based programming language called Object Pascal introduced by Borland, and compiles Delphi source code into native x86 code. It includes VCL, support for COM independent interfaces with reference counted class implementations, and support for many third-party components. Interface implementations can be delegated to fields or properties of classes. Message handlers are implemented by tagging a method of a class with the integer constant of the message to handle.
Database connectivity is supported, and Delphi supplies several database components. VCL includes many database-aware and database access components.
Later versions have included upgraded and enhanced runtime library routines provided by the community group FastCode, established in 2003.
Delphi is a strongly typed high-level programming language, intended to be easy to use and originally based on the earlier Object Pascal language. Pascal was originally developed as a general purpose language "suitable for expressing the fundamental constructs known at the time in a concise and logical way", and "its implementation was to be efficient and competitive with existing FORTRAN compilers" [7] but without low-level programming facilities or access to hardware. Turbo Pascal and its descendants, including Delphi, support access to hardware and low level programming, with the facility to incorporate code written inassembly language and other languages. Delphi's object orientation features only class- and interface-based polymorphism. Metaclasses are first class objects. Objects are actually references to the objects (as in Java), which Delphi implicitly de-references, so there is usually no need to manually allocate memory for pointers to objects or use similar techniques that some other languages need. There are dedicated reference-counted string types, and also null-terminated strings.
Strings can be concatenated by using the '+' operator, rather than using functions. For dedicated string types Delphi handles memory management without programmer intervention. Since Borland Developer Studio 2006 there are functions to locate memory leaks.
Delphi includes an integrated IDE. The Delphi products all ship with a Visual Component Library (VCL), including most of its source code. Third-party components (sometimes with full source code) and tools to enhance the IDE or for other Delphi related development tasks are available, some free of charge. The IDE includes a GUI for localization and translation of created programs that may be deployed to a translator; there are also third-party tools with more features for this purpose. The VCL framework maintains a high level of source compatibility between versions, which simplifies updating existing source code to a newer Delphi version. Third-party libraries may need updates from the vendor but, if source code is supplied, recompilation with the newer version may be sufficient. The VCL was an early adopter of dependency injection or inversion of control; it uses a-"re-usable" component model, extensible by the developer. With class helpers new functionality can be introduced to core RTL and VCL classes without changing the original source code of the RTL or VCL [11].
The compiler is optimizing and single pass. It can optionally compile to a single executable which does not require DLLs, simplifying program updating. Delphi can also generate standard DLLs, ActiveX DLLs, COM automation servers and Windows services.
The Delphi IDEs since Delphi 2005 increasingly support refactoring features such as method extraction and the possibility to create UML models from the source code or to modify the source through changes made in the model.
Delphi has large communities on Usenet and the web. When Delphi was owned by Codegear, many of its employees actively participated.
Borland Delphi is a development tool for Microsoft Windows applications. Delphi is powerful and easy to use tool for generating stand-alone graphical user interface (GUI). Delphi is the first programming language to shatter the barrier between high-level, easy-to-use rapid application development environments and low-level bits-and-bytes power tools [12].
Delphi allows us to use multiple components in a single VCL form. For example, see Figures 3 and 4.
Figure 3. The first form for linear problem solving
This form contains several objects:
Label, which allows to put text into a form
Edit – an input field, from which we obtain data
Button – one of the main components that plays a key role by assigning procedures to it
We input our data in an Edit field. The calculations for revenues are made in background. See code of the program in appendix. We proceed to the next form for next calculations by pressing ‘Proceed to calculations’ button. Labels indicate what should be input into an edit field on the right side [13].
Figure 4. The second form for linear problem solving
The program consists of several objects (Figure 4):
The main form – contains all functioning buttons to run a program
StringGrid – a designed tool to display matrixes
Labels – to name the results of output
Memos – to output calculated information into a field
Buttons – one of the main components that plays a key role by assigning procedures to it
GroupBox – to group elements in one item for convenience [14]
Memos are used to display the results of calculations. There are 4 memos for each criterion: Wald’s criterion, maximum criterion, Hurwitz criterion, Savage Criterion. There are 2 buttons: ‘Form the PayOff matrix’ and ‘Calculate’. The first one forms the matrix based on results of calculations from the first form. The second button continues calculations and outputs them into memos.
When creating GUI applications with Delphi, you have all the power of a true compiled programming language (Object Pascal) wrapped up in a RAD environment. All the common parts of the Windows graphical user interface, like forms, buttons and lists objects, are included in Delphi as components. This means that you don't have to write any code when adding them to your application. You simply draw them onto your form like in a paint program. You can also drop ActiveX controls on forms to create specialized programs such as Web browsers in a matter of minutes. Delphi allows the developer to design the entire interface visually, and quickly implement an event driven code with the click of the mouse [15].
Delphi ships in a variety of configurations aimed at both departmental and enterprise needs. With Delphi, you can write Windows programs more quickly and more easily than was possible ever before.
