Visual Object-Oriented Programming Using Delphi With CD-ROM

Visual Object-Oriented Programming Using Delphi With CD-ROM

by Richard Wiener, Claude A. Wiatrowski

An application-oriented guide to getting the most out of Delphi in object-oriented programming.See more details below


An application-oriented guide to getting the most out of Delphi in object-oriented programming.

Editorial Reviews

Peter Roth

Object Oriented Programming Using Delphi

Both the book Visual Object-Oriented Programming Using Delphi, by Richard Wiener and Claude Wiatrowski, and the newest version of Delphi arrived at my door within a few days of each other, so I thought it useful to combine a look at the new tool with a look at the text.

Delphi is a Rapid Application Development (RAD) tool produced by the company formerly known as "Borland," now called "Inprise." Although extremely powerful, Delphi is used by only a few software developers: Inprise reports sales of the tool exceed 1 million copies. Delphi 1 came out in 1995 for 16-bit Windows, and a new version has followed every year. This year's release, Delphi 4, is hosted by -- and produces software for -- Win32.

The Delphi interactive development environment (IDE) is vaguely similar to that of Visual Basic and Visual C++, in which the command menu and speedbuttons are displayed on dockable toolbars. The basis of a Delphi app is the form, a window onto which you drop components dragged from a palette. A double-click on the component generates the shell code for an event handler and positions the editing cursor at the exact spot where code is to be written. More about code in a moment.

The palette in the client/server version of Delphi 4 includes 14 tabs, presenting the "usual" Windows components: menus, checkboxes, and so on; the common dialogs for opening and saving files; Internet components; database and data aware components, which show live data at development time; and many others. An active third-party market provides additional add-ons. Delphi also automates production of web server apps, and ActiveX and CORBA components. There is no doubt that I will never use the full power of this tool.

The code is where Delphi's similarity with other tools ends. Delphi uses Object Pascal, a language heavily extended from Niklaus Wirth's Pascal. The language is often mistakenly characterized as a teaching language; Inprise has developed the language into a competitor for C++ in both capability of expression and speed of executables. Object Pascal is truly object oriented, and supports encapsulation, inheritance and polymorphism. For compiling speed, Delphi has no equal, and is the fastest compiler I've owned. Version 4 parses code in the background, so that the environment helps fill in the blanks of classes while they are in the process of being created. Object Pascal is clean to read and write. Because it's based on the reference model, all class instances are automatically allocated on the heap, but the compiler handles pointer allocation without requiring either definitions of pointer types, or the dereferencing caret.

In the interest of full disclosure, I have enjoyed and used Pascal since the late '70s, beginning with Urs Amman's compiler for the CDC6000 machines, which was a monumental improvement over the Fortran compilers of the time. I've been using Borland products continuously since Turbo Pascal 2. Although I use other languages, Delphi is the first tool I reach for.

Delphi 4 didn't come in a box; rather it came in a cardboard CD-ROM sleeve. The accompanying documentation is on the Delphi CD, in Adobe Acrobat format, and it is primarily reference material. This provides a market for third-party instructional texts, which brings us to Wiener and Wiatrowski's book. By the copyright date, it is obvious that the text is aimed at Delphi 1 and 2. Delphi has changed in each release, so my aim was to determine how much of the text was applicable to Delphi 4.

Visual Object-Oriented Programming Using Delphi is presented in four parts:

  • Basic Principles.
  • The Delphi Visual Object-Oriented System.
  • Specialized Aspects of Windows Programming.
  • A Case Study.
Each chapter concludes with a summary, bulking the page count without adding information.

Basic Principles comprise the first 100 pages, and would purportedly be of interest to a new object-oriented programmer. If my experience is any indicator, an introduction to objects is a difficult subject to get across in a few lines. The first ten pages cover encapsulation, inheritance, and polymorphism, so it is imperative to come to this text already knowing the object oriented model. Indeed, the rest of the chapter compares Object Pascal with C++ and SmallTalk, meaningless to a tyro.

Chapter 2 is a ten-page treatise on event-driven programming, again too short to teach the topic, so you should already know EDP. Chapter 3 is a quick nine pages on the use of the component palette, instance properties, and events. In Chapter 4 the authors discuss the relation of components and the object model, devote a paragraph to each of several classes, and then present virtual constructors. I thought that would be some interesting code to trace through, so I loaded the book CD and looked for the project files. In vain! The book CD only includes the code examples for Chapter 5. This is a mistake. There is simply no way that rookies can accurately type in text from a book.

Having reached the end of Basic Principles, I realized there was no discussion of the language constructs themselves, so the reader must obtain these lessons elsewhere. I usually recommend the classic Pascal: User Manual and Report, by Kathleen Jensen and Niklaus Wirth (Springer Verlag, 1991; ISBN 0-387-97649-3), neither of whom could be considered prolix; they needed four more pages than Wiener and Wiatrowski to describe the Pascal language without objects.

The remainder of Visual Object-Oriented Programming Using Delphi the text is interesting for what it omits. Delphi is aimed primarily at developing multi-tier distributed database applications. The text, unlike the vast majority of its competitors, does not discuss database development at all. That is entirely okay by me; the majority of engineering computations I'm involved with do not involve databases either. The text does lead you through the development of several small apps that have instructive value. Chapter 5 will appeal to engineers, as it discusses the solution of, and presentation of the results for, a differential equation representing the control of a system. In Chapter 7, the authors boldly leap into component construction, which is another order of magnitude more difficult than creating drag-and-drop apps.

I eventually copied all of the projects from the book CD onto my hard drive and tried to build each one. I didn't particularly care for the appearance of the sample apps, but this is a matter of taste.

Delphi 4, like any Borland compiler, is an outstanding code analyst, providing exhaustive error messages, warnings, and hints. Running the code through Delphi 4 listed variables that were not used, variables that might not have been initialized, and type mismatches. There should just not be so much slop in code that is used to teach good programming. One error that was not caught by the compiler was a faulty instantiation of the card deck in the Solitaire app. A new Delphi programmer doesn't have a chance of finding the erroneous statement the_deck.Create; and realize that it should be replaced with the_deck := TDeck.Create;. That this code compiled and ran in earlier versions of Delphi is amazing; that it got into a text is the bane of writers.

I also had trouble with the sample application dealing with images and their manipulation. It wouldn't compile, and I just ran out of time ere I got it fixed. Notably, that program uses the old style Pascal pointers.

My recommendation? You would be better served by more thorough Delphi texts -- for example, Delphi 4 Developer's Guide, by Steve Teixeira and Xavier Pacheco (Sams, 1998, ISBN 0-672-31284-0) --although the part on moving bitmaps without flicker could provide a useful shortcut to apps that need it.

And although there are a few glitches in Delphi 4, I still reach for it first.--Dr. Dobb's Electronic Review of Computer Books

Read More

Product Details

Cambridge University Press
Publication date:
SIGS: Advances in Object Technology Series, #14
Edition description:
Product dimensions:
6.97(w) x 8.98(h) x 1.34(d)

Customer Reviews

Average Review:

Write a Review

and post it to your social network


Most Helpful Customer Reviews

See all customer reviews >