How would you go about creating a vector class in Delphi? I would prefer to put all math related stuff into a DLL. Should I use a record or a class implementing an interface?
Pros of record approach:
Cons of record approach:
Class.VectorProp.X := 42)What do you think?
It depends on your priorities.
If performance is a top priority, go for records. But if implementation hiding is top, go for interfaces.
But why not use a package so you can both use static and dynamic linking if you want it. Of course, a DLL is prefered if the code is to be used by other languages, a DLL is a better aproach.
Botom line, the requirements and their relative priority determine the implementation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With