Contents

 


Good Software Tools

What are the criteria that determine good software tools? Click for HTML.

top

Which C++ compiler?

Brandt Irion asks via email: "Dear Mr. Roth: I read your review of the C++Builder 5 Developer's Guide in August's DDJ. I found it helpful. I would like to move up from the Borland TurboC++ for DOS compiler to a windows C++ compiler. When I compare MS-VisualC++ to the Borland C++Builder I wonder if Borland is at a disadvantage because the VisualC++ code writers at Microsoft have access to all of the source code, nuances, & "back doors" of the Windows operating system and the Borland code writers do not. Is this a valid and significant issue to consider when choosing compilers? Thanks. Brandt Irion."

My response: Hi Brandt - Thanks for the kind words. As to your questions: "It depends."

VC++ is designed of windows, by windows, and for windows. Microsoft built VC++ to "help" developers stick with the windows platform. As such, they flouted the standard, and in some cases violated it. (You can find details of this in the archives of various newsgroups.) Therefore, if your goal is "windows", then VC++ is a useful tool. There is also strong managerial support for Microsoft tools, as the saying goes, "no one is ever fired for buying Microsoft". And last in this list, Microsoft markets the dickens out of everything.

Borland C++Builder is "more standard", i.e., adheres to standard C++ in more areas than VC++. Hence, if you read the standard, and texts that treat C++ (rather than VC++), you are more likely to get the code to compile with bcb than VC++. Having said that, bcb uses the extremely useful VCL (from Borland's Delphi product) to automate much of windows programming. Having a Delphi background myself, and favoring the Borland IDE, I chose bcb as my development tool, and have removed VC++ from my machines.

By the way, if you are starting out as a windows programmer, you are better off using the front door, rather than considering the rear exit. There's enough new things to learn about Object Oriented programming, templates and generic programming, GUI development, and the event driven model to keep you busy. Borland C++Builder shields you from the windows api (better than VC++), so that is a leg up on the journey.

For plain ol' C++, start reading Koenig & Moo's Accelerated C++.

top

What Language?

What language should be used to write programs? Click for HTML.

top

Delphi Informant Article Considered Harmful

The article "object vs. class" by Aleksandr Gofen, "improved" by Dr Manfred Mackeben, [Delphi Informant Vol 5 No 7, July 1999] is a disaster. Besides being poorly organized, the article is incorrect in its statements on scope, global variables, the use of constructors and destructors, memory management, class hierarchy development, inheritance, and polymorphism. Given limited time and space, it is possible to comment on only a few flaws in detail. click for HTML

top

Maps (Associative Arrays) in Delphi

In a recent project, I needed to reference material properties by the name of the material. I started off thinking something like this:

type
  MaterialName = (steel, aluminum, bronze, copper);

MaterialRec = record
  modulus: double;
  // other properties 
end;

var
  Materials: array[steel..copper] of MaterialRec;

Then, to set values into the array, I would fill a MaterialRec and install it at the appropriate index:

var
  mr: MaterialRec;
    //...
  mr.modulus := 3.0e7; // and other material properties
  Materials[steel] := mr;

Using an array as a container is quite legible and maintainable. But the real problem I faced was how to deal with materials whose names I did not know. The clients of the code were going to provide their own strings as material names, so I needed some way to access properties by using a string as an index. This would allow me to write code like

mr.modulus := 1.1e7; // et. al.
Materials['aluminum'] := mr;

An array with these properties is called a map or associative array.

If you’d like to learn how to build this data structure, click here to download both the text and the code.

I presented this topic at the June 3, 1999 meeting of the Capital PC User's Group Delphi SIG. The Microsoft Word doc and the Delphi source code can be downloaded by clicking here.

 [ Note: this article is rated 'advanced'. ]

top

Polymorphism

Polymorphism is a slippery subject. Although I have had no time to work up text to go with this Delphi 3 code, & there are hardly any comments, (hey, it's free) you may download (3,352 bytes) it and experiment with the virtuality of various functions, especially CloneSelf. Note that I cannot support this code by email, but rather discussion should take place in the Borland newsgroups, preferably borland.public.delphi.objectpascal.

top

Creating a Robust, Type-safe TList

[Revised 2002 July 31] Edited from Delphi Developer magazine of Oct 97 (www.pinpub.com). Why and how to make your TLists type-safe in all versions of Delphi, and how to make your lists own their contents (or not). This is the theory behind TeoList and TeoOwningList, our TList derivative classes. You may download these classes for free.  Note that Classbuilder for Delphi now optionally builds TLists for the classes it generates. Click here to download the article.

top

Nice and Nicer

First published in the August 1997 issue of Delphi Informant magazine, this edited article and accompanying source code demonstrates the minimum requirements for high-quality Object Pascal classes. If you're thinking of investing in Classbuilder for Delphi or ClassBuilder++ for C++, this discussion of theory may prove helpful. Click here to download.

top

Moving from Fortran to Object Pascal

An attempt to explain object oriented programming from the Fortran perspective. Click here to download.

top

Object Based Storage Management in Fortran77

First published in The Fortran Journal, this article includes the code for a simple storage manager object, and shows how to use it to make your Fortran77 programs more robust. Click here to download.

top

Automating Object Based Fortran programming

The documentation and awk source code for waso and wado, the two tools that "automate" Object Based Storage Management in Fortran77. Note that these tools are offered as is; no support is available. That is: NO support. Click here to download.

top