----- Original Message -----
From: "Peter" <[EMAIL PROTECTED]>
To: "Borland's Delphi Discussion List" <[email protected]>
Sent: Monday, April 24, 2006 6:46 PM
Subject: Re: Delphi and Java


> Hi,
> Pauli seems to be heading the same way I am, locking all things into
> classes. With regards to global variables, I've started to create a
> configuration class for my apps. This has the added benefit that I can
> save the program configuration with changes to a config file in one
> clean location.

It's me (Kevin) that's going class locking mad: I even have a class instance
called GlobalVars
containing read only properties (so that the variables' values aren't
modifiable:
so that they behave like global constants:  XX := GlobalVars.Const_XX ;
etc.)

> Being an assembler programmer, pointers don't bother me too much, but I
> must admit I prefer dynamic arrays in Delphi, it just makes the code
> clearer and it doesn't appear to have much impact on performance. Having
> said that, I have a few GIS apps where I use pointers heavily as class
> overheads are a bit too much and dynamic arrays are a bit messy. Even
> there, I've started exploring ways of using arrays within arrays of
records.

Mostly I don't use very large objectlists (I can see that a million pointers
occupy
a lot less memory than a million class instances: I suppose you could have
classes of say a thousand
pointers in an array so that the class overhead is reduced by a thousand):
in C# even an integer
is a class which implies all sorts of overheads (though there are also
advantages);
what interests me is finding a method for clearly defining what's going on:
as you say the
Delphi (and even more that used in C#) method is very clear; there is also
the advantage
that code completion helps in that the class variable names are suggested to
you instead
of your having to go and look for constants wherever they have been
declared;
You would not believe how incoherent some projects can get if global
variables are not kept in order (some I have seen have been declared in
units declared
in the uses clause of some other unit, but not declared in the project, so
that the original declaration
of the variable does not even turn up in the project file search! This is
possible in delphi but not in C#).

Delphi is fine in that it allows you to use OOP or not as you wish, but
unfortunately this allows for sloppy practices
within or without an OO structure: C# or Java more or less impose OO: if you
want to be sloppy after that,
it is through sheer bloody mindedness!

Kevin

_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to