1 / 24

Delphi

Delphi. Jon Krueger Matt Merkel Jack Neil. Overview. Paradigm and problem domains Language concepts Sample code The history of Delphi Language Comparison. Paradigm and problem domains. Delphi follows a imperative and OO model The word Imperative come from Latin and means to command.

duchesne
Download Presentation

Delphi

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Delphi Jon Krueger Matt Merkel Jack Neil

  2. Overview • Paradigm and problem domains • Language concepts • Sample code • The history of Delphi • Language Comparison

  3. Paradigm and problem domains • Delphi follows a imperative and OO model • The word Imperative come from Latin and means to command. • In imperative languages commands update variables. • Builds directly on what happens at the hardware level.

  4. Paradigm and problem domains • Delphi follows a imperative and OO model • You can look at data structures in terms of states. • The program is a means to manipulate the states. • Variables are used in imperative programming to hold intermediate results of computation. • Other major imperative languages include: Fortran, Basic, COBOL, Algol, PL/1, Modula, C, Ada, Perl

  5. Paradigm and problem domains • Delphi follows a imperative and OO model • Object-Oriented languages are imperative, but considered part of a different paradigm. • Delphi is object-oriented • Inheritance (single) • Polymorphism • Encapsulation

  6. Delphi concepts • Classes (single inheritance) • Interfaces (similar to java) • Exception handling • Built-in support for Unicode strings and single-byte ANSI strings • Very fast compiler and optimizer • Compiles to native x86 code.

  7. Delphi concepts • Values and types – static, strong, standard primitives (char, real, integer, boolean), enumerated, composite (arrays, records, sets)

  8. Delphi Features • Delphi and C++ Builder IDE • GUI Builder – drag and drop • Source editor • Debugger • No runtime environment required to execute Delphi object code.

  9. Delphi Structure • Program Control • Keywords • Begin // starts a statement block • End // terminates a statement block • Exit // exit abruptly from a function or procedure • Halt // terminates the program with an optional dialog • Try // starts code that has error trapping • Uses // declares a list of units (modules) to be imported • Var // starts the definition of a section of data variables

  10. Delphi Structure • Some routines provided with DELPHI • Erase // Erase a file • FileSearch // Search for a file in numerous directories • FileSetDate // Set the last modified date and time of a file • Flush // Flushes buffered text file data to the file • Truncate // Truncates a file size • TStringList // A class provided with DELHPI that has methods for loading and writing a list of strings from a text file

  11. Delphi Example • Reading and writing files var myFile : TextFile; begin AssignFile(myFile, ‘Test.txt’); ReWrite(myFile); //Opens file as new – discards existing contents Append(myFile); //Opens file for appending new data to end Reset(myFile); //Opens a file for read and write access

  12. Delphi Example • A class example

  13. Unit Stringy; interface type TString = Class private stText : String; stWordCount : Integer; stFindString : String; stFindPosition : Integer; procedure GetWordCount; procedure SetText(const Value: String); published constructor Create(Text : String); function Replace(from, toStr : String) : Integer; function FindFirst(search : String) : Integer; function FindNext : Integer; property Text : String read stText write SetText; property WordCount : Integer read stWordCount; end;

  14. //continuation of last slide implementation uses SysUtils, StrUtils; constructuror TStringy.Create(Text: String); begin stText := Text; stFindPosition := 1; stFindString := ‘’; GetWordCount; end; procedure TStringy.SetText(const Value: String); stText := Value; stFindPosition := 1; GetWordCount; end; //other methods here

  15. unit Main; uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Stringy; type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; procedure TForm1.FormCreate(Sender: TObject); var myText : TStringy; count : integer; position : integer;

  16. //continuation of last slide begin myText := TStringy.Create(‘The cat in the hat’); myText.Text := ‘There was a cat’; end; end.

  17. History of Delphi • Delphi’s predecessors date back to as early as 1968 • In 1968, a man named Niklaus Wirth began work on a programming language called Pascal, which he completed in 1970 with its first working implementation appearing on a CDC6000 Computer

  18. The Evolution of Pascal • In the 1970s, Wirth worked with Jensen on Modula, the next child of Pascal • In the very early 1980s, Turbo Pascal was born, and received good press for its excellent compilation and execution speed

  19. Delphi Is Born • In the 1990s, a project began at Borland with the Greek Mythological code-name “Delphi” • Borland liked the code-name enough to actually use it as the product name • 1995, Borland’s Delphi was introduced as an Object-Oriented version of Turbo Pascal

  20. Delphi’s Market • Delphi’s main asset was its speed, both in compilation and execution (just like Turbo Pascal) • Designed specifically for RAD (Rapid Application Development) • Ideal for anything from Business and Database applications to intensive application development

  21. Comparison of Delphi • Delphi is most closely related to Visual Basic more than any other programming language • Delphi incorporates Object-Orientation but Visual Basic is much more like traditional Basic in the fact that, it is not Object-Oriented

  22. Comparison of Delphi • Memory management weighs in Delphi’s favor because the programmer has more freedom in managing objects, such as removing them when they are no longer needed, instead of waiting on a “garbage collector.” • Delphi is also broader in the sense of what types of applications it can be used for, whereas Visual Basic’s main applications include only business and database applications

  23. Comparison of Delphi • Lower (hardware and time) cost of execution than Visual Basic • Visual Basic tends to be easier to learn for someone who is not agile or experienced with programming • Visual Basic is more commonly used • New programmers are taught Visual Basic

  24. References • A comparison between Delphi and Visual Basic <http://www.latiumsoftware.com/en/articles/00010.php> • Borland History: Why the name "Delphi?" <http://community.borland.com/article/0,1410,20396,00.html> • Delphi Basics: A brief history of Borland’s Delphi <http://www.delphibasics.co.uk/Article.asp?Name=DelphiHistory> • Delphi Basics <http://www.delphibasics.co.uk>

More Related