Migrating to .NET with Delphi 8 - PowerPoint PPT Presentation

1 / 41
About This Presentation
Title:

Migrating to .NET with Delphi 8

Description:

How to migrate your application. Demos to highlight ... s := String(q); // Explicit(Quark): String. writeln(q); // compiler uses Explicit(Quark): String ... – PowerPoint PPT presentation

Number of Views:117
Avg rating:3.0/5.0
Slides: 42
Provided by: gerardva
Category:
Tags: net | delphi | migrating | quark

less

Transcript and Presenter's Notes

Title: Migrating to .NET with Delphi 8


1
Migrating to .NET with Delphi 8 Gerard van der
Pol Borland Software Corporation
2
Topics / Agenda
  • Delphi 8 for .NET
  • Support for .NET
  • How to migrate your application
  • Demos to highlight capabilities

3
Delphi Solutions
  • Integrated Design and Modeling Capabilities
  • Web Services development (e-business RAD)
  • Enterprise
  • Internet/Intranet development
  • Multi-tier development
  • Client/Server development
  • Database development
  • Windows/desktop development

time
4
Delphi Support forWindows Platform Evolution
5
Delphi for .NET
  • Objectives
  • Make Delphi a premier .NET application
    development tool
  • Evolve the Delphi language, compiler, and IDE
    productivity tools to fully embrace the .NET
    feature set while maintaining a high degree of
    source compatibility with existing Delphi
    applications.

6
Delphi for .NET
  • Full access to the .NET framework and facilities
  • Complete support for ASP.NET
  • Complete support for .NET Web Services
  • Complete support for WinForms
  • Produces safe, verifiable code 100 CIL
  • Full interaction with other .NET languages
  • CLS provider and CLS consumer
  • Language extensions to take advantage of .NET

7
Make Delphi 1st class citizen .NET Language
Delphi
8
Delphi Technology Foundation
Application Lifecycle Management
Design Driven Development
Future
Strategic
Delphi IDE
Delphi Compiler .NET
Delphi Compiler Win32
Language
VCL.NET
VCL
Web Forms
Win Forms
API
.NET
Win32
Platform
9
Strategic Development Goals
  • Delphi evolution to .NET
  • Delphi technologies to ease transition
  • Increase productivity with design driven
    development
  • Support for Borland Application Lifecycle
    Management

10
Simplify the Move to .NET
  • Using existing Delphi skills and assets
  • Delphi language syntax eliminates the learning
    curve
  • VCL for .NET controls provide a familiar set of
    user interface controls that are backwards
    compatible with existing Delphi source code and
    interoperable with the .NET framework
  • Database technologies radically ease the
    migration of database applications to .NET

11
Delphi for .NET
  • More than just a port
  • New code generator
  • New linker
  • Significant new syntax
  • New Runtime Library

12
Delphi as a compliant .NET language
CLR/CTS
CLS
Delphi
C
Others
13
Assemblies and Delphi
  • Treat CLR assemblies like packages
  • Direct symbol import from metadata
  • No header file translations!
  • -lultnamegt to specify which assemblies to link
    against / allow access to
  • Package syntax produces assemblies
  • Package syntax will still provide option of
    linking code into your exe or external reference

14
CLR and Delphi
  • TObject System.Object
  • Exception System.Exception
  • TComponent System.ComponentModel.Component
  • Database connectivity ADO.NET
  • dbExpress drivers plug into ADO.NET
  • GUI System.Windows.Forms (WinForms) and/or
    VCL.NET

15
The Delphi Language
  • Strings Arrays
  • Records
  • Classes Interfaces
  • Exceptions
  • Properties Events
  • Sets
  • Text files
  • Local Procedures
  • Variants
  • Components
  • Streams
  • New, Dispose
  • Readln, Writeln
  • Format
  • Component Streaming
  • Random
  • Virtual Constructors

16
New Improved
  • Multicast Events
  • Include/Exclude events
  • Records w/ methods
  • Array prop overloads
  • Boxing into objects
  • Sealed classes
  • Final methods
  • Operator Overloading
  • Unit Namespaces
  • Qualified Identifiers
  • Nested Types
  • Custom Attributes
  • Class (static) data
  • Class properties
  • Class static methods

17
What Wont Work in .NET
  • _at_, Addr(), Absolute directive
  • Real48 six-byte floats
  • File of lttypegt
  • GetMem, FreeMem, ReallocMem
  • Use arrays or New() Dispose()
  • ExitProcs
  • Old Object syntax (type foo object)
  • TVarData, Variant internals

18
Above and Beyond CLR
  • Delphi syntax for
  • Virtual constructors
  • Named constructors
  • Virtual calls from class methods
  • Unsafe types
  • PChars
  • Variant records

19
Delphi Private Protected
  • Same-unit private and protected members
    unchanged
  • Protected members defined in another unit
    accessible from within the same assembly, but not
    across assembly (package) boundaries
  • Delphi protected reverts to strict protected
    across assembly boundaries only methods of
    direct descendents may access strict protected
    members.

20
Namespaces
  • A namespace is a logical container for types to
    eliminate name collisions
  • Namespaces do not have any physical manifestation
  • An assembly can contribute to multiple namespaces
  • Multiple assemblies can contribute to a namespace
  • Example System.Windows.Forms

21
Namespaces and Delphi Syntax
  • Access CLR Namespaces as units
  • Uses System.IO.Text, System.Web
  • Delphi unit defines its own namespace
  • Dotted names in unit identifiers and file names
  • Enhance fully qualified identifiers
  • Reserved words / keywords allowed after first
    ident
  • Unicode/UTF8 identifiers will be allowed after
    first ident (not in first release)

22
Namespace Search Paths
  • Specify a list of prefixes to apply to used unit
    names to help bind source code to platform
    particulars
  • With nsBorland.Vcl, all source references to
    Classes resolve to Borland.Vcl.Classes
  • Uses Classes, Graphics, Forms, Dialogs,
    StdCtrlscompiles fine in Delphi 8 for .NET,
    with nsBorland.Vcl
  • Eliminates uses clause IFDEFs required by VCL/CLX
    shared source

23
Nested Types
  • typeTMyClass class Fdata Integer const foo
    12 type TNestedClass class procedure
    Hello end procedure Greenend

24
Using Attributes
  • type FooAttribute(Hello, 23) TMyClass
    class SpecialDataAttribute Fdata
    Integer WebMethod, DebuggerStepThrough
    function SampleCount Byteend

25
Declaring Custom Attributes
  • typeTQuantumAttribute class(TCustomAttrib
    ute) constructor Create constructor
    Create(Name String) property Name String
    property Spin Double property Color
    TQuarkColorend

26
Class Statics
  • typeTMyClass class class Fdata
    Integer class property Foo String class
    procedure One class procedure Two staticend

27
Multicast Events
  • Multiple listeners per event
  • You can only remove your own listener
  • Include(), Exclude() standard procs overloaded to
    operate on events
  • Traditional unicast event semantics supported
    through assignment
  • Only Delphi read/write event properties
  • Delphi read/write events also support add/remove
    for compatibility with CLR, but the result is
    still single assignment

28
Event Sample Code
  • Type
  • TClickEvent procedure of object
  • TFoo class private FOnClick TClickEvent
    public property OnClick TClickEvent add
    FOnClick remove FOnClick end
  • Include(F.OnClick, MyObj.HandleClick)

29
Value Types
  • Primitive types can be boxed into object
    wrappers
  • Value semantics for assignment copy
  • Record types are value types in Delphi
  • Records can implement interfaces
  • Records can contain non-virtual methods and
    properties
  • TObject(12) boxes an integer into an object
  • Example TObject(x).ToString

30
Operator Overloading
  • Take full advantage of CLR value types

Type TQuark record private FCharge
Integer FSpin Single FColor Byte
public class operator Add(a, b TQuark)
TQuark class operator Add(a TQuark b
Byte) TQuark class operator Implicit(a
Integer) TQuark class operator Explicit(a
TQuark) Integer class operator Explicit(a
TQuark) String end
31
Operator Overloading
Var q TQuark s Stringbegin q 12
// Implicit conversion from integer q q
4 // Add(TQuark, Byte)// q 4 q syntax
error no Add(Byte, TQuark) s String(q)
// Explicit(Quark) String writeln(q) //
compiler uses Explicit(Quark) Stringend.
32
Operator overloading
  • Operators only apply to the languages existing
    set of operators (-/div mod xor and or not shl
    shr, etc)
  • No new or arbitrary funny symbols
  • Explicit operators define what typecasts are
    allowed
  • Implicit operators define what silent conversions
    are allowed (like byte-gtinteger)
  • Only cast operators may overload by function
    result

33
Class Helpers
  • A class helper is a syntax trick that makes
    methods and properties appear to exist on object
    types beyond your control.
  • Example Delphis traditional TObject base
    class has a Classname method. In Delphi for
    .NET, though TObject System.Object.System.Objec
    t does not implement Classname.However,
    Delphi source code can call Classname on any
    object in .NET, and get the expected result,
    without modifying the .NET object.

34
Class Helpers
  • Rule 1 Class Helpers are for binding the
    language and class library foundations to new
    platforms while preserving name expectations for
    existing portable code.
  • Class helpers are not intended for application or
    component development.

35
Class Helper Syntax
  • Type
  • TObjectHelper class helper for TObjectclass
    function Classname Stringend
  • May Contain
  • Private / Protected / Public sections
  • Class methods and instance methods
  • Virtual methods (which can be overridden)
  • Constructors
  • Class vars
  • Properties
  • May NOT contain instance data fields

36
Unmanaged Exports
  • Functions in a managed Delphi for .NET code
    assembly can be called directly by unmanaged
    Win32 x86 code with no COM interop or .NET
    awareness.

Library Foo UNSAFECODE ONfunction Hello(S
String) Double begin writeln(s) Result
Pi end Exports Hello
37
(No Transcript)
38
High Performance Development
  • Superior Web development with ASP.NET and Web
    Forms
  • Develop rich client applications with Win Forms
    and VCL.NET
  • Improve communication through code visualization
  • Get to market faster with new timesaving IDE
    features

39
DELPHI APPLICATION LIFECYCLE MANAGEMENT
40
Ease the Transition to .NET
  • Rapidly build rich and reliable applications with
    .NET and Delphi
  • Simplify the move to .NET by using your existing
    Delphi skills and assets
  • Upgrade your Delphi investments with .NET

41
For More Information
  • http//bdn.borland.com
  • http//www.borland.com
  • http//www.borland.com/dotnet
  • http//www.borland.com/together
Write a Comment
User Comments (0)
About PowerShow.com