Delphi Jon Krueger Matt Merkel Jack Neil. Overview Paradigm and problem domains Language concepts...

24
Delphi Jon Krueger Matt Merkel Jack Neil
  • date post

    21-Dec-2015
  • Category

    Documents

  • view

    219
  • download

    1

Transcript of Delphi Jon Krueger Matt Merkel Jack Neil. Overview Paradigm and problem domains Language concepts...

Page 1: Delphi Jon Krueger Matt Merkel Jack Neil. Overview Paradigm and problem domains Language concepts Sample code The history of Delphi Language Comparison.

Delphi

Jon KruegerMatt Merkel

Jack Neil

Page 2: Delphi Jon Krueger Matt Merkel Jack Neil. Overview Paradigm and problem domains Language concepts Sample code The history of Delphi Language Comparison.

Overview

Paradigm and problem domains Language concepts Sample code The history of Delphi Language Comparison

Page 3: 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. In imperative languages commands update

variables. Builds directly on what happens at the hardware

level.

Page 4: 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 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

Page 5: 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 Object-Oriented languages are imperative, but

considered part of a different paradigm. Delphi is object-oriented

Inheritance (single) Polymorphism Encapsulation

Page 6: Delphi Jon Krueger Matt Merkel Jack Neil. Overview Paradigm and problem domains Language concepts Sample code The history of Delphi Language Comparison.

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.

Page 7: Delphi Jon Krueger Matt Merkel Jack Neil. Overview Paradigm and problem domains Language concepts Sample code The history of Delphi Language Comparison.

Delphi concepts

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

Page 8: Delphi Jon Krueger Matt Merkel Jack Neil. Overview Paradigm and problem domains Language concepts Sample code The history of Delphi Language Comparison.

Delphi Features

Delphi and C++ Builder IDE GUI Builder – drag and drop Source editor Debugger

No runtime environment required to execute Delphi object code.

Page 9: Delphi Jon Krueger Matt Merkel Jack Neil. Overview Paradigm and problem domains Language concepts Sample code The history of Delphi Language Comparison.

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

Page 10: Delphi Jon Krueger Matt Merkel Jack Neil. Overview Paradigm and problem domains Language concepts Sample code The history of Delphi Language Comparison.

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

Page 11: Delphi Jon Krueger Matt Merkel Jack Neil. Overview Paradigm and problem domains Language concepts Sample code The history of Delphi Language Comparison.

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

Page 12: Delphi Jon Krueger Matt Merkel Jack Neil. Overview Paradigm and problem domains Language concepts Sample code The history of Delphi Language Comparison.

Delphi Example

A class example

Page 13: Delphi Jon Krueger Matt Merkel Jack Neil. Overview Paradigm and problem domains Language concepts Sample code The history of Delphi Language Comparison.

Unit Stringy;interfacetype 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;

Page 14: Delphi Jon Krueger Matt Merkel Jack Neil. Overview Paradigm and problem domains Language concepts Sample code The history of Delphi Language Comparison.

//continuation of last slideimplementation

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

Page 15: Delphi Jon Krueger Matt Merkel Jack Neil. Overview Paradigm and problem domains Language concepts Sample code The history of Delphi Language Comparison.

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;

Page 16: Delphi Jon Krueger Matt Merkel Jack Neil. Overview Paradigm and problem domains Language concepts Sample code The history of Delphi Language Comparison.

//continuation of last slidebegin

myText := TStringy.Create(‘The cat in the hat’);

myText.Text := ‘There was a cat’;end;

end.

Page 17: Delphi Jon Krueger Matt Merkel Jack Neil. Overview Paradigm and problem domains Language concepts Sample code The history of Delphi Language Comparison.

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

Page 18: Delphi Jon Krueger Matt Merkel Jack Neil. Overview Paradigm and problem domains Language concepts Sample code The history of Delphi Language Comparison.

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

Page 19: Delphi Jon Krueger Matt Merkel Jack Neil. Overview Paradigm and problem domains Language concepts Sample code The history of Delphi Language Comparison.

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

Page 20: Delphi Jon Krueger Matt Merkel Jack Neil. Overview Paradigm and problem domains Language concepts Sample code The history of Delphi Language Comparison.

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

Page 21: Delphi Jon Krueger Matt Merkel Jack Neil. Overview Paradigm and problem domains Language concepts Sample code The history of Delphi Language Comparison.

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

Page 22: Delphi Jon Krueger Matt Merkel Jack Neil. Overview Paradigm and problem domains Language concepts Sample code The history of Delphi Language Comparison.

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

Page 23: Delphi Jon Krueger Matt Merkel Jack Neil. Overview Paradigm and problem domains Language concepts Sample code The history of Delphi Language Comparison.

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

Page 24: Delphi Jon Krueger Matt Merkel Jack Neil. Overview Paradigm and problem domains Language concepts Sample code The history of Delphi Language Comparison.

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>