I\'ve been using Delphi for quite some time now, but rather than coming from a CS background I have learnt \"on the job\" - mostly from my Boss, and augmented by bits and pi
The big difference is that records are value types and classes are reference types. In a nutshell what this means is that:
a := b
, a copy is made. There are two distinct instances, a
and b
. a := b
, both variables refer to the same instance. There is only one instance. The main consequence of this is what happens when you write a.Field := 42
. For a record, the value type, the assignment a.Field
changes the value of the member in a
, but not in b
. That's because a
and b
are different instances. But for a class, since a
and b
both refer to the same instance, then after executing a.Field := 42
you are safe to assert that b.Field = 42
.
There's no hard and fast rule that says that you should always use value types, or always use reference types. Both have their place. In some situations, it will be preferable to use one, and in other situations it will be preferable to use the other. Essentially the decision always comes down to a decision on what you want the assignment operator to mean.
You have an existing code base, and presumably programmers familiar with it, that has made particular choices. Unless you have a compelling reason to switch to using reference types, making the change will almost certainly lead to defects. And defects both in the existing code (switch to reference type changes meaning of assignment operator), and in code you write in the future (you and your colleagues have developed intuition as to meaning of assignment operator in specific contexts, and that intuition will break if you switch).
What's more, you state that your types do not use methods. A type that consists only of data, and has no methods associated with it is very likely best represented by a value type. I cannot say that for sure, but my instincts tell me that the original developers made the right choice.